Brilliant Ventilator!

Let me work with it a bit more, then I can provide an analysis(already got my ps/vs detailmapping shader with lightmap applied). Collision seems good all around too(c_trace/c_move, ect.)! Thanks for the demo.

@Frank -

Quote:


A simple multiplication of the lightmap should do the job. But it must take a different uv-map into consideration.




Looks like this shouldn't be a problem. Heres what I had to do in my shader:

put a shadowmap sampler:


sampler shadowmap = sampler_state
{ Texture = (mtlSkin3);
MINFILTER = LINEAR; MIPFILTER = LINEAR; MAGFILTER = LINEAR; };

Then, in the structs, I put a second set of texture coordinates. I think all shaders use "texCoord0". For having a lightmap, it looks like it's texCoord1.

struct VS_INPUT0
{
float4 pos: POSITION;
float2 texCoord0: TEXCOORD0; //1st uvmap coordinate set
float2 texCoord1: TEXCOORD1; //2nd uvmap coordinate set
float4 normal: NORMAL;
};

struct VS_OUTPUT0
{
float4 pos: POSITION;
float2 texCoord0: TEXCOORD0; //Used for colormap
float2 texCoord1: TEXCOORD1; //Used for detail1
float2 texCoord2: TEXCOORD2; //Used for detail2
float2 texCoord3: TEXCOORD3; //Used for shadowmap
float4 diffuse: COLOR;
float fog: FOG;
};

struct VS_OUTPUT2
{
float4 pos: POSITION;
float4 diffuse: COLOR;
};

struct PS_INPUT0
{
float2 texCoord0: TEXCOORD0; //Used for colormap
float2 texCoord1: TEXCOORD1; //Used for detail1
float2 texCoord2: TEXCOORD2; //Used for detail2
float2 texCoord3: TEXCOORD3; //Used for shadowmap
float4 diffuse: COLOR;
};

Put this in your vs_output():

Out.texCoord3 = In.texCoord1;

And simply in the ps_main:

float4 color = tex2D(colorMap,In.texCoord0);
float3 texture0 = tex2D(detail0, In.texCoord1);
float3 texture1 = tex2D(detail1, In.texCoord2);
float4 shadow = tex2D(shadowmap, In.texCoord3);

return (color*vecAmbient+(color * In.diffuse))*shadow;

I don't know if your supposed to multiply by the shadow, as I'm no shader programmer(and admit, took a few minutes to even figure this out). But it works, and also colored lighting on the light maps work too!