Lightmap and Texturing Issues

Blitz3D Forums/Blitz3D Programming/Lightmap and Texturing Issues

Makepool(Posted 2006) [#1]
I’m making a game where the lightmaps can be turned off by the player among other things. To do this I have moved the lightmaps out of the directory with the model and placed them in a folder called “lmap”.

I have created test code where the same lightmap is copied and is both in the folder with the model so that is loaded by default and it also has another identical copy in the “lmap” folder.

When the space bar is pressed the program replaces the original brush with one created in blitz from the diffuse map and the other lightmap. Rather than, as I hoped, be an identical copy the lightmap is no longer aligned properly.

Can anyone help?


jfk EO-11110(Posted 2006) [#2]
how did you "replace" it? You may have to parse all children/surfaces/brushes and "BrushTexture" the right brush layer with the new lightmap texture. This may be a simple grey quad in rgb 127,127,127.

if you want to use directX lights, you may also have to alter the EntityFX, eg. from 1 to 0.


Makepool(Posted 2006) [#3]
yeah sorry forgot to put the bloody code in didn't I?

Graphics3D 800,600

SetBuffer BackBuffer()
Cam = CreateCamera()
MoveEntity cam,0,30,-90


s = LoadMesh("bum.b3d")


 
surf = GetSurface(s,1) ; Get mesh surface
brush = GetSurfaceBrush(surf) ; Get surface brush 

LM0 = LoadTexture("grass3g.png")
LM7 = LoadTexture("lmap\Default Lightmap.png")
TextureBlend LM7, 5

BrushTexture brush, LM0,0,0
BrushTexture brush, LM7,0,7


Repeat
	If KeyHit(57) Then PaintSurface surf, brush
	RenderWorld
	Flip
Until KeyHit(1)



Makepool(Posted 2006) [#4]
Okay I'm closing in on the answer, there are two sets of U,V,W coords and when I set the shadowmap it gets set to the first set of UVW coords. I can't however find anyway to set the shadowmap to be on the second set of coords.


Stevie G(Posted 2006) [#5]
To specify the coord set that the texture will use you need to set it using ...

texturecoords

Stevie


Makepool(Posted 2006) [#6]
Yeah, thanks for that. Sometimes it's easy to just miss the correct command and then spend ages trying to solve the problem when one command will do it for ya!