Change lightmap texture.

Blitz3D Forums/Blitz3D Programming/Change lightmap texture.

I am currently working on a game where i need to be able to show the lightmap texture, then hide it. I need to do this everyframe. What would be the quickest way to do this? I figure i have a few options:

1. Create an identical scene, one with a lightmap and one without. Since i'll be instancing the whole scene, it shouldn't take up that much more memory.

2. I go through every entity in view of the camera, and texture each one with a blank lightmap (127,127,127)

3. er... well, i did say i only had a few ;o)

No.1 would definately be the quickest out of the 2.

Only other solution I can think of would be to hold a master copy and a blank lightmap and copyrect alternately onto the lightmap texture. I'd imagine your lightmap is pretty big so probably too slow.

Stevie

Well, the plan here is, to make a fps torch. I have a full bright scene and a scene which is dark and only light comes from the light sources. Everything else will be shrouded in darkness. Now:

I render the lightmapped scene, then copy this to a texture. Then, render the fullbright scene, and overlay a special mesh, textured with the lightmapped scene. This mesh has alpha so the middle is see through. Therefore you can see the full bright scene below, as if it's a torch light.



Grey means non see-through. White means completely see-through.

The point of rendering the lightmapped scene, is so you can get lights that glow in the dark, seperate of the torch light.

"i need to be able to show the lightmap texture, then hide it. I need to do this everyframe"

Show = 5 - Show
TextureBlend( Lightmap, Show )
;Adjust 5 with the blending mode your lightmap uses (perhaps Multiply).

So, zero disables the texture from blending? NICE!

That's what i'm lead to believe from the docs, although i can't test it

Yep, it works. Thanks man, you've saved me alot of hassle! Nice one!