Game Development Community

WaterBlocks and sorting

by Alex Scarborough · in Torque Game Engine · 09/14/2005 (5:15 pm) · 2 replies

I've been working a bit on improving the particle engine lately (minor fixes and optimizations), and the one thing that has been bugging me to no end is how particles and water just don't blend correctly.

img214.imageshack.us/img214/5171/screenshot002000026qf.th.pngLarger version
What happened to our nice blending!?

As far as I can tell, it isn't just particles that have issues with that. For whatever strange and mysterious reason, under certain conditions, objects that use PlaneSort for translucency (namely, the waterblock) render BEFORE objects that use PointSort (pretty much everything else that is translucent). And, as seen in that screenshot, we get nasty blending issues that just look wrong.

My very hackish workaround was just to have the WaterBlock EndSort. It works, and I haven't noticed any problems with doing this, but I think it deserves a bit of looking into. And as the translucent rendering code is far beyond my understanding, I'm not the best person to look into this more.

Note: This is in TGE 1.3. For all I know 1.4 has a fix, but after searching the forums for a while and not seeing this mentioned, I figured it was worth bringing up. And before you ask, yes, I'm sure it's not my code causing that behavior. I downloaded the TGE demo and still saw the same issue.

#1
09/17/2005 (8:33 pm)
I suspect that there are some issues in Torque's translucency sorting code. The EndSort works great but I imagine it borks when the camera is under the water.

It's something I want to resolve but at this point in the 1.4 dev cycle it's probably not going to get looked at (major changes to fundamental subsystems aren't a good idea when you're going for a stable release in the immediate future! :).
#2
09/17/2005 (9:29 pm)
End sort works perfectly when the camera is under water, but completely borks things when we're looking through transparent objects towards the water. I doubt there is really any nice simple hack work around. I suspect that it can be tossed in as another point sort, but I'm sure under some conditions it'll still have blending issues. As you said, at some point it will need to be significatly rewritten.