Hi I've got another problem with my lightmaps. At this point they look nice for me. But I have a sun in my map (moving ambient light source: ILightSceneNode). The problem is, that my lightmap textures have black areas (where no light is). But when the sun illuminates these areas they will be also black because the texture is black there. Here is a picture of the problem:
And the sun doesn't illuminate colored walls even if I activate lighting on the material. My first try was EMT_LIGHTMAP_LIGHTING. Now the whole texture will be dark when the sun is too far away but will remain black at parts where the lightmaptexture is black when the sun comes up. Is there a possibility to blend lightmaps and other light sources together with a realistic result? I think the blend operation is the problem but I don't want to change the irrlicht sourcecode. Perhaps there is an easier way?!
In dark caves where no sunlight will appear the lightmaps work fine. But with lightsources it sucks. Any suggestions?
Next lightmap problem (ambient light)
Fixed it with my own Lightmap Material Renderer.
These settings works fine:
But you have to set the lightmap texture as texture stage 0 and the basic texture as texture stage 1.
These settings works fine:
Code: Select all
pID3DDevice->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 1);
pID3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_ADDSMOOTH);
pID3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pID3DDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pID3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
pID3DDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pID3DDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
pID3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
But you have to set the lightmap texture as texture stage 0 and the basic texture as texture stage 1.