Sign in to follow this  

[SOLVED] Invalid (inverted) normals read from BSP.

This topic is 3592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I'm loading a Half Life 1 BSP file and I'm trying to render it. Everything is OK except that some faces have their normals inverted, so the lighting doesn't show up from the proper side. I made a hack by inverting the normal in my GLSL shader if the pixel is not lit and calculating the result again, so it does work properly, but I'm not sure if this is The Right Thing to do. Now, I want to ask - isn't there a better way to do it? I don't really want to make hacks like this in my shaders, if I have to then I would prefer to make one in my C++ code. [Edited by - desudesu on February 14, 2008 6:49:59 PM]

Share this post


Link to post
Share on other sites
I didn't know that HL1 had support for lighting. Isn't it just lightmaps?
You shouldn't need hacks. Probably you aren't computing the normals properly.

Share this post


Link to post
Share on other sites
Quote:
Original post by V-man
I didn't know that HL1 had support for lighting. Isn't it just lightmaps?
You shouldn't need hacks. Probably you aren't computing the normals properly.


It hadn't. I just want to add some dynamic lighting to these maps myself, so I'm not using included lightmaps. And no - I'm not computing normals myself, they are already in the BSP.

Share this post


Link to post
Share on other sites
It's been a while since I worked with HL1 BSPs, but aren't they made up of 'polygons', not triangles?
IIRC, there might be a flag that indicates the winding order of the polygon - so if this flag is set, then all the normals for that poly are going to be "inverted".

Are you rendering the polies as GL polygons, or are you pre-processing them into triangles before sending them to GL?

Share this post


Link to post
Share on other sites
Quote:
Original post by Hodgman
It's been a while since I worked with HL1 BSPs, but aren't they made up of 'polygons', not triangles?
IIRC, there might be a flag that indicates the winding order of the polygon - so if this flag is set, then all the normals for that poly are going to be "inverted".

Are you rendering the polies as GL polygons, or are you pre-processing them into triangles before sending them to GL?


Hey, you are right - there is a flag, and it works as advertised now! =) Silly me that I didn't look there earlier. Thanks!

Share this post


Link to post
Share on other sites

This topic is 3592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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