Page 1 of 4

Bullet marks on wall

Posted: Tue Aug 10, 2004 1:23 pm
by Electron
Anyone know how to do this? Ignoring for a moment that you'd need a texture layer for the bullet and your wall would probably have normal texture coords + lightmap and irrlciht only allows 2 texture layers, how couldo one set the bullet texture so that it appeared in the right spot in the wall.
Only solution I can think of is finding the vertices where the mark is supposed to be (probably not a quick task) and changing the 2nd set of UV coords so the texture will be displayed there (all vertices other than ones where bullet should be are set with UV coords outside range and is set to not tile textures for coords outside range(not sure if irrlciht has method for that or if would have to add one)).
That is not a very fast operation, does anyone know anything better?

Posted: Tue Aug 10, 2004 3:09 pm
by Fussel
try placing a sprite where the bullet hits a wall..seems to be far more simple than changing the texture of the mesh

Posted: Tue Aug 10, 2004 3:37 pm
by Electron
thanks, that would probabl ywork fairly well

Posted: Fri Aug 13, 2004 8:51 am
by bal
Check the techdemo, just don't draw a particle but your bullet hole sprite :)

Posted: Fri Aug 13, 2004 12:02 pm
by Electron
anyone knwo how professional games do it? I believe it's with a seperate texture layer, but I"m not really sure.

Posted: Fri Aug 13, 2004 12:12 pm
by calimero
hello electron,
not very sure but i think commercial games use texture on the initial object (with a second layer probably) because if you use another object it may be a bad render effect due to rounds in the Z-buffer.

I think the effect you want is called "decals" and use the 2nd channel texture.

Posted: Fri Aug 13, 2004 12:48 pm
by Electron
yes, that is what I was thinking originally. It just seemed that everyone was telling me to use sprites, which would be a bit easier but would probably not look as good.

Posted: Sun Aug 15, 2004 11:05 pm
by Masdus
sprits where used in some earlier games, but they do lead to problems such as the bullets holes appearing to be detached from the walls at some angles. Decals is one way and i think flipcode.com has a tutorial on this. Might also be able to do it with a shader but as irrlicht doesn't yet support shaders its not really an option.

Posted: Mon Aug 16, 2004 11:28 am
by Captain_Kill
Quake 3 (Plus most Q1 and Q2 engine mods) makes a decal out of polygons then uses the surface normals to attach it onto the level mesh. Check out Q1 or Q2 engine mods for code. No games that I know of use textures. They all use polygons. (Which is why most games have decal limits, lots of decals = lots of polys)

Posted: Mon Aug 16, 2004 11:45 am
by Electron
thanks. I guess I'll have to investigate both types and see which one works best

DECALS

Posted: Thu Aug 26, 2004 8:34 am
by MessiaH
OK.
But if a decal is made of polys...
Imagine that we are making rocket decal(which is surely big :) )
And we are shooting in the edge of a wall.
But in this case some part of our polgonal decal will be out of triangle!
Should we make the decal out of many*many polys,and for each poly check collision with the triangle?!
This is not the ideal way...

Posted: Sat Aug 28, 2004 10:35 pm
by Guest
i wrote a little class to do this stuff... let me know if you still need it

Posted: Sat Aug 28, 2004 10:49 pm
by Armen138
last post was mine.. :) forgot to log in

Posted: Sun Aug 29, 2004 7:21 am
by calimero
armen138,

what is the method you use ? if it's decals your code interest me, please post it, thanks

Posted: Sun Aug 29, 2004 11:26 am
by Armen138
yes, its decals... i'll change around the code a little and post it