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/kernel/closure/volume.h | |
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/kernel/closure/volume.h')
-rw-r--r-- | intern/cycles/kernel/closure/volume.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/intern/cycles/kernel/closure/volume.h b/intern/cycles/kernel/closure/volume.h index 951a03bce71..058c4b8408f 100644 --- a/intern/cycles/kernel/closure/volume.h +++ b/intern/cycles/kernel/closure/volume.h @@ -39,7 +39,7 @@ ccl_device int volume_henyey_greenstein_setup(ShaderClosure *sc) /* clamp anisotropy to avoid delta function */ sc->data0 = signf(sc->data0) * min(fabsf(sc->data0), 1.0f - 1e-3f); - return SD_BSDF|SD_BSDF_HAS_EVAL|SD_SCATTER; + return SD_SCATTER|SD_PHASE_HAS_EVAL; } ccl_device float3 volume_henyey_greenstein_eval_phase(const ShaderClosure *sc, const float3 I, float3 omega_in, float *pdf) @@ -103,13 +103,13 @@ ccl_device int volume_absorption_setup(ShaderClosure *sc) /* VOLUME CLOSURE */ -ccl_device float3 volume_eval_phase(const ShaderClosure *sc, const float3 I, float3 omega_in, float *pdf) +ccl_device float3 volume_phase_eval(const ShaderData *sd, const ShaderClosure *sc, float3 omega_in, float *pdf) { float3 eval; switch(sc->type) { case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID: - eval = volume_henyey_greenstein_eval_phase(sc, I, omega_in, pdf); + eval = volume_henyey_greenstein_eval_phase(sc, sd->I, omega_in, pdf); break; default: eval = make_float3(0.0f, 0.0f, 0.0f); @@ -119,7 +119,7 @@ ccl_device float3 volume_eval_phase(const ShaderClosure *sc, const float3 I, flo return eval; } -ccl_device int volume_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, +ccl_device int volume_phase_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, differential3 *domega_in, float *pdf) { int label; |