Game Development Community

Minor fix to decals?

by Jacob Dankovchik · in Torque Game Engine · 09/19/2005 (6:59 pm) · 8 replies

Now, I'm no major coder with the engine and I really don't have a clue what I'm doing with it, but I decided to look around with decals a bit, just to have a look at the code. Something that has been bothering me a LOT is the fact that the decals are made next to useless because when you get multiple ones ontop of eachother they jitter around change order, like it doens't know whose on top.

I just kinda messed around, changed some things t osee what would happen. Then I added glDepthMask(GL_FALSE); after the glEnable of alpha test and then glDepthMask(GL_TRUE); at the end, after the glDisable of it. This small change seems to have fix the problem, at least from what I can see. Is this maybe a help in some way to people?

#1
09/21/2005 (4:22 am)
Does it work properly when other objects are on top of the decal? When the decals are fogged?
#2
09/21/2005 (6:04 am)
Haven't been able to test it all completely, been busy with work. I'm off today though and I'll test when I get home and report back.
#3
09/21/2005 (2:34 pm)
Well, just tried it out and I can't find a single issue anywhere. Seems to work just fine with that small change.
#4
09/21/2005 (4:56 pm)
Wild. Screenshots! :)
#5
09/21/2005 (6:21 pm)
K, Here are 2 shots, before and after. I made the footprints bigger so you could see it all easier

Before, obviously.
img293.imageshack.us/img293/7446/foot10wd.jpgAnd what you can't see is that while I was staring at the footprints, they constantly kept jittering around, not able to figure out their order it seemed.

And here is after:
img293.imageshack.us/img293/9186/foot24xg.jpg
Perfectly normal drawing and blending. :)

And just to make sure your convinced, a fogged-up shot (btw, you may notice theres a small patch darker then the rest. Thats because i sort of did a loop which you can notice if you look closely and there were footsteps ontop of others, making that spot darker):
img153.imageshack.us/img153/7679/fog0qt.jpg
If I may make a suggestion, I'd say you should try to get this into the Torque code right off the bat. Its a painfully easy change, just 2 lines, and basically makes the decals go from nearly unusable to perfectly fine. ;)
#6
09/22/2005 (10:32 am)
I'm sold - it's in trunk. :)
#7
09/22/2005 (12:24 pm)
Heh, yay. I feel special, I fixed somethin in the Torque engine! :)
I started messin around with this thinkin there was no way in hell a fix to this problem would be a single line of code or something. Boy was that a suprise.. heh
#8
09/23/2005 (9:13 pm)
It's people like you that make Torque a better engine. :)