forked from bartvdbraak/blender
Code cleanup / Cycles:
* Some simplification of closure code (Velvet and Toon).
This commit is contained in:
parent
1df12416ca
commit
9b59e2b95a
@ -37,13 +37,10 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
__device int bsdf_ashikhmin_velvet_setup(ShaderClosure *sc)
|
__device int bsdf_ashikhmin_velvet_setup(ShaderClosure *sc)
|
||||||
{
|
{
|
||||||
float sigma = sc->data0;
|
float sigma = fmaxf(sc->data0, 0.01f);
|
||||||
sigma = fmaxf(sigma, 0.01f);
|
sc->data0 = 1.0f/(sigma * sigma); /* m_invsigma2 */
|
||||||
|
|
||||||
float m_invsigma2 = 1.0f/(sigma * sigma);
|
|
||||||
|
|
||||||
sc->type = CLOSURE_BSDF_ASHIKHMIN_VELVET_ID;
|
sc->type = CLOSURE_BSDF_ASHIKHMIN_VELVET_ID;
|
||||||
sc->data0 = m_invsigma2;
|
|
||||||
|
|
||||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||||
}
|
}
|
||||||
|
@ -52,14 +52,12 @@ __device void bsdf_diffuse_toon_blur(ShaderClosure *sc, float roughness)
|
|||||||
|
|
||||||
__device float3 bsdf_toon_get_intensity(float max_angle, float smooth, float angle)
|
__device float3 bsdf_toon_get_intensity(float max_angle, float smooth, float angle)
|
||||||
{
|
{
|
||||||
float is;
|
float is = 0.0f;
|
||||||
|
|
||||||
if(angle < max_angle)
|
if(angle < max_angle)
|
||||||
is = 1.0f;
|
is = 1.0f;
|
||||||
else if(angle < (max_angle + smooth) && smooth != 0.0f)
|
else if(angle < (max_angle + smooth) && smooth != 0.0f)
|
||||||
is = (1.0f - (angle - max_angle)/smooth);
|
is = (1.0f - (angle - max_angle)/smooth);
|
||||||
else
|
|
||||||
is = 0.0f;
|
|
||||||
|
|
||||||
return make_float3(is, is, is);
|
return make_float3(is, is, is);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user