Techniques to smooth face edges in OpenGL

冷暖自知 提交于 2020-01-13 06:24:08

问题


When I light my human model in OpenGL using face normals it is very apparent where each face is on the model. The lighting becomes considerably smoother using vertex normals but still noticeable. Is there any technique available to smooth organic models without adding additional vertices (ex. subdivisions)?


回答1:


If you are seeing single faces with per vertex normals you might have forgotten to enable smooth facing:

glShadeModel(GL_SMOOTH);

If that's not helping make sure all vertices with the same position also have the same normal. This should be done by blender automatically however. It's also possible that your model has just too few polygons. If that's the case you either have to use more polygons or do what basszero said. Create a normal map and use that together with a GLSL shader.




回答2:


If you've got access to a higher resolution model/mesh or perhaps a decent 3d modeling tool that can create a highres model via subdivisions or other fancy methods...

GLSL per-pixel-lighting + normal maps

UPDATE:

http://www.blender.org/development/release-logs/blender-246/render-baking/




回答3:


Yes there are many different techniques. One is to first calculate a normal for each face (which you probably are using for the vertices in the face) and use these normals to calculate new normals for each vertex.

Here's one where you calculate the average of five adjacent triangles.

Cheers !



来源:https://stackoverflow.com/questions/954039/techniques-to-smooth-face-edges-in-opengl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!