Lightmaps from Half-Life BSP's

Started by
0 comments, last by daedalusd 23 years, 10 months ago
Hey all, Im writing a 3D engine, based around the BSP format used in half life. Everything works great, all the geometry works, all textures imported and aligned, all mip levels working, and im running around all the half-life levels no problem =). Now i''ve come to a COMPLETE halt when attempting to create lightmaps using the information stored in the BSP file itself. According to the DOCS, the lightmap data is stored in a 24bit RGB format. This is fine, i can read it all, however i cannot work out the width and height of each lightmap from the data which is provided. I read over the Quake 2 BSP file tutorial on flipcode where it says lightmap_width = ceil(max_u / 16) - floor(min_u / 16) + 1 lightmap_height = ceil(max_v / 16) - floor(min_v / 16) + 1 I''ve implemented this, in the exact way outlined in that document, but all the lightmaps just come out completely screwed. As the amount of data which is read from the lightmap lump for each face is DIRECTLY lined to the width and height returned, all the problems stem from calculation of the width and height. I can tell somethings wrong when some of my Width and heights are in the 100''s =) wheras it should be a max of 16x16 (after QBSP2 creates the level) Can anyone help me out here ?? Has anyone played with the lightmap data from BSP files before ?? I really want to use the Lightmap data which is provided, rather than recalculate it all myself. I''ve looked over the source for TWISTER (Quake II Clone) but it isn''t any use in this case. Im using DX7 btw. Thanks in advance for ANY help anyone can give. Adam
Advertisement
Ok, anyone have a site which could help me, if nobody knows.

Thanks

Adam

This topic is closed to new replies.

Advertisement