This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/engines/eevee/shaders/surface_lib.glsl
Clément Foucault 9957096f35 EEVEE: ScreenSpaceReflections: Improve hit quality
This changes the hitBuffer to store `ReflectionDir * HitTime, invPdf`
just as the reference presentation.

This avoids issues when the hit refinement produce a coordinate that
does not land on the correct surface.

We now store the pdf in the same texture and store it inversed so we can
remove some ALU from the resolve shader.

This also rewrite the resolve shader to not be vectorized to improve
readability and scalability.
2021-03-10 17:57:09 +01:00

45 lines
1.1 KiB
GLSL

/** This describe the entire interface of the shader. */
#define SURFACE_INTERFACE \
vec3 worldPosition; \
vec3 viewPosition; \
vec3 worldNormal; \
vec3 viewNormal;
#if defined(STEP_RESOLVE) || defined(STEP_RAYTRACE)
/* SSR will set these global variables itself.
* Also make false positive compiler warnings disapear by setting values. */
vec3 worldPosition = vec3(0);
vec3 viewPosition = vec3(0);
vec3 worldNormal = vec3(0);
vec3 viewNormal = vec3(0);
#elif defined(GPU_GEOMETRY_SHADER)
in ShaderStageInterface{SURFACE_INTERFACE} dataIn[];
out ShaderStageInterface{SURFACE_INTERFACE} dataOut;
# define PASS_SURFACE_INTERFACE(vert) \
dataOut.worldPosition = dataIn[vert].worldPosition; \
dataOut.viewPosition = dataIn[vert].viewPosition; \
dataOut.worldNormal = dataIn[vert].worldNormal; \
dataOut.viewNormal = dataIn[vert].viewNormal;
#else /* GPU_VERTEX_SHADER || GPU_FRAGMENT_SHADER*/
IN_OUT ShaderStageInterface{SURFACE_INTERFACE};
#endif
#ifdef HAIR_SHADER
IN_OUT ShaderHairInterface
{
/* world space */
vec3 hairTangent;
float hairThickTime;
float hairThickness;
float hairTime;
flat int hairStrandID;
};
#endif