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

 Home / 3D Theory & Graphics / Multiple colliding lighsources 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 04, 1999, 04:56 AM

Hello,

I assume you( the reader ) define your lightpoints with a finite radius. That's means a
sphere surrounds the light in which faces will be lit. Now when a face is in the lighsphere
you do one pass for the texture and one pass for the lightmap. Now what if two lightspheres
intersect and a face is in the intersection? There are two possibilities:

You do a three-pass rendering for the face one for the texture one for the first light's
lightmap and one for the second light's lightmap.

The second method is to first combine the two light's lightmaps in one lightmap and just do
a single pass rendering on hardware or a two pass on software. But how would you combine those
two lightmaps?

Jaap Suter

 
Jorrit Tyberghein

March 04, 1999, 09:56 AM


>>The second method is to first combine the two light's lightmaps in one lightmap and just do
>>a single pass rendering on hardware or a two pass on software. But how would you combine those
>>two lightmaps?

Just add them. In case the two lights are static (i.e. can't move) then you can
just add the lightmaps together to a static lightmap. For dynamic lights, here
is how Crystal Space does it: CS does not hold seperate lightmaps for all dynamic
lights. There is one static lightmap for every polygon and then a series of
light-patches with every polygon. Every dynamic light that hits a polygon creates
a light-patch on that polygon. A light-patch is simply a convex polygon which
is coplanar with the original polygon and defines where the light falls on the
polygon. In Crystal Space a light-patch can be convex because they are calculated
by going through portals which are also convex.

If, at some point, the polygon becomes visible then the texture needs to be put
in the cache. In that case the cacher will check if there are any changes in the
dynamic lights for that polygon (i.e. has some dynamic light in the vicinity of
the polygon moved or changed color/intensity). In that case it will use the
static lightmap, copy it to the real lightmap and add all the light-patches to the
real lightmap. The real lightmap is thus the combination of the static lightmap
and all the light-patches. This is then used to calculate the lighted texture
for the texture cache.

Greetings,

 
Jaap Suter

March 04, 1999, 11:51 AM

Yeah i know it's posibble in software but if i would do that in hardware i would have
to upload the dynamic lightmaps to the texture cache on the card every frame. Even so a
16*16 or 32*32 (depending on lightmap size) lightmap add per face per frame is even worse.

Software is cool, but for hardware i guess we'll just have to wait for more than
two textures per single pass rendering. (Direct3d supports up to 8 texture stages, but
think you dont bother cause you are Developing for Linux right now.)

 
Jorrit Tyberghein

March 05, 1999, 01:51 AM



Jaap Suter wrote:
>>Yeah i know it's posibble in software but if i would do that in hardware i would have
>>to upload the dynamic lightmaps to the texture cache on the card every frame. Even so a
>>16*16 or 32*32 (depending on lightmap size) lightmap add per face per frame is even worse.

This is in HARDWARE as well. Crystal Space runs in software, Direct3D, OpenGL, and
Glide and it uses the same lightmap technique on all of them. It works VERY well.
You only need to merge one lightmap with the texture in hardware. The other lightmaps
are merged in software. This is fast enough because lightmaps are smaller than the
original textures.

>>Software is cool, but for hardware i guess we'll just have to wait for more than
>>two textures per single pass rendering. (Direct3d supports up to 8 texture stages, but
>>think you dont bother cause you are Developing for Linux right now.)

Crystal Space runs on Linux, Windows, DOS, OS/2, BeOS, NextStep, OpenStep, Rhapsody,
Macintosh, and Amiga so it is not really limited to Linux.

Greetings,

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