Tutorial on light maps? dx8 or 9

Started by
2 comments, last by johnnyBravo 20 years, 8 months ago
Hey I''m trying to learn how to use light maps, but I can''t find any tutorials on how to do it? Or if someone could explain on what to do, eg whats in the structure CUSTOMVERTEX, or whats in the FVF etc, and how to use it.
Advertisement
You basically add another texture to a polygon.
So the vertex structure, would need another set of UV, and the FVF should change from TEX1 to TEX2 showing were using 2 textures.
Then you set the proper TextureStageStates and render.

.lick
ive tried that but for some reason it won''t work.

What I''ve decided on to use is a Colour Light Map.

i used this code slightly modified names from the sdk on colour light maps.

myDevice->SetTexture(0, myTexture[3]);myDevice->SetTextureStageState( 0,D3DTSS_COLOROP, D3DTOP_MODULATE );myDevice->SetTextureStageState( 0,D3DTSS_COLORARG1, D3DTA_TEXTURE );myDevice->SetTextureStageState( 0,D3DTSS_COLORARG2, D3DTA_DIFFUSE );


do i still have to set the fvf tex to 2?

also with adding a second set of uv etc is this how i do it:
	struct CUSTOMVERTEX3D		{     			D3DXVECTOR3 position;			D3DXVECTOR3 normal;			D3DXVECTOR2 ctexture;			D3DXVECTOR2 mtexture;		};		#define D3DFVF_CUSTOMVERTEX3D (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX2) 


thanx
Completely! You just have to SetTexture( 0/1, .. ) + SetTextureStageState( 0/1, .., .. ).

.lick

This topic is closed to new replies.

Advertisement