diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/geom/geom_volume.h | 2 | ||||
-rw-r--r-- | intern/cycles/render/mesh_volume.cpp | 46 |
2 files changed, 4 insertions, 44 deletions
diff --git a/intern/cycles/kernel/geom/geom_volume.h b/intern/cycles/kernel/geom/geom_volume.h index a4e47384b25..346f228e961 100644 --- a/intern/cycles/kernel/geom/geom_volume.h +++ b/intern/cycles/kernel/geom/geom_volume.h @@ -68,7 +68,7 @@ ccl_device float3 volume_attribute_float3(KernelGlobals *kg, const ShaderData *s if(dx) *dx = make_float3(0.0f, 0.0f, 0.0f); if(dy) *dy = make_float3(0.0f, 0.0f, 0.0f); - if(r.w > 1e-8f && r.w != 1.0f) { + if(r.w > 1e-6f && r.w != 1.0f) { /* For RGBA colors, unpremultiply after interpolation. */ return float4_to_float3(r) / r.w; } diff --git a/intern/cycles/render/mesh_volume.cpp b/intern/cycles/render/mesh_volume.cpp index 3571beb40d6..d1c49b456ff 100644 --- a/intern/cycles/render/mesh_volume.cpp +++ b/intern/cycles/render/mesh_volume.cpp @@ -495,54 +495,14 @@ void MeshManager::create_volume_mesh(Scene *scene, for(size_t i = 0; i < voxel_grids.size(); ++i) { const VoxelAttributeGrid &voxel_grid = voxel_grids[i]; + const int channels = voxel_grid.channels; - if(voxel_grid.channels == 1) { - if(voxel_grid.data[voxel_index] >= isovalue) { + for(int c = 0; c < channels; c++) { + if(voxel_grid.data[voxel_index * channels + c] >= isovalue) { builder.add_node_with_padding(x, y, z); break; } } - else if(voxel_grid.channels == 3) { - voxel_index = compute_voxel_index(resolution, x*3, y, z); - - if(voxel_grid.data[voxel_index] >= isovalue) { - builder.add_node_with_padding(x, y, z); - break; - } - - if(voxel_grid.data[voxel_index + 1] >= isovalue) { - builder.add_node_with_padding(x, y, z); - break; - } - - if(voxel_grid.data[voxel_index + 2] >= isovalue) { - builder.add_node_with_padding(x, y, z); - break; - } - } - else if(voxel_grid.channels == 4) { - voxel_index = compute_voxel_index(resolution, x*4, y, z); - - /* check alpha first */ - if(voxel_grid.data[voxel_index + 3] < isovalue) { - continue; - } - - if(voxel_grid.data[voxel_index] >= isovalue) { - builder.add_node_with_padding(x, y, z); - continue; - } - - if(voxel_grid.data[voxel_index + 1] >= isovalue) { - builder.add_node_with_padding(x, y, z); - continue; - } - - if(voxel_grid.data[voxel_index + 2] >= isovalue) { - builder.add_node_with_padding(x, y, z); - continue; - } - } } } } |