Game Development Community

Transparency problems on fxRenderObject

by Vijay Myneni · in Torque Game Engine · 01/25/2005 (12:59 am) · 4 replies

Hello,

I was hoping someone could help me out here. I am using Melv's fxRenderObject resource to render really simple flat quads with a texture on them. Each object is just a plane, and they are always horizontal and flat (normal pointing straight up in positive Z).

So I need to set them up to render with transparency and work properly when some of them are overlapping others. I know I have to do at least this in prepRenderImage:

image->isTranslucent = true;
image->sortType = SceneRenderImage::Point; // or ::Plane

What else do I need to do to get this to work? I've tried various combos of Point and Plane, and also thrown in what I thought were the correct data for other image variables, like poly and plane. But it always looks okay from some angles, and not from others. I guess it's because they're not sorting right. You always view these things from above, so it would probably be enough to just sort them based on their z-position value, but I can't seem to figure out how to make that happen.

This is not my area of expertise unfortunately. I will keep researching, but I was hoping someone could point me in the right direction.

Thanks,
Vijay

#1
01/25/2005 (1:16 am)
Nevermind, found a chunk of code in the prepRenderImage method of waterBlock.cc that seems to work for me. Posting to these forums is really good luck for me, it seems to increase the chances of finding the answer on my own. :)
#2
03/01/2005 (1:48 am)
I'm having some problems with transparency and that object too. Could you please post that code? :)
#3
03/02/2005 (1:16 pm)
Hi Luis,

I actually ended up doing something different that using the code in waterBlock.cc. My situation was a simple case, in that I was only displaying perfectly horizontal textures slightly above the ground plane. So I ended up offsetting each one by a random fractional amount in the z direction, and then using this offset to sort them:
image->obj = this;
		image->isTranslucent = true;
		image->sortType = SceneRenderImage::Point;
		image->poly[0] = Point3F(0, 0, mHeightOffset);
#4
03/03/2005 (1:11 am)
Ok, my problem different, and finally solved disabling writing to the depth buffer. Here's the whole discussion: www.garagegames.com/mg/forums/result.thread.php?qt=26536 just in case :)