Learn it, it will serve you well.
Meanwhile you can do the following to add your lightmap to the shader:
This is your base texture:
texture BaseTex
<
string ResourceName = "Large_House.dds";
>;
... it is your texture variable (Ignore the resource name for now)
and this
sampler diffuse_smp = sampler_state
{
Texture = <BaseTex>;
MinFilter = Anisotropic;
MagFilter = Linear;
MipFilter = Linear;
AddressU = Wrap;
AddressV = Wrap;
};
is your first texture sampler; something which samples a texture (as you probably guessed).
This sample happens to be named 'diffuse_smp' and is intended to sample your base texture. It also happens to be the first sampler, therefore it uses stage zero.
Dark Lights needs a sampler created for its lightmap texture. I cannot remember if this needs to be first, stage 0, or second, stage 1. But this is a small matter of changing the order in which the samplers are defined.
So to create a new sampler. Copy and paste the base (diffuse) sampler, and base texture. Rename them to light map: for example:
texture LightMapTex
sampler LightMapSampler = sampler_state
Texture = <LightMapTex>
In dark shader you should see a new texture slot in your project providing you have set the shader as current.
Add you lightmap texture into your DarkShader project; it should be in your lightmaps folder in your executable path if you have gotten as far as light mapping a scene in DarkBASIC.
Now, your lightmap uses different UV coordinates to your base sampler. These UV coordinates are generated by Dark Lights, so it is these UV coordinates you need to use for your lightmap texture in the shader.
Lookup your shader structures:
struct app_in
{
float4 pos : POSITION;
float3 normal : NORMAL0;
float3 tangent : TANGENT0;
float3 binormal : BINORMAL0;
float2 uv : TEXCOORD0;
};
struct vs_out
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
float3 normal : TEXCOORD1;
float3 tangent : TEXCOORD2;
float3 binormal : TEXCOORD3;
float4 wpos : TEXCOORD4;
};
... and add an additional uv coordinate; float2 uv2 :TEXCOORD1 in your app_in struct, and coordinate 5 in your vs_out struct. These need to have unique texture coordinate identifiers per memeber.
This now advances your shader structures to include your second UV maps, which now need to be passed to your pixel shader.
You may aswell duplicate this line: OUT.uv = IN.uv;
into: OUT.uv2 = IN.uv2;
Finally we'll just multiply your texture pixels by your lightmap pixels for the time being; which means your object can only be seen if lit by some lightmap texture, even if the texture is plain white.
Add the code below near here in your pixel shader: float3 color = AmbientColor;
float3 lightMap = tex2D(LightMapSampler, IN.uv2);
color *= lightMap;
That should get you started. If your object is black it means your lightmap texture has not been added or is black; since zero is black and zero multiplied by anything is always zero.