Original Post
Hey guys,
I am having trouble calculating texture coordinates for lightmaps in Half Life 2 (Source) bsp files. So far what i have is
This manages to get the lightmaps to the correct scale as far as i can see but their offsets are wrong and they are in the wrong position. I have tried endless combinations of things and looked everywhere for the solution but the closest i could find was for quake 2 bsp lightmaps and that didn't work for these. Any help is appreciated. Thanks
I am having trouble calculating texture coordinates for lightmaps in Half Life 2 (Source) bsp files. So far what i have is
float lu = TextureInfo[Faces[faceId].texinfo].lightVecsU.dotProduct(Vertexes[vertexIndice]) + TextureInfo[Faces[faceId].texinfo].lightOffsetU; float lv = TextureInfo[Faces[faceId].texinfo].lightVecsV.dotProduct(Vertexes[vertexIndice]) + TextureInfo[Faces[faceId].texinfo].lightOffsetV;lu /= (Faces[faceId].LightmapTextureSizeInLuxels[0]+1);lv /= (Faces[faceId].LightmapTextureSizeInLuxels[1]+1);This manages to get the lightmaps to the correct scale as far as i can see but their offsets are wrong and they are in the wrong position. I have tried endless combinations of things and looked everywhere for the solution but the closest i could find was for quake 2 bsp lightmaps and that didn't work for these. Any help is appreciated. Thanks