Jump to content
  • Advertisement
Sign in to follow this  
desudesu

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

This topic is 3811 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!