Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/closure/bsdf.h
| Show All 32 Lines | |||||
| #ifdef __VOLUME__ | #ifdef __VOLUME__ | ||||
| # include "kernel/closure/volume.h" | # include "kernel/closure/volume.h" | ||||
| #endif | #endif | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| /* Returns the square of the roughness of the closure if it has roughness, | /* Returns the square of the roughness of the closure if it has roughness, | ||||
| * 0 for singular closures and 1 otherwise. */ | * 0 for singular closures and 1 otherwise. */ | ||||
| ccl_device_inline float bsdf_get_roughness_sqr(const ShaderClosure *sc) | ccl_device_inline float bsdf_get_roughness_squared(const ShaderClosure *sc) | ||||
sergey: Either call it `bsdf_get_square_roughness` which is explicit and easy to read, or follow… | |||||
| { | { | ||||
| if(CLOSURE_IS_BSDF_SINGULAR(sc->type)) { | if(CLOSURE_IS_BSDF_SINGULAR(sc->type)) { | ||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| if(CLOSURE_IS_BSDF_MICROFACET(sc->type)) { | if(CLOSURE_IS_BSDF_MICROFACET(sc->type)) { | ||||
| MicrofacetBsdf *bsdf = (MicrofacetBsdf*) sc; | MicrofacetBsdf *bsdf = (MicrofacetBsdf*) sc; | ||||
| return bsdf->alpha_x*bsdf->alpha_y; | return bsdf->alpha_x*bsdf->alpha_y; | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID: | ||||
| label = volume_henyey_greenstein_sample(sc, sd->I, sd->dI.dx, sd->dI.dy, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf); | label = volume_henyey_greenstein_sample(sc, sd->I, sd->dI.dx, sd->dI.dy, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf); | ||||
| break; | break; | ||||
| #endif | #endif | ||||
| default: | default: | ||||
| label = LABEL_NONE; | label = LABEL_NONE; | ||||
| break; | break; | ||||
| } | } | ||||
| /* Test if BSDF sample should be treated as transparent for background. */ | |||||
| if(label & LABEL_TRANSMIT) { | |||||
| float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold; | |||||
Not Done Inline ActionsYou can not assign non-square value to a square one. Surely, kernel_data.background.transparent_roughness_threshold is likely storing squared value, but this is not what the name suggests and this line reads as a bug. sergey: You can not assign non-square value to a square one.
Surely, `kernel_data.background. | |||||
| if(threshold_squared >= 0.0f) { | |||||
| if(bsdf_get_roughness_squared(sc) <= threshold_squared) { | |||||
| label |= LABEL_TRANSMIT_TRANSPARENT; | |||||
| } | |||||
| } | |||||
| } | |||||
| return label; | return label; | ||||
| } | } | ||||
| #ifndef __KERNEL_CUDA__ | #ifndef __KERNEL_CUDA__ | ||||
| ccl_device | ccl_device | ||||
| #else | #else | ||||
| ccl_device_forceinline | ccl_device_forceinline | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 275 Lines • Show Last 20 Lines | |||||
Either call it bsdf_get_square_roughness which is explicit and easy to read, or follow general Blender style and use _sq.
Would really suggest the first one.