Skip to main content
gamedev.net
🔒 Locked

Clumsy lighting

Started by Windfall 5 replies 1.2k views
Original Post
Windfall
Windfall
Hi, I had to write two similiar programs in openGL and DirectX. In openGL lights are very 'quadratic'. Here is the screenshot: openGL while in directX are ok - it's the same object loaded: openGL What can cause the problem ? Many thanks Bartek
Ezbez
Ezbez
OpenGL does, by defualt, Per-Vertex lighting. I have no experience with DirectX, but it appears that DirectX does per-pixel lighting. If you want to do per-vertex lighting in OpenGL, you're going to have to write a shader for it.
acid2
acid2
Quote:
Original post by Ezbez
OpenGL does, by defualt, Per-Vertex lighting. I have no experience with DirectX, but it appears that DirectX does per-pixel lighting. If you want to do per-vertex lighting in OpenGL, you're going to have to write a shader for it.


Nope, DX does per vertex. Looks to me a problem with your normals, do you know what they are?
deavik
deavik
It looks like the normals aren't unit length to me. To check, put a glEnable(GL_NORMALIZE); somewhere in the init code and see if it works.
Windfall
Windfall
Hi, unfortunetly it doesn't work :( I know that normals are normalized, even if I enter glEnable(GL_NORMALIZE) it looks the same. I am wondering if I shouldn't set something for device, but have no idea what.

Windfall
Windfall
Yes! Looks far more better:

openGL

There is some roughness in lighting during rotations, can I use it also for back faces ?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.