1
0
Fork 0

HDR: Fix logarithmic depth in building effect

This commit is contained in:
Fernando García Liñán 2024-01-31 17:42:44 +01:00
parent 73a55a71c5
commit c032a41cd6

View file

@ -11,6 +11,7 @@ layout(location = 10) in vec3 attrib1; // Generic packed attributes
layout(location = 11) in vec3 attrib2; layout(location = 11) in vec3 attrib2;
out VS_OUT { out VS_OUT {
float flogz;
vec2 texcoord; vec2 texcoord;
vec3 vertex_normal; vec3 vertex_normal;
vec3 view_vector; vec3 view_vector;
@ -23,6 +24,9 @@ uniform mat3 osg_NormalMatrix;
const float c_precision = 128.0; const float c_precision = 128.0;
const float c_precisionp1 = c_precision + 1.0; const float c_precisionp1 = c_precision + 1.0;
// logarithmic_depth.glsl
float logdepth_prepare_vs_depth(float z);
vec3 float2vec(float value) vec3 float2vec(float value)
{ {
vec3 val; vec3 val;
@ -63,6 +67,7 @@ void main()
position = position + instancePosition.xyz; position = position + instancePosition.xyz;
gl_Position = osg_ModelViewProjectionMatrix * vec4(position, 1.0); gl_Position = osg_ModelViewProjectionMatrix * vec4(position, 1.0);
vs_out.flogz = logdepth_prepare_vs_depth(gl_Position.w);
// Texture coordinates are stored as: // Texture coordinates are stored as:
// - a separate offset (x0, y0) for the wall (wtex0x, wtex0y), // - a separate offset (x0, y0) for the wall (wtex0x, wtex0y),