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.
35 lines
771 B
GLSL
35 lines
771 B
GLSL
|
|
void differentiate_texco(vec3 v, out vec3 df)
|
|
{
|
|
/* Implementation defined. */
|
|
df = v + dF_impl(v);
|
|
}
|
|
|
|
void node_bump(
|
|
float strength, float dist, float height, vec3 N, vec2 dHd, float invert, out vec3 result)
|
|
{
|
|
N = normalize(N);
|
|
dist *= FrontFacing ? invert : -invert;
|
|
|
|
#ifdef GPU_FRAGMENT_SHADER
|
|
vec3 dPdx = dFdx(g_data.P);
|
|
vec3 dPdy = dFdy(g_data.P);
|
|
|
|
/* Get surface tangents from normal. */
|
|
vec3 Rx = cross(dPdy, N);
|
|
vec3 Ry = cross(N, dPdx);
|
|
|
|
/* Compute surface gradient and determinant. */
|
|
float det = dot(dPdx, Rx);
|
|
|
|
vec3 surfgrad = dHd.x * Rx + dHd.y * Ry;
|
|
|
|
strength = max(strength, 0.0);
|
|
|
|
result = normalize(abs(det) * N - dist * sign(det) * surfgrad);
|
|
result = normalize(mix(N, result, strength));
|
|
#else
|
|
result = N;
|
|
#endif
|
|
}
|