diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-30 14:55:13 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-30 17:44:58 +0300 |
commit | da741013a1e1b2e7c4f61a9486588253a457afd2 (patch) | |
tree | b491c53eadf1fcc07e2a326d000b1c94fbf07f48 /source/blender/draw/engines/eevee/shaders/surface_lib.glsl | |
parent | 55401fbb3d0daa82c999e388c2b5b87e7113b091 (diff) |
EEVEE: GLSL refactor/cleanup
- add the use of DRWShaderLibrary to EEVEE's glsl codebase to reduce code
complexity and duplication.
- split bsdf_common_lib.glsl into multiple sub library which are now shared
with other engines.
- the surface shader code is now more organised and have its own files.
- change default world to use a material nodetree and make lookdev shader
more clear.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D8306
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/surface_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/surface_lib.glsl | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/surface_lib.glsl b/source/blender/draw/engines/eevee/shaders/surface_lib.glsl new file mode 100644 index 00000000000..b93a3a23eff --- /dev/null +++ b/source/blender/draw/engines/eevee/shaders/surface_lib.glsl @@ -0,0 +1,43 @@ +/** This describe the entire interface of the shader. */ + +/* Samplers */ +uniform sampler2D colorBuffer; +uniform sampler2D depthBuffer; + +/* Uniforms */ +uniform float refractionDepth; + +#define SURFACE_INTERFACE \ + vec3 worldPosition; \ + vec3 viewPosition; \ + vec3 worldNormal; \ + vec3 viewNormal; + +#ifdef 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 + +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 |