diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-12-29 18:40:43 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-07 18:03:41 +0400 |
commit | 01df756bd10709bb707d4f88f14c50e5680d05a5 (patch) | |
tree | 62d1374ada6e9c62bae736a7e0e62a6cb2c0a14d /intern/cycles/render | |
parent | b174e7b0b89d0e03a20a11f4a754029689af56a9 (diff) |
Cycles Volume Render: scattering support.
This is done by adding a Volume Scatter node. In many cases you will want to
add together a Volume Absorption and Volume Scatter node with the same color
and density to get the expected results.
This should work with branched path tracing, mixing closures, overlapping
volumes, etc. However there's still various optimizations needed for sampling.
The main missing thing from the volume branch is the equiangular sampling for
homogeneous volumes.
The heterogeneous scattering code was arranged such that we can use a single
stratified random number for distance sampling, which gives less noise than
pseudo random numbers for each step. For volumes where the color is textured
there still seems to be something off, needs to be investigated.
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/integrator.cpp | 11 | ||||
-rw-r--r-- | intern/cycles/render/integrator.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp index ed8883c52f7..1042a5c4102 100644 --- a/intern/cycles/render/integrator.cpp +++ b/intern/cycles/render/integrator.cpp @@ -33,6 +33,7 @@ Integrator::Integrator() max_diffuse_bounce = max_bounce; max_glossy_bounce = max_bounce; max_transmission_bounce = max_bounce; + max_volume_bounce = max_bounce; probalistic_termination = true; transparent_min_bounce = min_bounce; @@ -57,6 +58,7 @@ Integrator::Integrator() ao_samples = 1; mesh_light_samples = 1; subsurface_samples = 1; + volume_samples = 1; method = PATH; sampling_pattern = SAMPLING_PATTERN_SOBOL; @@ -88,6 +90,11 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene kintegrator->max_glossy_bounce = max_glossy_bounce + 1; kintegrator->max_transmission_bounce = max_transmission_bounce + 1; + if(kintegrator->use_volumes) + kintegrator->max_volume_bounce = max_volume_bounce + 1; + else + kintegrator->max_volume_bounce = 1; + kintegrator->transparent_max_bounce = transparent_max_bounce + 1; if(transparent_probalistic) kintegrator->transparent_min_bounce = transparent_min_bounce + 1; @@ -118,6 +125,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene kintegrator->ao_samples = ao_samples; kintegrator->mesh_light_samples = mesh_light_samples; kintegrator->subsurface_samples = subsurface_samples; + kintegrator->volume_samples = volume_samples; kintegrator->sampling_pattern = sampling_pattern; @@ -130,6 +138,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene max_samples = max(max_samples, max(diffuse_samples, max(glossy_samples, transmission_samples))); max_samples = max(max_samples, max(ao_samples, max(mesh_light_samples, subsurface_samples))); + max_samples = max(max_samples, volume_samples); } max_samples *= (max_bounce + transparent_max_bounce + 3); @@ -159,6 +168,7 @@ bool Integrator::modified(const Integrator& integrator) max_diffuse_bounce == integrator.max_diffuse_bounce && max_glossy_bounce == integrator.max_glossy_bounce && max_transmission_bounce == integrator.max_transmission_bounce && + max_volume_bounce == integrator.max_volume_bounce && probalistic_termination == integrator.probalistic_termination && transparent_min_bounce == integrator.transparent_min_bounce && transparent_max_bounce == integrator.transparent_max_bounce && @@ -179,6 +189,7 @@ bool Integrator::modified(const Integrator& integrator) ao_samples == integrator.ao_samples && mesh_light_samples == integrator.mesh_light_samples && subsurface_samples == integrator.subsurface_samples && + volume_samples == integrator.volume_samples && motion_blur == integrator.motion_blur && sampling_pattern == integrator.sampling_pattern); } diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h index d9e49d5906e..cc4a28a4e54 100644 --- a/intern/cycles/render/integrator.h +++ b/intern/cycles/render/integrator.h @@ -33,6 +33,7 @@ public: int max_diffuse_bounce; int max_glossy_bounce; int max_transmission_bounce; + int max_volume_bounce; bool probalistic_termination; int transparent_min_bounce; @@ -59,6 +60,7 @@ public: int ao_samples; int mesh_light_samples; int subsurface_samples; + int volume_samples; enum Method { BRANCHED_PATH = 0, |