diff options
Diffstat (limited to 'intern/cycles/kernel/closure')
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_transparent.h | 18 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/volume.h | 26 |
2 files changed, 30 insertions, 14 deletions
diff --git a/intern/cycles/kernel/closure/bsdf_transparent.h b/intern/cycles/kernel/closure/bsdf_transparent.h index 3c2fd8004df..22ca7f3847e 100644 --- a/intern/cycles/kernel/closure/bsdf_transparent.h +++ b/intern/cycles/kernel/closure/bsdf_transparent.h @@ -35,10 +35,22 @@ CCL_NAMESPACE_BEGIN -ccl_device int bsdf_transparent_setup(ShaderClosure *sc) +ccl_device void bsdf_transparent_setup(ShaderData *sd, const float3 weight) { - sc->type = CLOSURE_BSDF_TRANSPARENT_ID; - return SD_BSDF|SD_TRANSPARENT; + if(sd->flag & SD_TRANSPARENT) { + sd->closure_transparent_extinction += weight; + } + else { + sd->flag |= SD_BSDF|SD_TRANSPARENT; + sd->closure_transparent_extinction = weight; + } + + ShaderClosure *bsdf = bsdf_alloc(sd, sizeof(ShaderClosure), weight); + + if(bsdf) { + bsdf->N = sd->N; + bsdf->type = CLOSURE_BSDF_TRANSPARENT_ID; + } } ccl_device float3 bsdf_transparent_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) diff --git a/intern/cycles/kernel/closure/volume.h b/intern/cycles/kernel/closure/volume.h index 01e67c7c2fd..4bb5e680723 100644 --- a/intern/cycles/kernel/closure/volume.h +++ b/intern/cycles/kernel/closure/volume.h @@ -19,14 +19,27 @@ CCL_NAMESPACE_BEGIN +/* VOLUME EXTINCTION */ + +ccl_device void volume_extinction_setup(ShaderData *sd, float3 weight) +{ + if(sd->flag & SD_EXTINCTION) { + sd->closure_transparent_extinction += weight; + } + else { + sd->flag |= SD_EXTINCTION; + sd->closure_transparent_extinction = weight; + } +} + +/* HENYEY-GREENSTEIN CLOSURE */ + typedef ccl_addr_space struct HenyeyGreensteinVolume { SHADER_CLOSURE_BASE; float g; } HenyeyGreensteinVolume; -/* HENYEY-GREENSTEIN CLOSURE */ - /* Given cosine between rays, return probability density that a photon bounces * to that direction. The g parameter controls how different it is from the * uniform sphere. g=0 uniform diffuse-like, g=1 close to sharp single ray. */ @@ -110,15 +123,6 @@ ccl_device int volume_henyey_greenstein_sample(const ShaderClosure *sc, float3 I return LABEL_VOLUME_SCATTER; } -/* ABSORPTION VOLUME CLOSURE */ - -ccl_device int volume_absorption_setup(ShaderClosure *sc) -{ - sc->type = CLOSURE_VOLUME_ABSORPTION_ID; - - return SD_ABSORPTION; -} - /* VOLUME CLOSURE */ ccl_device float3 volume_phase_eval(const ShaderData *sd, const ShaderClosure *sc, float3 omega_in, float *pdf) |