1 #ifndef R2_RECONSTRUCTED_SURFACE_H 2 #define R2_RECONSTRUCTED_SURFACE_H 64 const float depth_coefficient,
65 const vec2 screen_position)
73 texture (gbuffer.
depth, screen_uv).x;
74 float eye_z_positive =
83 #if defined(R2_RECONSTRUCT_DIFFUSE_ONLY) || defined(R2_RECONSTRUCT_DIFFUSE_SPECULAR_ONLY) 89 texture (gbuffer.
albedo, screen_uv);
97 vec2 normal_compressed =
98 texture (gbuffer.
normal, screen_uv).xy;
102 #if !defined(R2_RECONSTRUCT_DIFFUSE_ONLY) 105 texture (gbuffer.
specular, screen_uv);
106 vec3 specular_color =
109 specular_raw.a * 256.0;
111 vec3 specular_color = vec3 (0.0);
112 float specular_exponent = 0.0;
130 #endif // R2_RECONSTRUCTED_SURFACE_H
Functions for transforming normal vectors.
vec4 position
The eye-space position of the surface.
Viewport types and functions.
vec2 uv
The UV coordinates of the current screen fragment.
float specular_exponent
The sampled surface specular exponent in the range [0, 256]
Reconstructed surface data, taken from the G-Buffer.
float emission
The sampled surface emission level.
vec3 albedo
The sampled surface albedo.
vec3 normal
The eye-space normal vector of the surface.
float R2_logDepthDecode(const float z, const float depth_coefficient)
vec3 specular
The sampled surface specular color.
vec3 R2_normalsDecompress(const vec2 n)
vec2 R2_viewportFragmentPositionToUV(const R2_viewport_t v, const vec2 f_pos)
The type of view rays used to reconstruct positions during deferred rendering.
Logarithmic depth functions.
vec4 R2_positionReconstructFromEyeZ(const float eye_z, const vec2 uv, const R2_view_rays_t view_rays)
Functions for performing position reconstruction during deferred rendering.
R2_reconstructed_surface_t R2_deferredSurfaceReconstruct(const R2_gbuffer_input_t gbuffer, const R2_viewport_t viewport, const R2_view_rays_t view_rays, const float depth_coefficient, const vec2 screen_position)