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/gpu/shaders/material/gpu_shader_material_displacement.glsl
Clément Foucault e02e844f51 Fix T100163: Eevee: Regression: Displacement maps affected by rotation
This was an oversight as the matrix multiplication present in original
code was reversed.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15858
2022-09-02 18:21:24 +02:00

13 lines
461 B
GLSL

void node_displacement_object(float height, float midlevel, float scale, vec3 N, out vec3 result)
{
N = transform_direction(ModelMatrixInverse, N);
result = (height - midlevel) * scale * normalize(N);
/* Apply object scale and orientation. */
result = transform_direction(ModelMatrix, result);
}
void node_displacement_world(float height, float midlevel, float scale, vec3 N, out vec3 result)
{
result = (height - midlevel) * scale * normalize(N);
}