[Bf-blender-cvs] [5cf519a] master: OpenSubdiv: Better approximation of vertex normals

Sergey Sharybin noreply at git.blender.org
Tue Aug 25 13:19:22 CEST 2015


Commit: 5cf519ac51b07d4322d811925ffad7a015e400a7
Author: Sergey Sharybin
Date:   Tue Aug 25 12:40:50 2015 +0200
Branches: master
https://developer.blender.org/rB5cf519ac51b07d4322d811925ffad7a015e400a7

OpenSubdiv: Better approximation of vertex normals

Use vertex varying data which gives better approximation of normals.
Still not ideal but should be closer for higher poly meshes to correct
normal.

The only way to have proper smooth normals seems to be to implement
patch evaluation in tessellation shader, but that's a bit PITA with
current GLSL usage in our draw code.

===================================================================

M	intern/opensubdiv/opensubdiv_capi.cc

===================================================================

diff --git a/intern/opensubdiv/opensubdiv_capi.cc b/intern/opensubdiv/opensubdiv_capi.cc
index e3bc589..23146fc 100644
--- a/intern/opensubdiv/opensubdiv_capi.cc
+++ b/intern/opensubdiv/opensubdiv_capi.cc
@@ -156,14 +156,14 @@ struct OpenSubdiv_GLMesh *openSubdiv_createOsdGLMeshFromTopologyRefiner(
 	 */
 	bits.set(OpenSubdiv::Osd::MeshAdaptive, 0);
 	bits.set(OpenSubdiv::Osd::MeshUseSingleCreasePatch, 0);
-	bits.set(OpenSubdiv::Osd::MeshInterleaveVarying, 0);
+	bits.set(OpenSubdiv::Osd::MeshInterleaveVarying, 1);
 	bits.set(OpenSubdiv::Osd::MeshFVarData, 1);
 	bits.set(OpenSubdiv::Osd::MeshEndCapBSplineBasis, 1);
 	// bits.set(Osd::MeshEndCapGregoryBasis, 1);
 	// bits.set(Osd::MeshEndCapLegacyGregory, 1);
 
-	const int num_vertex_elements = 6;
-	const int num_varying_elements = 0;
+	const int num_vertex_elements = 3;
+	const int num_varying_elements = 3;
 
 	GLMeshInterface *mesh = NULL;
 	TopologyRefiner *refiner = (TopologyRefiner*)topology_refiner;




More information about the Bf-blender-cvs mailing list