Decals on terrain

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Zoulz
Posts: 12
Joined: Fri Aug 19, 2005 11:07 am
Location: Sweden
Contact:

Decals on terrain

Post by Zoulz »

Hello, I'm wondering if there is any support in Irrlicht for drawing decals on objects (terrain for instance)... blood-splats or unit markers.

For example, when you click something in World of warcraft a red marker appears.

Anyone tried this or know a some way to implement it?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

decals are not very hard to pretty tough depending on how nice you want it to look. heres some ways ive thought of doing it
easy:
use the triangle selector to get intersection like in example 7, add and rotate the right decal mesh node, then add a deletion animator to it. yuck.
harder:
make a custom node that is a cyclical vertex buffer, use the triangle selector to find the center and 4 corners of the decal. if a corner has no collision or it's too far away then clip it to the edges of the center's triangle and recalculate tcoords. still only really good for small decals on flat surfaces.
hard:
same as above, but copy all triangles inside the collision area, clip them to collision fustrum, project the tcoords on. too hard for me.

for markers, you could just add a red marker node and make it a child of the currently selected node, or have each object have a hidden marker child node that becomes visible when you select it.
Zoulz
Posts: 12
Joined: Fri Aug 19, 2005 11:07 am
Location: Sweden
Contact:

Post by Zoulz »

How about projected textures? I've heard it can be used for decals, but i'm not sure how it works. Anyone whom can explain or point me in the right direction?
Post Reply