Surface Normals OpenGL -
so, working on opengl es 2.0 terrain rendering program still. have weird drawing happening @ tops of ridges. guessing due surface normals not being applied.
so, have calculated normals. know in other versions of opengl can activate normal array , used culling. use normals in opengl es can activate normals or have use lighting algorithm within shader?
thanks
opengl doesn't use normals culling. culls based on whether projected triangle has vertices arranged clockwise or anticlockwise. specific decision based on (i) way around said considered front-facing via glfrontface
; (ii) of front-facing and/or back-facing triangles asked culled via glcullface
; , (iii) whether culling enabled @ via glenable
/gldisable
.
culling identical in both es 1.x , 2.x. it's fixed hardware feature. it's external programmable pipeline (and, indeed, hard reproduce within es 2.x programmable pipeline because there's no shader per-triangle oversight).
if don't have culling enabled more see depth-buffer fighting @ ridges face camera , face front camera have similar depths close ridge , limited precision can make them impossible distinguish correctly.
lighting in es 1.x calculated normals. per-vertex lighting can produce weird problems @ hard ridges because normals @ vertices average of @ faces join @ vertex, e.g. fixed mesh shaped \/\/\/\/\
ends same normal @ every vertex. if you're not using 1.x won't what's happening.
to implement lighting in es 2.x need within shader. result of that, , of normals not being used other purpose, there no formal way specify normals special. they're vertex attribute , can them wish.
Comments
Post a Comment