Eevee: Hair: Disable SSR for hairs.

SSR does not work with hair strands. Basically, the rays are too much
random to ever converge properly and just result in a soup of self
inter reflections.

So forcing it to not produce any SSR. Could potentially save some bandwidth
by not rendering hair to the SSR buffers.
This commit is contained in:
Clément Foucault 2018-05-14 00:18:00 +02:00
parent 2c1396b6cb
commit a0c564f86a
2 changed files with 14 additions and 0 deletions

View File

@ -671,6 +671,7 @@ struct Closure {
/* This is hacking ssr_id to tag transparent bsdf */
#define TRANSPARENT_CLOSURE_FLAG -2
#define REFRACT_CLOSURE_FLAG -3
#define NO_SSR -999
# ifdef USE_SSS
# ifdef USE_SSS_ALBEDO

View File

@ -177,6 +177,13 @@ void CLOSURE_NAME(
float cos_theta = rand.x * 2.0 - 1.0;
float sin_theta = sqrt(max(0.0, 1.0f - cos_theta*cos_theta));;
N = N * sin_theta + B * cos_theta;
# ifdef CLOSURE_GLOSSY
/* Hair random normal does not work with SSR :(.
* It just create self reflection feedback (which is beautifful btw)
* but not correct. */
ssr_id = NO_SSR; /* Force bypass */
# endif
#endif
/* ---------------------------------------------------------------- */
@ -385,6 +392,12 @@ void CLOSURE_NAME(
}
out_spec += spec_accum.rgb * ssr_spec * spec_occlu * float(specToggle);
# ifdef HAIR_SHADER
/* Hack: Overide spec color so that ssr will not be computed
* even if ssr_id match the active ssr. */
ssr_spec = vec3(0.0);
# endif
#endif
#ifdef CLOSURE_REFRACTION