Archived

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

Mulligan

Another lightmap question

Recommended Posts

Mulligan    378
If I have a lightmap on every triangle in my scene, and I have all my vertex/color/coordinate information stored in vertex arrays, Do i have to call glDrawArrays for every single triangle because my lightmaps are all unique? That ruins the fact that glDrawArrays makes things faster, because now its no faster than using glVerted3f. This is making me mad.

Share this post


Link to post
Share on other sites
CRACK123    235
Hi,

From what I remember I don''t think you need to call glDrawArrays for every single triangle, you need to call glDrawArrays for an array with information about a lot of triangle vertices. To do lightmapping and if you are using multitexturing then I think you need to use glClientActiveTextureARB ->

http://www.xfree86.org/4.2.0/glClientActiveTextureARB.3.html

Hope this helps.

Share this post


Link to post
Share on other sites
Basiror    241
a gf4 supports textures of 4096*4096

so you should combine as many lightmaps into one big texture thus switching textures should be reduced

Share this post


Link to post
Share on other sites
Basiror    241
another speed up is creating such a large texture for all lightmaps of faces which use the same texture in texunit 0

so you can change the lightmap and texunit 0 at once

and after you have done this and there s still room left in your large lightmap
check if there are more faces with different texunit 0 that can be added to your lightmap
and then sort your faces accordingly

Share this post


Link to post
Share on other sites
Basiror    241
i wonder whether i should add lightmap support too

the problem is
i have high polygonal scenes
so i can only use luminance maps 4096*4096*1(BYTE)
RGB maps would blow my video memory(128mb though)

what resolution do your lightmaps have?

Share this post


Link to post
Share on other sites
Mulligan    378
Most of mine are 8x8, which seemed at first to be way too small, but in practice I found gave amazing results. Anything larger seemed to be overkill. My Voodoo 3 supports 256x256 textures, which allows me 2048 individual tringular lightmaps, unless I''m overlooking something.

Share this post


Link to post
Share on other sites
Basiror    241
which method
?

i am using per pixel lightning with vertex normals

i am planing to implement shadowmaps in the near future though

4096*4096 texes take 16 mb memory if you use them as luminance textures

i guess 16*16 should be enough sind 16*16 pixels are quite a lot

apply some antialiasing and you should get smoother borders between lit and unlit pixels

Share this post


Link to post
Share on other sites