diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-05-03 23:45:27 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-05-03 23:50:04 +0300 |
commit | 281bcc1c1dd6b786bafa2712986885c44ed482a3 (patch) | |
tree | af2ec45d2d67fce7ee94086074c05d806722fc48 /source/blender/draw/engines | |
parent | 94205e1d029511b2ab714a53d84de8c50a70fb39 (diff) |
Fix T93179: geonodes UVs and Vertex colors do not work in EEVEE
Overwriting UV map or vertex color data in Geometry nodes will move the
layers to another CustomData channel, and as such, will make attribute
lookup fail from the UVMap and Vertex Color nodes in EEVEE as the
CustomDataType will also be modified (i.e. no longer `CD_MTFACE` or
`CD_MCOL`).
As discussed in T93179, the solution is to use `CD_PROP_AUTO_FROM_NAME`
so that the render engine is able to find the attributes. This also makes
EEVEE emulate Cycles behaviour in this regard. `attr_load_uv` and
`attr_load_color` are also removed in favor of the generic attribute
API in the various GLSL shaders.
Although `CD_PROP_AUTO_FROM_NAME` is now used even for UV maps, the
active UV map is still used in case the attribute name is empty, to
preserve the old behavior.
Differential Revision: https://developer.blender.org/D13730
Diffstat (limited to 'source/blender/draw/engines')
4 files changed, 0 insertions, 53 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl index ab0f4d6bec8..5295a05b965 100644 --- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl @@ -71,16 +71,6 @@ vec4 attr_load_tangent(samplerBuffer cd_buf) return vec4(0.0, 0.0, 0.0, 1.0); } -vec3 attr_load_uv(samplerBuffer cd_buf) -{ - return texelFetch(cd_buf, hairStrandID).rgb; -} - -vec4 attr_load_color(samplerBuffer cd_buf) -{ - return texelFetch(cd_buf, hairStrandID).rgba; -} - vec4 attr_load_vec4(samplerBuffer cd_buf) { return texelFetch(cd_buf, hairStrandID).rgba; @@ -135,14 +125,6 @@ vec2 attr_load_float(vec2 attr) { return attr; } -vec4 attr_load_color(vec4 attr) -{ - return attr; -} -vec3 attr_load_uv(vec3 attr) -{ - return attr; -} #endif /* Passthrough. */ diff --git a/source/blender/draw/engines/eevee/shaders/surface_frag.glsl b/source/blender/draw/engines/eevee/shaders/surface_frag.glsl index 79ec3807d0b..ace6c7d788d 100644 --- a/source/blender/draw/engines/eevee/shaders/surface_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/surface_frag.glsl @@ -171,14 +171,6 @@ vec2 attr_load_vec2(vec2 attr) { return vec2(0); } -vec4 attr_load_color(vec4 attr) -{ - return vec4(0); -} -vec3 attr_load_uv(vec3 attr) -{ - return vec3(0); -} /* Passthrough. */ float attr_load_temperature_post(float attr) diff --git a/source/blender/draw/engines/eevee/shaders/surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/surface_vert.glsl index 49c18832f72..7cb4d7ac25c 100644 --- a/source/blender/draw/engines/eevee/shaders/surface_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/surface_vert.glsl @@ -77,16 +77,6 @@ vec4 attr_load_tangent(samplerBuffer cd_buf) return vec4(hairTangent, 1.0); } -vec3 attr_load_uv(samplerBuffer cd_buf) -{ - return texelFetch(cd_buf, hairStrandID).rgb; -} - -vec4 attr_load_color(samplerBuffer cd_buf) -{ - return texelFetch(cd_buf, hairStrandID).rgba; -} - vec4 attr_load_vec4(samplerBuffer cd_buf) { return texelFetch(cd_buf, hairStrandID).rgba; @@ -148,14 +138,6 @@ float attr_load_float(float attr) { return attr; } -vec4 attr_load_color(vec4 attr) -{ - return attr; -} -vec3 attr_load_uv(vec3 attr) -{ - return attr; -} #endif /* Passthrough. */ diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl index 914261d7f59..d6eeedd8640 100644 --- a/source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/volumetric_frag.glsl @@ -155,15 +155,6 @@ float attr_load_float(sampler3D tex) { return texture(tex, grid_coordinates()).r; } -vec4 attr_load_color(sampler3D tex) -{ - return texture(tex, grid_coordinates()); -} -vec3 attr_load_uv(sampler3D attr) -{ - attr_id += 1; - return vec3(0); -} /* TODO(@fclem): These implementation details should concern the DRWManager and not be a fix on * the engine side. But as of now, the engines are reponsible for loading the attributes. */ |