Game Development Community

Sub-shape fading

by S. Lee Gooding · in Torque Game Engine · 08/03/2005 (2:25 pm) · 5 replies

I've got a shape with 11 "sub-shapes". By sub-shape, I mean the TSMesh objects inside shape.tsShapeInstace. I.e. if you view the shape in the show tools, each one is listed in a dropdown on the bottom.

I'm trying to fade each one individually, separate from the others. I mean something like using startFade, but I need it to work on each individual subshape.

Any ideas on how to do this?

I tried to adjust each individual TSShape::visible field, and it works, but when animating the fade it does an ugly jump from opaque to translucent, then the rest of the fade is nice and smooth. Same with a jump between translucent and opaque. My animating code isn't the problem because taking emap out of the rendering visibility calculation (tsShapeInstance.h line 531) results in a smooth fade, but with the insides of the object showing much more than normal.

Any other ideas?

#1
08/03/2005 (4:55 pm)
There is also a threshold on the visible value, under which it's still rendered as opaque.

Are you rendering translucent emap'ed shapes?
#2
08/04/2005 (8:46 am)
They are not emaped. It's a regular textured mesh, split into 11 pieces. None of the textures have transparency/translucency. I just want to do the translucency for each piece programatically.

I do see that if the visibility is above .99 (is that the one you mean?) then it will be rendered opaque, but that's fine. My issue was that at .95 it looks like it's .5, hence the very visible jump.
#3
08/04/2005 (5:19 pm)
Your comment "my animating code isn't the problem because taking emap out of the rendering visibility calculation (tsShapeInstance.h line 531) results in a smooth fade" led me to believe there was some emap stuff going on. Sorry. :)

If you're not doing the emap stuff, and removing it from the 3space code makes things work properly, maybe that's the best solution. :)
#4
08/05/2005 (9:04 am)
Thanks :) that may be what I end up doing..

The only problem with that was that my model has some hollow parts (like a tube), and when I make it translucent, the inside is much more visible than the outside. The outside seems to fade correctly, but the insides still jump in and out.

I also tried going into the renedering code and in the place where it looks at the visibility of the TSMesh and either draws it faded or opaque, I added code to set overrideFade to the visible value, set visible to 1, the draw it normal, then restore it back. This results in a nice fade, but for some reason the visibility "bleeds" to some other parts. Like if all pieces are the same translucency level, they look great. But if I want to make one more visible than the others, it won't let me do it. It's weird because it's not consistent..

So do you think my attempt at using the visible value is correct? Do you know of any other parameters that affect visibility?

thanks for your replies..
#5
08/05/2005 (5:09 pm)
Maybe need to make sure backface culling is on when rendering translucent things? It might be getting turned off.