Original Post
aaaaargh... i can't seem to fix it: http://home.hccnet.nl/pj.holverda/vaag.JPG my first version of the lightmap generator, stored all lightmaps in individual lightmaps ( one for each polygon ) But after reading about the expensive calls of texture binding i've decided to store them into one( 512*512 pixels in my case ) larger lightmap image. This all worked well. But the lightmap bleeding still occurs even though my u, v ( or S, T ) coordinates never exceeded the [0....1] bounds, i even tested them and it don't seem to happen. What could be the cause of this, ain't I'm calculating my S,T coordinates correctly( which seems to be odd, since the shadows on the geometry appears correctly ) or is it another problem since i basically stretch the lightmaps across the polygon( lightmaps on a abitrary surface can be adjusted, from 2 World-Units a lumel to 128 World Units a Lumel ) so anyone can help me out here This is my Lightmap code (JAVA )(clamping is not necessary): public void lightmapCoordinates( LightmapRectangle rect, BSPFace face ) { float s, t, s_offset, t_offset, new_s, new_t; float lightmapDimension = (float) Config.LIGHTMAP_DIMENSION; //loop through vertices, adjust their s,t coordinates for ( int i = 0; i < face.getNumberVertices(); i++ ) { s = face.getVertices().getS(); t = face.getVertices().getT(); if( s < 0.0f) { s = 0.0f; } else if( s > 1.0f ) { s = 1.0f; } if( t < 0.0f ) { t = 0.0f; } else if( t > 1.0f ) { t = 1.0f ; } s_offset = rect.getLeft() + s * rect.getWidth(); t_offset = rect.getTop() + t * rect.getHeight(); //todo speed up (use bit-shift since dimension are power of 2) new_s = s_offset / lightmapDimension; new_t = t_offset / lightmapDimension; face.getVertices().setLightmapCoordinates(new_s, new_t); } } Cheers, Paul