Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Colored lightmapping? Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Jaap Suter

March 02, 1999, 07:19 AM

How is it possible to do colored lightmapping? I can do monochrome lightmapping but to be able to use colored lightmapping i need a lightmap with that color. I don't think for every color you create a seperate lightmapping????

Jaap Suter

 
Phantom

March 02, 1999, 08:11 AM

Jaap Suter wrote:
>> How is it possible to do colored lightmapping?
>> I can do monochrome lightmapping but to be able to
>> use colored lightmapping i need a lightmap with that
>> color. I don't think for every color you create a
>> seperate lightmapping????

Well, I guess you could just store RGB lightmaps? That's
much less efficient in terms of memory of course...
Other than that, what's the problem with that? Are you
using an 8bit color mode? Just curious...

 
Jaap Suter

March 02, 1999, 09:03 AM

No i'm using 16 bit colors. But what if i want my lighting fade from red to green? Then
every frame i need to update my lightmaps. If my lightmap is 128 by 128 then i need to write 32768 bytes a frame? That's a pitty isnt it?

 
Phantom

March 02, 1999, 09:07 AM

Jaap Suter wrote:
>> No i'm using 16 bit colors. But what if i want my lighting
>> fade from red to green? Then every frame i need to update my
>> lightmaps. If my lightmap is 128 by 128 then i need to write
>> 32768 bytes a frame? That's a pitty isnt it?

Yep, that's a pitty... :) But lightmaps are typically used for
static lighting. I would like to use lightmaps in my engine,
but not for the dynamic lights. I would like to precalculate
lightmaps just so the world looks pretty, and then add projected
lights to do the cool stuff.

 
Dan Brown

March 02, 1999, 02:41 PM



Jaap Suter wrote:
>>No i'm using 16 bit colors. But what if i want my lighting fade from red to green? Then
>>every frame i need to update my lightmaps. If my lightmap is 128 by 128 then i need to write 32768 bytes a frame? That's a pitty isnt it?

I've just thought of a method, but I think it would be too slow to use. I'll describe it
anyway...

You could calculate your lightmap as pure white, using just one byte. Then, when you get get
the lightmap value during texturing, apply a filter to get the color.

Then all you need to modify each frame is one filter.

example (using 24-bit lighting)

Lightmap value = 127 ( 50% brightness )
Filter = 0x00FF00 ( 0% red, 100% green, 0%blue )

temp = ((Filter AND 0xFF0000) >> 16); // Get byte for red filter
temp = temp * LMvalue; // Got a red value in range 0..65535
red = temp

 
Jaap Suter

March 03, 1999, 02:44 AM

Yeah sounds cool but you still need to upload the entire lightmap again to
the hardware card. In software your solution sounds nice but i don't think it
is hardware usefull. ( I think, i never practically implemented it )

Jaap Suter

 
Jorrit Tyberghein

March 04, 1999, 09:30 AM



Jaap Suter wrote:
>>How is it possible to do colored lightmapping? I can do monochrome lightmapping
>> but to be able to use colored lightmapping i need a lightmap with that color.
>>I don't think for every color you create a seperate lightmapping????

In my Crystal Space engine we use RGB lightmaps. That means that the lightmaps
has three entries for every lightmap lumel (one for red, green, and blue). Mixing
those three colors gives you all possible combinations.

This is of course slower than using monochrome lightmaps but that's difficult
to avoid. In practice it works very well, both for software and hardware rendering.

Greetings

 
Thierry Tremblay

March 04, 1999, 11:15 AM

Jaap Suter wrote:
>>Yeah sounds cool but you still need to upload the entire lightmap again to
>>the hardware card. In software your solution sounds nice but i don't think it
>>is hardware usefull. ( I think, i never practically implemented it )

You don't have to upload the map everytime the color change with a 3D accelerator.
You can upload a monochrome version (8 bits) of the lightmap to video memory and
then use diffuse color mondulation to color the light. You have to set the diffuse
color to the light's color, and apply a "diffuse * texture" blending to the lightmap.

Thierry

 
This thread contains 8 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.