Decals... Projecting textures
Hi.
I need to put a decal on the mesh. The problem is that i couldn't find any good help on this problem.
For example: i have textured landscape mesh and i need to put an explosion decal on it (on the next texture stage). Decal should be placed exactly in the rectangle i define as two vectors (left-botom, right-top). Hope you've got the idea.
I tried different methods i could came up with but none worked out :(
Please provide me with some code samples if it's possible.
Thx alot.
Oh yeah, i don't want to copy surfaces for this effect.
I just did this in our project and I used this for my guide:
Eric Lengyel, "Applying Decals to Arbitrary Surfaces"
in Game Programming Gems 2
Essentially you provide a rectangular volume and clip all the geometry to it, then you take the resuling triangles and project a texture onto it. Sounds like a lot of work but it isn't. I spent most of the time implimenting my AABB versus triangle mesh code just to get the triangles to clip against. Once I finished that, the clipper itself is a standard sutherland-hodgeman clip and the projection is planar based on an up vector & a right vector. The memory management for our system was a bit of work, too, since I can't do dynamic allocation in our project and had to store worse-case buckets of triangle data, but that's another story.
Don't know any easier way to do it for abritrary geometry. Next step: clip skinmeshes and create new skinmesh geometry that follows the character with decals! YIKES!
- Sphet
Eric Lengyel, "Applying Decals to Arbitrary Surfaces"
in Game Programming Gems 2
Essentially you provide a rectangular volume and clip all the geometry to it, then you take the resuling triangles and project a texture onto it. Sounds like a lot of work but it isn't. I spent most of the time implimenting my AABB versus triangle mesh code just to get the triangles to clip against. Once I finished that, the clipper itself is a standard sutherland-hodgeman clip and the projection is planar based on an up vector & a right vector. The memory management for our system was a bit of work, too, since I can't do dynamic allocation in our project and had to store worse-case buckets of triangle data, but that's another story.
Don't know any easier way to do it for abritrary geometry. Next step: clip skinmeshes and create new skinmesh geometry that follows the character with decals! YIKES!
- Sphet
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement