diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-21 20:35:12 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-21 20:43:41 +0300 |
commit | 9ba84342fb6835dd3add1f12c698654d3d79a90e (patch) | |
tree | f938172ec0924d85a9c39a471dc5520aac80a6d6 /intern/cycles | |
parent | fa5aa18fdddc101b9ddb71971ee76bffea71b853 (diff) |
Fix point density rendering in Cycles.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 20 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.h | 1 | ||||
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 1 |
3 files changed, 13 insertions, 9 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 95582b15d63..e6aabb5fe36 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -57,6 +57,7 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine, b_userpref(b_userpref), b_data(b_data), b_render(b_engine.render()), + b_depsgraph(PointerRNA_NULL), b_scene(b_scene), b_v3d(PointerRNA_NULL), b_rv3d(PointerRNA_NULL), @@ -84,6 +85,7 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine, b_userpref(b_userpref), b_data(b_data), b_render(b_scene.render()), + b_depsgraph(PointerRNA_NULL), b_scene(b_scene), b_v3d(b_v3d), b_rv3d(b_rv3d), @@ -357,8 +359,10 @@ void BlenderSession::update_render_tile(RenderTile& rtile, bool highlight) do_write_update_render_tile(rtile, false, false); } -void BlenderSession::render(BL::Depsgraph& b_depsgraph) +void BlenderSession::render(BL::Depsgraph& b_depsgraph_) { + b_depsgraph = b_depsgraph_; + /* set callback to write out render results */ session->write_render_tile_cb = function_bind(&BlenderSession::write_render_tile, this, _1); session->update_render_tile_cb = function_bind(&BlenderSession::update_render_tile, this, _1, _2); @@ -539,7 +543,7 @@ static int bake_pass_filter_get(const int pass_filter) return flag; } -void BlenderSession::bake(BL::Depsgraph& b_depsgraph, +void BlenderSession::bake(BL::Depsgraph& b_depsgraph_, BL::Object& b_object, const string& pass_type, const int pass_filter, @@ -549,6 +553,8 @@ void BlenderSession::bake(BL::Depsgraph& b_depsgraph, const int /*depth*/, float result[]) { + b_depsgraph = b_depsgraph_; + ShaderEvalType shader_type = get_shader_type(pass_type); /* Set baking flag in advance, so kernel loading can check if we need @@ -719,7 +725,7 @@ void BlenderSession::update_render_result(BL::RenderResult& b_rr, do_write_update_render_result(b_rr, b_rlay, rtile, true); } -void BlenderSession::synchronize(BL::Depsgraph& b_depsgraph) +void BlenderSession::synchronize(BL::Depsgraph& b_depsgraph_) { /* only used for viewport render */ if(!b_v3d) @@ -760,6 +766,8 @@ void BlenderSession::synchronize(BL::Depsgraph& b_depsgraph) } /* data and camera synchronize */ + b_depsgraph = b_depsgraph_; + BL::Object b_camera_override(b_engine.camera_override()); sync->sync_data(b_render, b_depsgraph, @@ -1280,8 +1288,6 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n"); } else { - /* TODO: fix point density to work with new view layer depsgraph */ -#if 0 /* We originally were passing view_layer here but in reality we need a * a depsgraph to pass to the RE_point_density_minmax() function. */ @@ -1292,10 +1298,8 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) { BL::ShaderNodeTexPointDensity b_point_density_node(b_node); int length; - int settings = background ? 1 : 0; /* 1 - render settings, 0 - vewport settings. */ - b_point_density_node.calc_point_density(b_depsgraph, settings, &length, &pixels); + b_point_density_node.calc_point_density(b_depsgraph, &length, &pixels); } -#endif } return false; diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h index 77a64031da1..030b542d0dd 100644 --- a/intern/cycles/blender/blender_session.h +++ b/intern/cycles/blender/blender_session.h @@ -106,6 +106,7 @@ public: BL::UserPreferences b_userpref; BL::BlendData b_data; BL::RenderSettings b_render; + BL::Depsgraph b_depsgraph; BL::Scene b_scene; BL::SpaceView3D b_v3d; BL::RegionView3D b_rv3d; diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 21137562152..ddf18e9f3c7 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -834,7 +834,6 @@ static ShaderNode *add_node(Scene *scene, node = uvm; } else if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) { - /* TODO: fix point density to work with new view layer depsgraph */ BL::ShaderNodeTexPointDensity b_point_density_node(b_node); PointDensityTextureNode *point_density = new PointDensityTextureNode(); point_density->filename = b_point_density_node.name(); |