diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2016-04-18 23:35:49 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-04-18 23:47:24 +0300 |
commit | 3068ea34e414e7af6d20af7ab92c69cbd9a33414 (patch) | |
tree | e820479e09c3959219a16e8346c766be3d61f22d /intern/cycles/blender/blender_mesh.cpp | |
parent | 71588300d233f795fcf9b0b55ce397b9b81614ff (diff) |
Cycles microdisplacement: add max subdivision setting
This is to prevent situations such as when the camera gets very close to a mesh
and causes it to be tessellated into an excessive amount of micropolygons. In
REYES this is known as the eye-splits problem.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D1922
Diffstat (limited to 'intern/cycles/blender/blender_mesh.cpp')
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index ba0ba7892e8..09e27c2282d 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -661,13 +661,15 @@ static void create_subd_mesh(Scene *scene, BL::Mesh& b_mesh, PointerRNA *cmesh, const vector<uint>& used_shaders, - float dicing_rate) + float dicing_rate, + int max_subdivisions) { Mesh basemesh; create_mesh(scene, &basemesh, b_mesh, used_shaders); SubdParams sdparams(mesh, used_shaders[0], true, false); sdparams.dicing_rate = max(0.1f, RNA_float_get(cmesh, "dicing_rate") * dicing_rate); + sdparams.max_level = max_subdivisions; scene->camera->update(); sdparams.camera = scene->camera; @@ -784,7 +786,8 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob, if(b_mesh) { if(render_layer.use_surfaces && !hide_tris) { if(cmesh.data && experimental && RNA_enum_get(&cmesh, "subdivision_type")) - create_subd_mesh(scene, mesh, b_ob, b_mesh, &cmesh, used_shaders, dicing_rate); + create_subd_mesh(scene, mesh, b_ob, b_mesh, &cmesh, used_shaders, + dicing_rate, max_subdivisions); else create_mesh(scene, mesh, b_mesh, used_shaders); |