Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/closure/bsdf.h
| Show All 34 Lines | |||||
| #ifdef __VOLUME__ | #ifdef __VOLUME__ | ||||
| # include "kernel/closure/volume.h" | # include "kernel/closure/volume.h" | ||||
| #endif | #endif | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| ccl_device_forceinline int bsdf_sample(KernelGlobals *kg, | ccl_device_forceinline int bsdf_sample(KernelGlobals *kg, | ||||
| ShaderData *sd, | ShaderData *sd, | ||||
| const ShaderClosure *sc, | const ShaderClosure *sc, | ||||
sergey: Either call it `bsdf_get_square_roughness` which is explicit and easy to read, or follow… | |||||
| float randu, | float randu, | ||||
| float randv, | float randv, | ||||
| float3 *eval, | float3 *eval, | ||||
| float3 *omega_in, | float3 *omega_in, | ||||
| differential3 *domega_in, | differential3 *domega_in, | ||||
| float *pdf) | float *pdf) | ||||
| { | { | ||||
| int label; | int label; | ||||
| ▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| default: | default: | ||||
| label = LABEL_NONE; | label = LABEL_NONE; | ||||
| break; | break; | ||||
| } | } | ||||
| return label; | return label; | ||||
| } | } | ||||
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. | |||||
| #ifndef __KERNEL_CUDA__ | #ifndef __KERNEL_CUDA__ | ||||
| ccl_device | ccl_device | ||||
| #else | #else | ||||
| ccl_device_forceinline | ccl_device_forceinline | ||||
| #endif | #endif | ||||
| float3 bsdf_eval(KernelGlobals *kg, | float3 bsdf_eval(KernelGlobals *kg, | ||||
| ShaderData *sd, | ShaderData *sd, | ||||
| const ShaderClosure *sc, | const ShaderClosure *sc, | ||||
| ▲ Show 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | #endif | ||||
| default: | default: | ||||
| return false; | return false; | ||||
| } | } | ||||
| #else | #else | ||||
| return false; | return false; | ||||
| #endif | #endif | ||||
| } | } | ||||
| /* Classifies a closure as diffuse-like or specular-like. | /* Returns the square of the roughness of the closure if it has roughness, | ||||
| * This is needed for the denoising feature pass generation, | * 0 for transparent closures and 1 otherwise. */ | ||||
| * which are written on the first bounce where more than 25% | ccl_device_inline float bsdf_get_roughness_sqr(const ShaderClosure *sc) | ||||
| * of the sampling weight belongs to diffuse-line closures. */ | |||||
| ccl_device_inline bool bsdf_is_specular_like(ShaderClosure *sc) | |||||
| { | { | ||||
| if(CLOSURE_IS_BSDF_TRANSPARENT(sc->type)) { | if(CLOSURE_IS_BSDF_TRANSPARENT(sc->type)) { | ||||
| return true; | 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 <= 0.075f*0.075f); | return bsdf->alpha_x*bsdf->alpha_y; | ||||
| } | } | ||||
| return false; | return 1.0f; | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
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.