Archived

This topic is now archived and is closed to further replies.

Basiror

LIGHT MAP GENERATION

38 posts in this topic

is want to use this underneather for a lightmap one lightmap is 32*32 which means i could pack 256 lightmaps into one object like this below now my question is would a lightmap with 32*32 bet big enough for a solid which is 256*256? or would i use a 64*64 there? because you d get this a step effect on your steps which is gay and should i use a normal luminance/luminance alpha or even a normal RGBA? thats all the help i need to get started thx
typedef	struct dlightmap_s
{
	unsigned char map[512][512];
}dlightmap_t;
[/CODE]    
0

Share this post


Link to post
Share on other sites
I''d say it depends on the size of your object rather than on the size of your texture...

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning..." -- Rich Cook
0

Share this post


Link to post
Share on other sites
it depends on the size of you texture the smaller the texture the more visible the step effect
0

Share this post


Link to post
Share on other sites
Also, it depends on your filtering...
for a better filtering effect, filter all you lightmaps trilinearly...

0

Share this post


Link to post
Share on other sites
for lightmaps, a normal luminance image is usually sufficient. but if i''m not mistaken, arent luminance maps translated implicitly to RGB in memory? just a thought.. neva was sure of it
0

Share this post


Link to post
Share on other sites
yes but what about colored lights and not only white light with different brightness? use openGL lights? and find out which polygons are affected by it?
0

Share this post


Link to post
Share on other sites
quote:
Original post by Basiror
yes but what about colored lights and not only white light with different brightness? use openGL lights? and find out which polygons are affected by it?


don't do opengl lights if you're doing lightmaps, you should be using lightmaps because opengl lights don't look good enough ...
reading back data from opengl lighting to use in lightmaps is a really bad idea

edit: use colored lightmaps for colored lights.

[edited by - ga on January 7, 2003 5:48:58 PM]
0

Share this post


Link to post
Share on other sites
lets say i have a 32*32*4 lightmap that consumes 4 kb
assume you have 20000 polygons which need lightmaps then you will get 80 mb of lightmaps

isn t that a bit too much?

0

Share this post


Link to post
Share on other sites
80 MB is too much. you can vary the size of the lightmap depending on how big the polygon is. Also you shouldn''t make a seperate lightmap for each polygon but rather some big lightmaps and each lightmap serves several polygons.
0

Share this post


Link to post
Share on other sites
i want to use a 512*512*4(RGBA) lightmap

i can make 256 tiles out of it and give all completely black polygons the same lightmap but that still needs a lot of memory

0

Share this post


Link to post
Share on other sites
Why do you want an alpha channel in the lightmap?

You could try using 16bit colour if it really is too big.

You must determine the lightmap size from the size of the polygon. Lightmaps only look good if they all have the same scale (ignoring ''detail'' lightmaps), which means a large polygon needs a larger lightmap.
0

Share this post


Link to post
Share on other sites

instead you could make a nice large enough image with the lightmaps packed tight and export the necessary texture coordinates to go with it.
0

Share this post


Link to post
Share on other sites
BTW - do all good 3D engines based on OpenGL use lightmaps or can good enough effects be achieved with OGL lighting?
0

Share this post


Link to post
Share on other sites
well as far as í know there is no really fast method to do realtime shadows on environments with more than 50000 polys visible



what i am doing now is i generate a 32*32*4 lightmap for every polygon
and then i merge several lightmaps which like very similar

eg:
lightmap 1 has

244
245
237

lightmap 2

238
237
244

and merge it to
241
242
240


or i don t apply lightmaps when the enviroment light stands perpendicular to the surface of a polygon or when the angle is <5°

that should reduce quite a few lightmaps

another thing i thought about is using OGL lights with the light colorsettings and only apply a luminance texture
0

Share this post


Link to post
Share on other sites
Sorry for the shameless plug (again ), but I just had to post this, when I read the last post

"[Basiror] well as far as í know there is no really fast method to do realtime shadows on environments with more than 50000 polys visible"

Approx. 290000 polys visible, 67 fps on a GF4. Not a single lightmap used. 100% dynamic perpixel lighting with shadowmaps:


Never underestimate the power of modern perpixel lighting. You should consider using PP lighting instead of lightmapping, it can be a real alternative on newer hardware.

/ Yann

[edited by - Yann L on January 9, 2003 6:40:42 PM]
0

Share this post


Link to post
Share on other sites
Yann, I hate you.

karg

ps. how''s the game going? any expected release dates?
0

Share this post


Link to post
Share on other sites
Couldnt you store lightmaps as grayscale, 8 bit, and store a hue/saturaton value for color? It might not be completely accurate, but you would shve 75% off the data...
0

Share this post


Link to post
Share on other sites
Hi Yann,

whats the difference between a lightmap and a shadowmap?
Beside this, I plan do compute the lightning for my indoor racing game through radiosity. Will the result of the radiosity calculations then be more lightmap-like or shadowmap-like?

0

Share this post


Link to post
Share on other sites
quote:

whats the difference between a lightmap and a shadowmap?


A lightmap is a (typically pre-calculated) texture map that contains the intensity values produced by a specific lightsource on specific geometry. The intensity values encode any possible shadow-effects, or even colour bleeding, in the case of radiosity.

Shadowmaps, OTOH, do not contain the actual light values. They contain a depth-buffer from the viewpoint of the light. The textures themselves do not store RGB values, but depth values. They are computed in realtime, for each lightsource, using render-textures (p-buffers). Directional lights and spot-lights need a 2D texture, while pointlights use a cubemap texture. When rendering your scene, a special kind of depth compare operation (supported on GF3+) is done on the shadowmap's depth value and an interpolated component. The result is a realtime per-pixel shadow information, that can be used in a subsequent pixelshader.

More informations about shadowmaps can be found here. (and a few more papers on the nVidia developer site).

quote:

Beside this, I plan do compute the lightning for my indoor racing game through radiosity. Will the result of the radiosity calculations then be more lightmap-like or shadowmap-like?


Radiosity is precomputed, and therefore its solution is stored in lightmaps. You cannot (yet) compute radiosity in realtime. But ofcourse, the visual results of radiosity are excellent, so it might be worth using lightmaps for this purpose. Although you can combine lightmaps for the overall lighting, and shadowmaps for the effect of local dynamic lightsources.

quote:

ps. how's the game going? any expected release dates?


Not yet. The shot above is from a public demo level, that isn't yet public because of .. hmm.. incompetent management people... nuff' said. Isn't so easy, if you develop a large game with a small team in a gamedev startup, while privately financing the development.

/ Yann

[edited by - Yann L on January 9, 2003 7:38:05 PM]
0

Share this post


Link to post
Share on other sites
wow that looks awesome

i read the article but sadly i only have a gf2 ultra i want to buy a new system with these FX cards in around 6 months

so is there a way to do it on GF2 ultra cards as well or do i have to wait ?
0

Share this post


Link to post
Share on other sites
>>Holy shit! Yann! How did you pull those frame rates off? That''s incredible. <<

shadowmaps aint really affected much unlike say stencil shadows but the scenes polygon count, BUT theyre not to good for positional lights + aint supported on a lot of hardware

>>so is there a way to do it on GF2 ultra cards as well or do i have to wait ?<<

arb_shadow is part of opengl1.4 ive done it on a gf2mx (but its very very slow <0.1fps) as its done in software.
there is another method that does work on the gf2 (its what i used in the screenshots below of KEA) but its limited to 8bits resolution (there r ways around this though) + its slower than arb_shadow (on cards that support arb_shadow that is)
check shadowmaping at the nvidia developer site

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
0

Share this post


Link to post
Share on other sites