Decal Shader?
by Stefan Beffy Moises · in Torque Game Engine Advanced · 08/08/2007 (4:01 pm) · 3 replies
I'm wondering if anybody has a working decal shader that allows the placement of specific decals onto DTS shapes at distinct positions? Maybe a bit similar to the sgDecalProjector for terrains and interiors...
Any hints how to specify the exact positions in the shader or how to get this working in general?
Thanks!
Any hints how to specify the exact positions in the shader or how to get this working in general?
Thanks!
About the author
#2
thanks for the infos! I am particularly looking for a way to map country flag textures onto planes, but of course this could be used for anything (dirt textures for car racing games, wounds onto zombie bodies, etc. ;))
Could you please email me that paper to beffyATgmxDOTde? The download requires certain memberships I don't have it seems...
Thanks!
08/13/2007 (12:07 am)
Hi AcidFaucet,thanks for the infos! I am particularly looking for a way to map country flag textures onto planes, but of course this could be used for anything (dirt textures for car racing games, wounds onto zombie bodies, etc. ;))
Could you please email me that paper to beffyATgmxDOTde? The download requires certain memberships I don't have it seems...
Thanks!
#3
You might want to dig up a copy of GPU Gems I, there's a paper in there on texture bombing which would probably be easier than the post-process approach in that paper I emailed you (also wouldn't have to worry about shadowing issues).
In short, a grid is created on a texture to which other textures are adjusted and placed (somewhat randomly in their implementation, but you could use constants to define locations). A nice little thing about this is that they also cover storing multiple decals in a single texture (as an atlas) and touch on scaling and rotation. It's probably a better way to go about decals on DTS shapes and with some changes it could be probably also add shaded decals instead of just diffuse decals (sure would be nice to see a chunk taken out of a character using a displacement mapped decal like the walls in FEAR).
08/13/2007 (6:56 pm)
Email has been sent.You might want to dig up a copy of GPU Gems I, there's a paper in there on texture bombing which would probably be easier than the post-process approach in that paper I emailed you (also wouldn't have to worry about shadowing issues).
In short, a grid is created on a texture to which other textures are adjusted and placed (somewhat randomly in their implementation, but you could use constants to define locations). A nice little thing about this is that they also cover storing multiple decals in a single texture (as an atlas) and touch on scaling and rotation. It's probably a better way to go about decals on DTS shapes and with some changes it could be probably also add shaded decals instead of just diffuse decals (sure would be nice to see a chunk taken out of a character using a displacement mapped decal like the walls in FEAR).
Torque Owner AcidFaucet
Here's a link to an ACM paper on the subject. Should be easier to implement than hacking the shadow projector from the lightning system (at least in that there's less backend stuff going on and fewer odds of screwing up everything else). If you can't get to it and would like the pdf I can email it to you (290kb or something).
portal.acm.org/citation.cfm?id=1128939&dl=GUIDE&coll=GUIDE&CFID=26585417&CFTOKEN...
Another possibility is depending on what on the ultimate purpose of the decal it may instead be better to apply a "painting" process via extra UV coords or a mask texture that is painted to as well which would blend another texture overtop in the pixel shader.
Best example would be blasting meat off an enemy to expose guts and bones. Being planar it would only look good if the underlying texture takes that into consideration.
Use grayscale images with color added programaticly and you could get quite a bit of decal action going on seeing how a mask image could be generated seperately and each channel could be used and the final blend pass could use all four channels of the decal image for different decals and give the proper color or blend style based on the channel being used.
I've got two other papers on the subject but they're considerably heavier than that one.
I'd certainly be interested in hearing about what you come up with to solve your problem or any ideas you've got on the topic.