Sign in to follow this  
Kada2k6

Simple lightmap headaches

Recommended Posts

Might be a matter of render order. However, I guess there's no correct order since one light would "cut off" the other in either order.

You could try additive blending, i.e. using GL_ONE one both the source and the destination.

Share this post


Link to post
Share on other sites
Hidden
I tried switching to additive blending (GL_ONE for both), but it made no difference. Here is a screenshot. As you can see the the lightmap drawn above another lightmap blocks the one below it. I just can't understand why? Aren't they supposed to blend?

Share this post


Link to post
Try this for additive blending: glBlendFunc( GL_SRC_ALPHA, GL_ONE );

Is your texture an RGBA?

Are you using shaders by any chance?

Can you post a screen shot from the same vantage point of the 3rd, using the above blending function?

Share this post


Link to post
Share on other sites
Hidden
The first two screenshots I posted is when using glBlendFunc(GL_SRC_ALPHA, GL_ONE)... That's why I came here asking for help :)

No, the texture is a 24 bit BMP.

No shaders.

Share this post


Link to post
Well, you need a source alpha channel, 32 bit, to use glBlendFunc( GL_SRC_ALPHA, GL_ONE );

It's nearly impossible to see anything in your first two screen shots.

Share this post


Link to post
Share on other sites
based on that ONE ONE screenshot, the bledning is not the problem,
it looks like a depth issue
use glDisable( GL_DEPTH_TEST ) with GL_ONE GL_ONE + it should work (it will not be correct though cause i assume u want to have depth in the scene, but it will show u that u were looking at the wrong cause)

Share this post


Link to post
Share on other sites
Hidden
Yupp, when disabling depth testing it works like a charm! Only problem now is that light that shouldn't be visible starts coming out from under roofs, etc. Would I have to do some manual depth testing or culling in order to get this right? It seems like a lot of hassle for such a simple effect, really.

Share this post


Link to post
if youve got it all setup correctly, it should just work
are u using glDepthFunc( GL_LEQUAL )

is the ground flat ie are all the dots on the same level plane, if so LEQUAL should work, u could perhaps try glDepthMask( GL_FALSE ) but thats not ideal

Share this post


Link to post
Share on other sites
Hidden
Hey! That solved it! I did:

glDepthMask(GL_FALSE) ...

... before drawing the lightmaps. And then enabling it again directly afterwards. And now the lightmaps are drawn correctly, with no borders or artifacts.

Thanks a lot! :)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this