Transparency and Hardware Instancing Woes

I am kind of at a wit’s end with this issue…
I have some hardware instanced billboard objects that are transparent.
I also have some hardware instanced models in the scene.
There seems to be an issue with the transparency and rendering of objects…
When viewed from certain angles, some of the object’s textures just become completely invisible…

I did read about some other forum posts that had similar issues with transparencies… and experimented with TransparencyAttributes such as M_dual or setBin(‘fixed’,0) but I’ve had only limited success so far. Do these approaches work with hardware instancing?

I’ve been looking at this for the past couple of days so I may have overlooked some obvious solution in midst of my confusion… Any pointers in a good general direction would be appreciated…

(Probably the most difficult thing about this if I run the same code, I get different results with respect to this transparency bug…)

Thanks,

First of all, welcome to the forum–I hope that you enjoy your time here! :slight_smile:

I doubt that binning will help with hardware-instanced models: I believe that the effects of binning are performed before geometry is sent to the GPU–which is where hardware instancing is presumably done.

As to the “M_Dual” attribute, I think that it should help–as long as your textures are generally entirely opaque or entirely transparent.

Ultimately, I daresay that the problem is likely one of sorting: in order for (non-additive) partial transparency to work well (at least by traditional techniques; perhaps there are more-recently developed approaches) the geometry must be sorted such that objects are rendered from most-distant to least.

That said, I don’t myself know how one goes about sorting (or perhaps just rendering in the above-mentioned order) hardware-instanced models. Perhaps someone else will have the answer there!

Of course, if you can get away with using additive blending, then this cease to be a problem, as that blending method doesn’t require sorting!

You should be able to fix this problem by sorting the billboards from back to front. However, it may not be efficient to do so in all cases.

The other ways involve messing around with M_dual, M_binary, M_multisample, and these modes, but they all have limitations.

1 Like