trying to get decal lighting working.... need help

Blitz3D Forums/Blitz3D Programming/trying to get decal lighting working.... need help

Kalisme(Posted 2006) [#1]
okay, my last post wasn't really meant to be about decal lighting... but I guess I sort of made it sound like it was... oh well... this one's just about decal lighting

I was playing around with texture and mesh blending... I had 2 meshes...(both were just flat square plains) the first one was meant to represent the wall of a level (so I textured it like your average wall) the second was the lighting... it had two textures...
the first texture was of a face lightmap (I just used the spotlight effect on a blank image in photoshop) and the other was a scaled down moveable texture (using "positiontexture") which was just a black texture with another spotlight effect on it to lighten the middle.

anywho, I actually got the second texture to subtract from the fisrt... then that mesh was ontop of the other one making it look like basic quake decal lighting...

I had to set up the meshes and textures like:
EntityBlend tile1,1 <-first mesh
EntityBlend tile2,2 <-second mesh

TextureBlend tex1,1 <-wall texture
TextureBlend tex2,2 <-lightmap texture
TextureBlend tex3,3 <-flashlight texture

EntityTexture tile1,tex1
EntityTexture tile2,tex2,0,1
EntityTexture tile2,tex3,0,2

now... here's my problem.... I want this effect for decal lighting.... but to even start to do this... I'd need to have a mesh with 2 vertex texture location setups but acting as a single surface... (if that makes sense...)

is that even possible?
can anyone help?
does any of this make sense? (I'm bad at explaing this sort of thing)

thanks for reading


jfk EO-11110(Posted 2006) [#2]
vertex texture ocation setup? Probably you mean a UV Set?

A surface may have up to 2 UV sets. If your mesh has multiple textures on layer 1 (tex1) then it will also have multiple surfaces, where the lightmap texture may be used by all those brushes as the 2nd UV Set/Layers texture.

However, if you can manage it to use only one texture (eg. by using 4*4 tiles on a 1024*1024 texture instead of 16 individual textures), you'll have one single surface.

Tho I'm not sure if this is really what you want. I think you'd rather need a third UV set for your decal light. Probably it would be better to use a number of sprites to create a mini-patch similar to sswifts shadow system, to be textured by the decal texture in addional blendmode.

One way would be to store the vertex and triangle information of the mesh in an array at startup, then in the mainloop you'll check what vertices are inside the light volume, then assemble a clone of that part of the mesh and texture it the way you want.