Lightmap flashing white

PrdglSqrl

30-06-2008 17:54:08

Basically, the lightmap pass in ETM v2.2 isn't working properly. I know little of shaders so I don't know if it's how I set up my material, or if it is the PSLighting.cg shader that's causing this.

Specifics. When I apply a lightmap to my terrain, as I move around, it often flashes white around the terrain. Also note, the lightmap is doing it's job in lighting the terrain, it's just this one little white flash problem that I need remedied.

Thanks in advance
~Alex

Chris84

09-08-2008 14:17:27

I've had a similar problem with flickering lightmap/shadows.
What i did to fix the lightmap was add "lighting off" to the lightmap pass in the material. Maybe this works for you too. Like this:



pass
{
// lightmap texture pass
// workaround for flickering
lighting off
scene_blend modulate

vertex_program_ref ET/Programs/VSLodMorph2
{
}

fragment_program_ref ET/Programs/PSLighting
{
}

texture_unit
{
// dynamically created
texture ETlightmap.png
}
}


Note: other shadows on the terrain do not work after this.

Edit: if you want combined lightmap and other shadows on the terrain with the ETM material, turn lighting back on in the lightmap pass.
And make sure you're using a modulative shadowtype. e.g.
sceneMgr->setShadowTechnique(Ogre::ShadowTechnique::SHADOWTYPE_STENCIL_MODULATIVE );
I'm getting some flickering with SHADOWTYPE_TEXTURE_MODULATIVE so that's why i'm using stencil shadows.