View Full Version : Lightmaps :-(
09-05-2002, 02:50 AM
My ROAM engine works fast, but I can't fix problem with lightmaps. My terrain is splitted to 32x32 patches. Every patch has its own lightmap. I load lightmaps with GL_CLAMP and GL_LINEAR. Edges of patches don't fit - i.e. it is possible to see where are edges. I am sure I calculate texture coordinates correctly. Problem is with GL_LINEAR. When I switch to GL_NEAREST - everything is OK.
So I've read archives, and found this page: http://www.apgardner.karoo.net/gl/lightmap.html
So... I should get 34x34 lightmap, scale it to 32x32, use as texture, and draw only 30x30 ???
First problem is scaling. When I scale 34x34 to 32x32 I will get heavy quality loss. Second problem are calculations. 30x30 will not be exactly that part which was previous 32x32.
Anyway - could you give me _any_ working examples of lightmaps in OpenGL?
09-05-2002, 03:16 AM
GL_CLAMP_TO_EDGE was designed to solve this problem, but drivers don't always implement it correctly. Give it a try though.
(Edit) Look at this post: http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/007306.html
[This message has been edited by Don't Disturb (edited 09-05-2002).]
09-05-2002, 03:31 AM
"GL_CLAMP_TO_EDGE was designed to solve this problem, but drivers don't always implement it correctly. Give it a try though."
Didn't help. Probably this mode is node used in tdfx driver in Linux.
Do you have any other ideas? I thought lightmaps are commonly used. Quake3 and RTCW works well on my system, how they are coded?
09-05-2002, 12:57 PM
Are you packing many lightmaps in the same texture? If so, GL_LINEAR will fetch texels from the neightbour lightmap at edges. To solve that you'll have to pad the lightmaps, that is, turning your say 30x30 lightmaps into 32x32 by adding a 1 pixel frame and copy the edge colors into the frame.
clamp to edge wont help
say u have to textures that are on 2 polygons next to each other
now if u create the first texture with just the A's (second with the B's) u will experierence the problem u see now.
what u need to do is instead of creating the original textures at 128x128 create them at 126x126 then to fill in the border with the neighbouring pixels. i do this often it is a hassle to write but them are the breaks
FWIW i dont think quake + their ilk does it (what they do is try and pack as many textures into a large texture as possible)
textureborders are another option but most harwdare does not support them (gf2 doesnt)
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.