1
1

EEVEE-Next: Fix some Material compilation errors

This commit is contained in:
2022-07-25 09:44:15 +02:00
parent 47d1a7484c
commit f814871e81
3 changed files with 58 additions and 40 deletions

View File

@@ -3,6 +3,8 @@
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
#pragma BLENDER_REQUIRE(gpu_shader_codegen_lib.glsl)
#defined EEVEE_ATTRIBUTE_LIB
#if defined(MAT_GEOM_MESH)
/* -------------------------------------------------------------------- */
@@ -282,43 +284,3 @@ vec3 attr_load_uv(vec3 attr)
/** \} */
#endif
/* -------------------------------------------------------------------- */
/** \name Volume Attribute post
*
* 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 responsible for loading the attributes.
*
* \{ */
#if defined(MAT_GEOM_VOLUME)
float attr_load_temperature_post(float attr)
{
/* Bring the into standard range without having to modify the grid values */
attr = (attr > 0.01) ? (attr * drw_volume.temperature_mul + drw_volume.temperature_bias) : 0.0;
return attr;
}
vec4 attr_load_color_post(vec4 attr)
{
/* Density is premultiplied for interpolation, divide it out here. */
attr.rgb *= safe_rcp(attr.a);
attr.rgb *= drw_volume.color_mul.rgb;
attr.a = 1.0;
return attr;
}
#else /* Noop for any other surface. */
float attr_load_temperature_post(float attr)
{
return attr;
}
vec4 attr_load_color_post(vec4 attr)
{
return attr;
}
#endif
/** \} */

View File

@@ -269,6 +269,10 @@ void output_aov(vec4 color, float value, uint hash)
# define nodetree_thickness() 0.1
#endif
#ifdef GPU_VERTEX_SHADER
# define closure_to_rgba(a) vec4(0.0)
#endif
/* -------------------------------------------------------------------- */
/** \name Fragment Displacement
*
@@ -373,3 +377,43 @@ vec3 coordinate_incoming(vec3 P)
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Volume Attribute post
*
* 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 responsible for loading the attributes.
*
* \{ */
#if defined(MAT_GEOM_VOLUME)
float attr_load_temperature_post(float attr)
{
/* Bring the into standard range without having to modify the grid values */
attr = (attr > 0.01) ? (attr * drw_volume.temperature_mul + drw_volume.temperature_bias) : 0.0;
return attr;
}
vec4 attr_load_color_post(vec4 attr)
{
/* Density is premultiplied for interpolation, divide it out here. */
attr.rgb *= safe_rcp(attr.a);
attr.rgb *= drw_volume.color_mul.rgb;
attr.a = 1.0;
return attr;
}
#else /* Noop for any other surface. */
float attr_load_temperature_post(float attr)
{
return attr;
}
vec4 attr_load_color_post(vec4 attr)
{
return attr;
}
#endif
/** \} */

View File

@@ -10,6 +10,18 @@
#pragma BLENDER_REQUIRE(eevee_surf_lib.glsl)
#pragma BLENDER_REQUIRE(eevee_velocity_lib.glsl)
vec4 closure_to_rgba(Closure cl)
{
vec4 out_color;
out_color.rgb = g_emission;
out_color.a = saturate(1.0 - avg(g_transmittance));
/* Reset for the next closure tree. */
closure_weights_reset();
return out_color;
}
/* From the paper "Hashed Alpha Testing" by Chris Wyman and Morgan McGuire. */
float hash(vec2 a)
{