Painting Decals onto Textured Meshes, how to?

Blitz3D Forums/Blitz3D Programming/Painting Decals onto Textured Meshes, how to?

Kryzon(Posted 2008) [#1]
Hello all,
I've been struggling for a while on how to make texture decals in Blitz3D. I must point out I don't want that common "sprite positioning and normal-aligning" that is used throughout a lot of projects (and that unfortunately fails to be realistic when you shoot at an Edge where you can see the sprite flying a bit in the air). The best example of what I want to achieve is like in Counter-Strike's engine: the blood splatters, wall-shots and grenade explosion burnt marks are all texture decals that are applied\painted to the main level texture, not sprites. They turn between corners and are by no means a 3D object.

Look here for some samples of what I mean:




I'm in no way experienced with complex UV texturing through code techniques. I consider myself more artist than coder - hence why I chose Blitz3D. But still can't make it happen.
Another practical example can be seen in your Blitz3D -> Samples -> Birdie -> TexPaint folder. It's something like that, what I want. But with custom decals.
If you have any information, code snippets, or general assistance, please do provide. Something good and free for all of us might come from this.

Thank you for your time,
Rafael.


Mortiis(Posted 2008) [#2]
Marks Markio example has it.


Ross C(Posted 2008) [#3]
I think your best bet would be, to lightmap your levelmap your level, as this will give each mesh it's own unique texture space. Then it would be a case of using the picked UV command in the code achive to get which parts of the texture the explosion is occuring and paint directly to the light map texture.

Reason you can't paint straight to the texture map where the details are, is this is usually a repeating texture, spread acrooss multiple meshes, to save on VRAM.

Bare in mind, the resolution of the texture(s) will limit you to low detail decals, whereas sprites give you a much higher quality decal. That is unless, you use a massive size lightmap texture, or lots and lots of low res maps. Your looking at alot of VRAM usuage though depending on the size of your level.

I'd suggest using .DDS textures for this purpose, as they are compressed in VRAM.


Mortiis(Posted 2008) [#4]
If it's for a flat surface like bullet holes on the walls, you can get the coord with linepick and create a quad with the hole texture and align it to the walls rotation.


Ross C(Posted 2008) [#5]
That is what i'd do, but he wants to paint straight onto a texture. You could try and build, on the fly, a mesh that wraps itself round the terrain. Rather complex though and time consuming if your firing alot.

I DO notice though, that even games you pay top dollar for, have decals that stick out of the scenery, so if it's good enough for them ;o)


Kryzon(Posted 2008) [#6]
Mortiis, the problem is that with sprite decals the following problem happens:


Or else I wouldn't have a problem using it, like I stated in my first post.

@Ross C: Thanks for the Code Archive suggestion! I looked up and found that code from Fredborg, it really sounds promising! perhaps I can use a different texture layer with multiply mode and insert the decals as I please. But it is still very complicated kekekek


BIG BUG(Posted 2008) [#7]
Depends on the size of your level. If you want to paint directly on texture every inch of your level needs to own a part of the texture exclusivly, which will result in pretty low res "decals".
Painting on the texure is a good solution if you want for example wounds on a charakter, or maybe low res blood on walls but it won't work for high detail like these poster in the upper screenshot.
For this one you have to create an own mesh which wraps the level geometry...


chwaga(Posted 2008) [#8]
Yes, the only solution I can think of would be sprites that conform to the shape of the behind geometry


Sledge(Posted 2008) [#9]
There are a few towel mesh routines referenced here. Might be handy (FLEX looks applicable).


Kryzon(Posted 2008) [#10]
I was thinking of using a box intersection-boolean-like object to construct a plane from the intersection between the box (placed at the CollisionXYZ) and make it a decal, with proper vertex UV mapping.

Mesh Intersection, anyone?


Nate the Great(Posted 2008) [#11]
I don't know a lot about this subject, but you could copy the mesh and assign a blank texture to the coppied mesh, and put your decals on the blank texture that you assigned to the coppied object. You may also have to mess around with the entity order to get it to work. Kind of confusing and only tested once, but I lost the code. :(


Nate the Great(Posted 2008) [#12]
Also you could use the file that you mentioned earlier (Blitz3D -> Samples -> Birdie -> TexPaint) and replace the oval command in the function drawblood with the drawimage command.