diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-04-14 19:47:58 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-04-14 19:47:58 +0300 |
commit | 80859a6cb2726a39fb22cb49f06e0355dc9390a7 (patch) | |
tree | fd3f8ead5a247a79ea11e4aacc720843bbc5e2c2 /source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl | |
parent | 66dc4d4efb88ecf2d18bfa08ab9c43b024ebd2fb (diff) |
GPU: Make nodetree GLSL Codegen render engine agnostic
This commit removes all EEVEE specific code from the `gpu_shader_material*.glsl`
files. It defines a clear interface to evaluate the closure nodes leaving
more flexibility to the render engine.
Some of the long standing workaround are fixed:
- bump mapping support is no longer duplicating a lot of node and is instead
compiled into a function call.
- bump rewiring to Normal socket is no longer needed as we now use a global
`g_data.N` for that.
Closure sampling with upstread weight eval is now supported if the engine needs
it.
This also makes all the material GLSL sources use `GPUSource` for better
debugging experience. The `GPUFunction` parsing now happens in `GPUSource`
creation.
The whole `GPUCodegen` now uses the `ShaderCreateInfo` and is object type
agnostic. Is has also been rewritten in C++.
This patch changes a view behavior for EEVEE:
- Mix shader node factor imput is now clamped.
- Tangent Vector displacement behavior is now matching cycles.
- The chosen BSDF used for SSR might change.
- Hair shading may have very small changes on very large hairs when using hair
polygon stripes.
- ShaderToRGB node will remove any SSR and SSS form a shader.
- SSS radius input now is no longer a scaling factor but defines an average
radius. The SSS kernel "shape" (radii) are still defined by the socket default
values.
Appart from the listed changes no other regressions are expected.
Diffstat (limited to 'source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl')
-rw-r--r-- | source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl index e6d7b9d3721..464cf5227b4 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_volume_info.glsl @@ -4,14 +4,8 @@ uniform vec3 volumeColor = vec3(1.0); uniform vec2 volumeTemperature = vec2(0.0); /* Generic volume attribute. */ -void node_attribute_volume(sampler3D tex, mat4 transform, out vec3 outvec) +void node_attribute_volume(sampler3D tex, mat4 transform, vec3 cos, out vec3 outvec) { -#if defined(MESH_SHADER) && defined(VOLUMETRICS) - vec3 cos = volumeObjectLocalCoord; -#else - vec3 cos = vec3(0.0); -#endif - /* Optional per-grid transform. */ if (transform[3][3] != 0.0) { cos = (transform * vec4(cos, 1.0)).xyz; @@ -21,14 +15,8 @@ void node_attribute_volume(sampler3D tex, mat4 transform, out vec3 outvec) } /* Special color attribute for smoke. */ -void node_attribute_volume_color(sampler3D tex, mat4 transform, out vec3 outvec) +void node_attribute_volume_color(sampler3D tex, mat4 transform, vec3 cos, out vec3 outvec) { -#if defined(MESH_SHADER) && defined(VOLUMETRICS) - vec3 cos = volumeObjectLocalCoord; -#else - vec3 cos = vec3(0.0); -#endif - /* Optional per-grid transform. */ if (transform[3][3] != 0.0) { cos = (transform * vec4(cos, 1.0)).xyz; @@ -44,14 +32,8 @@ void node_attribute_volume_color(sampler3D tex, mat4 transform, out vec3 outvec) } /* Special temperature attribute for smoke. */ -void node_attribute_volume_temperature(sampler3D tex, mat4 transform, out float outf) +void node_attribute_volume_temperature(sampler3D tex, mat4 transform, vec3 cos, out float outf) { -#if defined(MESH_SHADER) && defined(VOLUMETRICS) - vec3 cos = volumeObjectLocalCoord; -#else - vec3 cos = vec3(0.0); -#endif - /* Optional per-grid transform. */ if (transform[3][3] != 0.0) { cos = (transform * vec4(cos, 1.0)).xyz; |