Style: Fix code formatting in GLES3 shaders

This commit is contained in:
Rémi Verschelde 2018-08-24 13:42:18 +02:00
parent f123694b4e
commit 1b6d75a599
17 changed files with 1552 additions and 1923 deletions

View file

@ -1,6 +1,5 @@
[vertex]
/*
from VisualServer:
@ -110,7 +109,6 @@ uniform float blend_amount;
void main() {
#ifdef ENABLE_BLEND
vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount;
@ -140,7 +138,6 @@ void main() {
uv2_out = uv2_attrib_blend + uv2_attrib * blend_amount;
#endif
#ifdef ENABLE_SKELETON
bone_out = bone_attrib_blend;
@ -149,7 +146,6 @@ void main() {
#else //ENABLE_BLEND
vertex_out = vertex_attrib * blend_amount;
#ifdef ENABLE_NORMAL
@ -177,7 +173,6 @@ void main() {
uv2_out = uv2_attrib * blend_amount;
#endif
#ifdef ENABLE_SKELETON
bone_out = bone_attrib;
@ -190,8 +185,6 @@ void main() {
[fragment]
void main() {
}

View file

@ -1,6 +1,5 @@
[vertex]
layout(location = 0) in highp vec2 vertex;
layout(location = 3) in vec4 color_attrib;
@ -31,12 +30,11 @@ layout(location=12) in highp vec4 instance_custom_data;
layout(location = 4) in highp vec2 uv_attrib;
//skeletn
// skeleton
#endif
uniform highp vec2 color_texpixel_size;
layout(std140) uniform CanvasItemData { //ubo:0
highp mat4 projection_matrix;
@ -46,7 +44,6 @@ layout(std140) uniform CanvasItemData { //ubo:0
uniform highp mat4 modelview_matrix;
uniform highp mat4 extra_matrix;
out highp vec2 uv_interp;
out mediump vec4 color_interp;
@ -55,7 +52,6 @@ out mediump vec4 color_interp;
out highp vec2 pixel_size_interp;
#endif
#ifdef USE_SKELETON
uniform mediump sampler2D skeleton_texture; // texunit:-1
uniform highp mat4 skeleton_transform;
@ -80,11 +76,9 @@ layout(std140) uniform LightData { //ubo:1
highp float shadow_distance_mult;
};
out vec4 light_uv_interp;
out vec2 transformed_light_uv;
out vec4 local_rot;
#ifdef USE_SHADOWS
@ -101,7 +95,6 @@ uniform int h_frames;
uniform int v_frames;
#endif
#if defined(USE_MATERIAL)
layout(std140) uniform UniformData { //ubo:2
@ -112,7 +105,6 @@ MATERIAL_UNIFORMS
#endif
VERTEX_SHADER_GLOBALS
void main() {
@ -143,7 +135,6 @@ void main() {
highp vec4 outvec = vec4(vertex, 0.0, 1.0);
#endif
#ifdef USE_PARTICLES
//scale by texture size
outvec.xy /= color_texpixel_size;
@ -158,7 +149,6 @@ void main() {
#endif
#define extra_matrix extra_matrix2
{
@ -167,7 +157,6 @@ VERTEX_SHADER_CODE
}
#ifdef USE_NINEPATCH
pixel_size_interp = abs(dst_rect.zw) * vertex;
@ -187,7 +176,6 @@ VERTEX_SHADER_CODE
outvec.xy = floor(outvec + 0.5).xy;
#endif
#ifdef USE_SKELETON
if (bone_weights != vec4(0.0)) { //must be a valid bone
@ -197,32 +185,32 @@ VERTEX_SHADER_CODE
ivec2 tex_ofs = ivec2(bone_indicesi.x % 256, (bone_indicesi.x / 256) * 2);
highp mat2x4 m = mat2x4(
highp mat2x4 m;
m = mat2x4(
texelFetch(skeleton_texture, tex_ofs, 0),
texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
) * bone_weights.x;
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0))
* bone_weights.x;
tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 2);
m += mat2x4(
texelFetch(skeleton_texture, tex_ofs, 0),
texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
) * bone_weights.y;
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0))
* bone_weights.y;
tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 2);
m += mat2x4(
texelFetch(skeleton_texture, tex_ofs, 0),
texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
) * bone_weights.z;
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0))
* bone_weights.z;
tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 2);
m += mat2x4(
texelFetch(skeleton_texture, tex_ofs, 0),
texelFetch(skeleton_texture,tex_ofs+ivec2(0,1),0)
) * bone_weights.w;
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0))
* bone_weights.w;
mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0], m[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0))) * skeleton_transform_inverse;
@ -248,7 +236,6 @@ VERTEX_SHADER_CODE
pos = outvec.xy;
#endif
local_rot.xy = normalize((modelview_matrix * (extra_matrix * vec4(1.0, 0.0, 0.0, 0.0))).xy);
local_rot.zw = normalize((modelview_matrix * (extra_matrix * vec4(0.0, 1.0, 0.0, 0.0))).xy);
#ifdef USE_TEXTURE_RECT
@ -256,25 +243,18 @@ VERTEX_SHADER_CODE
local_rot.zw *= sign(src_rect.w);
#endif
#endif
}
[fragment]
uniform mediump sampler2D color_texture; // texunit:0
uniform highp vec2 color_texpixel_size;
uniform mediump sampler2D normal_texture; // texunit:1
in highp vec2 uv_interp;
in mediump vec4 color_interp;
#if defined(SCREEN_TEXTURE_USED)
uniform sampler2D screen_texture; // texunit:-3
@ -292,7 +272,6 @@ layout(std140) uniform CanvasItemData {
highp float time;
};
#ifdef USE_LIGHTING
layout(std140) uniform LightData {
@ -314,10 +293,8 @@ uniform lowp sampler2D light_texture; // texunit:-1
in vec4 light_uv_interp;
in vec2 transformed_light_uv;
in vec4 local_rot;
#ifdef USE_SHADOWS
uniform highp sampler2D shadow_texture; // texunit:-2
@ -332,12 +309,8 @@ const bool at_light_pass = false;
uniform mediump vec4 final_modulate;
layout(location = 0) out mediump vec4 frag_color;
#if defined(USE_MATERIAL)
layout(std140) uniform UniformData {
@ -369,7 +342,6 @@ void light_compute(
LIGHT_SHADER_CODE
#endif
}
#ifdef USE_TEXTURE_RECT
@ -388,11 +360,8 @@ uniform bool np_draw_center;
// left top right bottom in pixel coordinates
uniform vec4 np_margins;
float map_ninepatch_axis(float pixel, float draw_size, float tex_pixel_size, float margin_begin, float margin_end, int np_repeat, inout int draw_center) {
float tex_size = 1.0 / tex_pixel_size;
if (pixel < margin_begin) {
@ -426,7 +395,6 @@ float map_ninepatch_axis(float pixel, float draw_size,float tex_pixel_size,float
return (margin_begin + ratio * dst_area) * tex_pixel_size;
}
}
}
#endif
@ -446,8 +414,7 @@ void main() {
int draw_center = 2;
uv = vec2(
map_ninepatch_axis(pixel_size_interp.x, abs(dst_rect.z), color_texpixel_size.x, np_margins.x, np_margins.z, np_repeat_h, draw_center),
map_ninepatch_axis(pixel_size_interp.y,abs(dst_rect.w),color_texpixel_size.y,np_margins.y,np_margins.w,np_repeat_v,draw_center)
);
map_ninepatch_axis(pixel_size_interp.y, abs(dst_rect.w), color_texpixel_size.y, np_margins.y, np_margins.w, np_repeat_v, draw_center));
if (draw_center == 0) {
color.a = 0.0;
@ -477,8 +444,6 @@ void main() {
#endif
vec3 normal;
#if defined(NORMAL_USED)
@ -496,13 +461,10 @@ void main() {
normal = vec3(0.0, 0.0, 1.0);
}
#if defined(SCREEN_UV_USED)
vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
#endif
{
float normal_depth = 1.0;
@ -515,18 +477,14 @@ FRAGMENT_SHADER_CODE
#if defined(NORMALMAP_USED)
normal = mix(vec3(0.0, 0.0, 1.0), normal_map * vec3(2.0, -2.0, 1.0) - vec3(1.0, -1.0, 0.0), normal_depth);
#endif
}
#ifdef DEBUG_ENCODED_32
highp float enc32 = dot(color, highp vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1));
color = vec4(vec3(enc32), 1.0);
#endif
color *= final_modulate;
#ifdef USE_LIGHTING
vec2 light_vec = transformed_light_uv;
@ -600,10 +558,8 @@ FRAGMENT_SHADER_CODE
point = vec2(-light_vec.y, light_vec.x);
sh = 0.75 + (1.0 / 8.0);
}
highp vec4 s = shadow_matrix * vec4(point, 0.0, 1.0);
s.xyz /= s.w;
su = s.x * 0.5 + 0.5;
@ -622,26 +578,30 @@ FRAGMENT_SHADER_CODE
#endif
#ifdef SHADOW_USE_GRADIENT
#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture,vec2(m_ofs,sh)); shadow_attenuation+=1.0-smoothstep(sd,sd+shadow_gradient,sz); }
#define SHADOW_TEST(m_ofs) \
{ \
highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \
shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); \
}
#else
#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture,vec2(m_ofs,sh)); shadow_attenuation+=step(sz,sd); }
#define SHADOW_TEST(m_ofs) \
{ \
highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \
shadow_attenuation += step(sz, sd); \
}
#endif
#ifdef SHADOW_FILTER_NEAREST
SHADOW_TEST(su);
#endif
#ifdef SHADOW_FILTER_PCF3
SHADOW_TEST(su + shadowpixel_size);
@ -651,7 +611,6 @@ FRAGMENT_SHADER_CODE
#endif
#ifdef SHADOW_FILTER_PCF5
SHADOW_TEST(su + shadowpixel_size * 2.0);
@ -663,7 +622,6 @@ FRAGMENT_SHADER_CODE
#endif
#ifdef SHADOW_FILTER_PCF7
SHADOW_TEST(su + shadowpixel_size * 3.0);
@ -677,7 +635,6 @@ FRAGMENT_SHADER_CODE
#endif
#ifdef SHADOW_FILTER_PCF9
SHADOW_TEST(su + shadowpixel_size * 4.0);
@ -722,5 +679,4 @@ FRAGMENT_SHADER_CODE
#endif
//color.rgb *= color.a;
frag_color = color;
}

View file

@ -1,7 +1,5 @@
[vertex]
uniform highp mat4 projection_matrix;
uniform highp mat4 light_matrix;
uniform highp mat4 world_matrix;
@ -22,18 +20,14 @@ void main() {
in highp vec4 position_interp;
#ifdef USE_RGBA_SHADOWS
layout(location = 0) out lowp vec4 distance_buf;
#else
layout(location = 0) out highp float distance_buf;
#endif
void main() {
highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0;//bias;
highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias
#ifdef USE_RGBA_SHADOWS
@ -43,7 +37,5 @@ void main() {
#else
distance_buf = depth;
#endif
}

View file

@ -1,6 +1,5 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
layout(location = 4) in vec3 cube_in;
@ -44,7 +43,6 @@ void main() {
uv_interp = copy_section.xy + uv_interp * copy_section.zw;
gl_Position.xy = (copy_section.xy + (gl_Position.xy * 0.5 + 0.5) * copy_section.zw) * 2.0 - 1.0;
#endif
}
[fragment]
@ -72,7 +70,6 @@ uniform samplerCube source_cube; //texunit:0
uniform sampler2D source; //texunit:0
#endif
#ifdef USE_MULTIPLIER
uniform float multiplier;
#endif
@ -83,8 +80,7 @@ vec4 texturePanorama(vec3 normal,sampler2D pano ) {
vec2 st = vec2(
atan(normal.x, normal.z),
acos(normal.y)
);
acos(normal.y));
if (st.x < 0.0)
st.x += M_PI * 2.0;
@ -92,18 +88,15 @@ vec4 texturePanorama(vec3 normal,sampler2D pano ) {
st /= vec2(M_PI * 2.0, M_PI);
return textureLod(pano, st, 0.0);
}
#endif
uniform float stuff;
uniform vec2 pixel_size;
in vec2 uv2_interp;
#ifdef USE_BCS
uniform vec3 bcs;
@ -118,9 +111,6 @@ uniform sampler2D color_correction; //texunit:1
layout(location = 0) out vec4 frag_color;
void main() {
//vec4 color = color_interp;
@ -151,8 +141,6 @@ void main() {
vec4 color = textureLod(source, uv_interp, 0.0);
#endif
#ifdef LINEAR_TO_SRGB
//regular Linear -> SRGB conversion
vec3 a = vec3(0.055);
@ -173,7 +161,6 @@ void main() {
color.a = 1.0;
#endif
#ifdef GAUSSIAN_HORIZONTAL
color *= 0.38774;
color += texture(source, uv_interp + vec2(1.0, 0.0) * pixel_size) * 0.24477;
@ -210,4 +197,3 @@ void main() {
#endif
frag_color = color;
}

View file

@ -1,6 +1,5 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
layout(location = 4) in vec2 uv_in;
@ -14,7 +13,6 @@ void main() {
[fragment]
uniform highp samplerCube source_cube; //texunit:0
in vec2 uv_interp;
@ -39,11 +37,11 @@ void main() {
normal.z = 0.5 - 0.5 * ((normal.x * normal.x) + (normal.y * normal.y));
normal = normalize(normal);
/*
normal.z = 0.5;
normal = normalize(normal);
*/
if (!z_flip) {
normal.z = -normal.z;
}
@ -71,9 +69,7 @@ void main() {
float depth_fix = 1.0 / dot(normal, unorm);
depth = 2.0 * depth - 1.0;
float linear_depth = 2.0 * z_near * z_far / (z_far + z_near - depth * (z_far - z_near));
gl_FragDepth = (linear_depth * depth_fix + bias) / z_far;
}

View file

@ -1,6 +1,5 @@
[vertex]
layout(location = 0) in highp vec2 vertex;
layout(location = 4) in highp vec2 uv;
@ -15,7 +14,6 @@ void main() {
[fragment]
precision highp float;
precision highp int;
@ -36,15 +34,11 @@ uniform int face_id;
uniform float roughness;
in highp vec2 uv_interp;
layout(location = 0) out vec4 frag_color;
#define M_PI 3.14159265359
vec3 texelCoordToVec(vec2 uv, int faceID)
{
vec3 texelCoordToVec(vec2 uv, int faceID) {
mat3 faceUvVectors[6];
/*
// -x
@ -113,8 +107,7 @@ vec3 texelCoordToVec(vec2 uv, int faceID)
return normalize(result);
}
vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N)
{
vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N) {
float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph]
// Compute distribution direction
@ -137,15 +130,13 @@ vec3 ImportanceSampleGGX(vec2 Xi, float Roughness, vec3 N)
}
// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html
float GGX(float NdotV, float a)
{
float GGX(float NdotV, float a) {
float k = a / 2.0;
return NdotV / (NdotV * (1.0 - k) + k);
}
// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html
float G_Smith(float a, float nDotV, float nDotL)
{
float G_Smith(float a, float nDotV, float nDotL) {
return GGX(nDotL, a * a) * GGX(nDotV, a * a);
}
@ -162,8 +153,6 @@ vec2 Hammersley(uint i, uint N) {
return vec2(float(i) / float(N), radicalInverse_VdC(i));
}
#ifdef LOW_QUALITY
#define SAMPLE_COUNT 64u
@ -182,8 +171,7 @@ vec4 texturePanorama(vec3 normal,sampler2D pano ) {
vec2 st = vec2(
atan(normal.x, normal.z),
acos(normal.y)
);
acos(normal.y));
if (st.x < 0.0)
st.x += M_PI * 2.0;
@ -191,14 +179,12 @@ vec4 texturePanorama(vec3 normal,sampler2D pano ) {
st /= vec2(M_PI * 2.0, M_PI);
return textureLod(pano, st, 0.0);
}
#endif
#ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY
vec4 textureDualParaboloidArray(vec3 normal) {
vec3 norm = normalize(normal);
@ -208,7 +194,6 @@ vec4 textureDualParaboloidArray(vec3 normal) {
norm.y = 0.5 - norm.y + 0.5;
}
return textureLod(source_dual_paraboloid_array, vec3(norm.xy, float(source_array_index)), 0.0);
}
#endif
@ -226,7 +211,6 @@ void main() {
N.z = -N.z;
}
#else
vec2 uv = (uv_interp * 2.0) - 1.0;
vec3 N = texelCoordToVec(uv, face_id);
@ -251,9 +235,6 @@ void main() {
frag_color = vec4(texture(N, source_cube).rgb, 1.0);
#endif
#else
vec4 sum = vec4(0.0, 0.0, 0.0, 0.0);
@ -289,6 +270,4 @@ void main() {
frag_color = vec4(sum.rgb, 1.0);
#endif
}

View file

@ -1,6 +1,5 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
layout(location = 4) in vec2 uv_in;
@ -39,7 +38,6 @@ uniform sampler2D source_ssao; //texunit:1
uniform float lod;
uniform vec2 pixel_size;
layout(location = 0) out vec4 frag_color;
#ifdef SSAO_MERGE
@ -88,7 +86,6 @@ uniform sampler2D source_dof_original; //texunit:2
#endif
#ifdef GLOW_FIRST_PASS
uniform float exposure;
@ -112,8 +109,6 @@ uniform float camera_z_near;
void main() {
#ifdef GAUSSIAN_HORIZONTAL
vec2 pix_size = pixel_size;
pix_size *= 0.5; //reading from larger buffer, so use more samples
@ -198,8 +193,6 @@ void main() {
k_accum += tap_k * tap_amount;
color_accum += tap_color * tap_amount;
}
if (k_accum > 0.0) {
@ -245,12 +238,10 @@ void main() {
max_accum = max(max_accum, tap_amount * ofs_influence);
color_accum += tap_color * tap_k;
}
color_accum.a = max(color_accum.a, sqrt(max_accum));
#ifdef DOF_NEAR_BLUR_MERGE
vec4 original = textureLod(source_dof_original, uv_interp, 0.0);
@ -265,8 +256,6 @@ void main() {
#endif
#ifdef GLOW_FIRST_PASS
#ifdef GLOW_USE_AUTO_EXPOSURE
@ -282,7 +271,6 @@ void main() {
#endif
#ifdef SIMPLE_COPY
vec4 color = textureLod(source_color, uv_interp, 0.0);
frag_color = color;
@ -296,6 +284,4 @@ void main() {
frag_color = vec4(mix(color.rgb, color.rgb * mix(ssao_color.rgb, vec3(1.0), ssao), color.a), 1.0);
#endif
}

View file

@ -1,18 +1,14 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
void main() {
gl_Position = vertex_attrib;
}
[fragment]
uniform highp sampler2D source_exposure; //texunit:0
#ifdef EXPOSURE_BEGIN
@ -33,15 +29,10 @@ uniform highp float max_luminance;
layout(location = 0) out highp float exposure;
void main() {
#ifdef EXPOSURE_BEGIN
ivec2 src_pos = ivec2(gl_FragCoord.xy) * source_render_size / target_size;
#if 1
@ -87,12 +78,7 @@ void main() {
#endif //EXPOSURE_FORCE_SET
#endif //EXPOSURE_END
#endif //EXPOSURE_BEGIN
}

View file

@ -1,7 +1,5 @@
[vertex]
layout(location = 0) in highp vec4 color;
layout(location = 1) in highp vec4 velocity_active;
layout(location = 2) in highp vec4 custom;
@ -9,7 +7,6 @@ layout(location=3) in highp vec4 xform_1;
layout(location = 4) in highp vec4 xform_2;
layout(location = 5) in highp vec4 xform_3;
struct Attractor {
vec3 pos;
@ -39,7 +36,6 @@ uniform float lifetime;
uniform mat4 emission_transform;
uniform uint random_seed;
out highp vec4 out_color; //tfb:
out highp vec4 out_velocity_active; //tfb:
out highp vec4 out_custom; //tfb:
@ -47,7 +43,6 @@ out highp vec4 out_xform_1; //tfb:
out highp vec4 out_xform_2; //tfb:
out highp vec4 out_xform_3; //tfb:
#if defined(USE_MATERIAL)
layout(std140) uniform UniformData { //ubo:0
@ -58,7 +53,6 @@ MATERIAL_UNIFORMS
#endif
VERTEX_SHADER_GLOBALS
uint hash(uint x) {
@ -69,7 +63,6 @@ uint hash(uint x) {
return x;
}
void main() {
#ifdef PARTICLES_COPY
@ -160,8 +153,7 @@ void main() {
vec4(1.0, 0.0, 0.0, 0.0),
vec4(0.0, 1.0, 0.0, 0.0),
vec4(0.0, 0.0, 1.0, 0.0),
vec4(0.0,0.0,0.0,1.0)
);
vec4(0.0, 0.0, 0.0, 1.0));
} else {
out_color = color;
out_velocity_active = velocity_active;
@ -200,7 +192,6 @@ VERTEX_SHADER_CODE
force += attractors[i].strength * rel_vec * attenuation * mass;
} else {
force += attractors[i].strength * attractors[i].dir * attenuation * mass;
}
}
@ -228,14 +219,12 @@ VERTEX_SHADER_CODE
out_xform_3 = xform[2];
#endif //PARTICLES_COPY
}
[fragment]
// any code here is never executed, stuff is filled just so it works
#if defined(USE_MATERIAL)
layout(std140) uniform UniformData {

View file

@ -1,12 +1,10 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
void main() {
uv_interp = uv_in;
@ -34,11 +32,9 @@ void main() {
vec4 specular = texture(source_specular, uv_interp);
#ifdef USE_SSR
vec4 ssr = textureLod(source_ssr, uv_interp, 0.0);
specular.rgb = mix(specular.rgb, ssr.rgb * specular.a, ssr.a);
#endif
frag_color = vec4(specular.rgb, 1.0);
}

View file

@ -18,7 +18,6 @@ ARRAY_INDEX=8,
// hack to use uv if no uv present so it works with lightmap
/* INPUT ATTRIBS */
layout(location = 0) in highp vec4 vertex_attrib;
@ -102,12 +101,10 @@ layout(std140) uniform SceneData { //ubo:0
highp float fog_height_min;
highp float fog_height_max;
highp float fog_height_curve;
};
uniform highp mat4 world_transform;
#ifdef USE_LIGHT_DIRECTIONAL
layout(std140) uniform DirectionalLightData { //ubo:3
@ -139,10 +136,8 @@ struct LightData {
mediump vec4 light_clamp;
mediump vec4 shadow_color_contact;
highp mat4 shadow_matrix;
};
layout(std140) uniform OmniLightData { //ubo:4
LightData omni_lights[MAX_LIGHT_DATA_STRUCTS];
@ -155,7 +150,6 @@ layout(std140) uniform SpotLightData { //ubo:5
#ifdef USE_FORWARD_LIGHTING
uniform int omni_light_indices[MAX_FORWARD_LIGHTS];
uniform int omni_light_count;
@ -178,7 +172,6 @@ void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color, float roughness, ino
float dotNH = max(dot(N, H), 0.0);
float intensity = (roughness >= 1.0 ? 1.0 : pow(dotNH, (1.0 - roughness) * 256.0));
specular += light_color * intensity;
}
}
@ -190,7 +183,6 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal, float ro
vec3 light_attenuation = vec3(pow(max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w));
light_compute(normal, normalize(light_rel_vec), eye_vec, omni_lights[idx].light_color_energy.rgb * light_attenuation, roughness, diffuse, specular);
}
void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, float roughness, inout vec3 diffuse, inout vec3 specular) {
@ -205,11 +197,9 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, float r
float spot_rim = (1.0 - scos) / (1.0 - spot_cutoff);
light_attenuation *= 1.0 - pow(max(spot_rim, 0.001), spot_lights[idx].light_params.x);
light_compute(normal, normalize(light_rel_vec), eye_vec, spot_lights[idx].light_color_energy.rgb * light_attenuation, roughness, diffuse, specular);
}
#endif
/* Varyings */
@ -229,13 +219,11 @@ out vec2 uv_interp;
out vec2 uv2_interp;
#endif
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
out vec3 tangent_interp;
out vec3 binormal_interp;
#endif
#if defined(USE_MATERIAL)
layout(std140) uniform UniformData { // ubo:1
@ -272,7 +260,6 @@ void main() {
mat4 world_matrix = world_transform;
#ifdef USE_INSTANCING
{
@ -283,7 +270,6 @@ void main() {
vec3 normal = normal_attrib * normal_mult;
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
vec3 tangent = tangent_attrib.xyz;
tangent *= normal_mult;
@ -298,7 +284,6 @@ void main() {
#endif
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
vec3 binormal = normalize(cross(normal, tangent) * binormalf);
@ -345,43 +330,42 @@ void main() {
#define projection_matrix local_projection
#define world_transform world_matrix
#ifdef USE_SKELETON
{
//skeleton transform
ivec4 bone_indicesi = ivec4(bone_indices); // cast to signed int
ivec2 tex_ofs = ivec2(bone_indicesi.x % 256, (bone_indicesi.x / 256) * 3);
highp mat3x4 m = mat3x4(
highp mat3x4 m;
m = mat3x4(
texelFetch(skeleton_texture, tex_ofs, 0),
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
) * bone_weights.x;
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0))
* bone_weights.x;
tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 3);
m += mat3x4(
texelFetch(skeleton_texture, tex_ofs, 0),
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
) * bone_weights.y;
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0))
* bone_weights.y;
tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 3);
m += mat3x4(
texelFetch(skeleton_texture, tex_ofs, 0),
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
) * bone_weights.z;
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0))
* bone_weights.z;
tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 3);
m += mat3x4(
texelFetch(skeleton_texture, tex_ofs, 0),
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
texelFetch(skeleton_texture,tex_ofs+ivec2(0,2),0)
) * bone_weights.w;
texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0))
* bone_weights.w;
mat4 bone_matrix = transpose(mat4(m[0], m[1], m[2], vec4(0.0, 0.0, 0.0, 1.0)));
@ -396,8 +380,6 @@ VERTEX_SHADER_CODE
}
// using local coordinates (default)
#if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
@ -433,16 +415,13 @@ VERTEX_SHADER_CODE
vertex_interp = vertex.xyz;
normal_interp = normal;
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
tangent_interp = tangent;
binormal_interp = binormal;
#endif
#ifdef RENDER_DEPTH
#ifdef RENDER_DEPTH_DUAL_PARABOLOID
vertex_interp.z *= shadow_dual_paraboloid_render_side;
@ -461,7 +440,6 @@ VERTEX_SHADER_CODE
vertex_interp = vtx;
#else
float z_ofs = z_offset;
@ -520,12 +498,9 @@ VERTEX_SHADER_CODE
#endif //USE_LIGHT_DIRECTIONAL
#endif // USE_VERTEX_LIGHTING
}
[fragment]
/* texture unit usage, N is max_texture_unity-N
@ -569,13 +544,10 @@ in vec3 binormal_interp;
in highp vec3 vertex_interp;
in vec3 normal_interp;
/* PBR CHANNELS */
#ifdef USE_RADIANCE_MAP
layout(std140) uniform Radiance { // ubo:2
mat4 radiance_inverse_xform;
@ -634,8 +606,6 @@ vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec,float p_roughness) {
/* Material Uniforms */
#if defined(USE_MATERIAL)
layout(std140) uniform UniformData {
@ -712,7 +682,6 @@ layout(std140) uniform DirectionalLightData {
mediump vec4 shadow_split_offsets;
};
uniform highp sampler2DShadow directional_shadow; // texunit:-4
#endif
@ -735,7 +704,6 @@ struct LightData {
};
layout(std140) uniform OmniLightData { // ubo:4
LightData omni_lights[MAX_LIGHT_DATA_STRUCTS];
@ -746,10 +714,8 @@ layout(std140) uniform SpotLightData { //ubo:5
LightData spot_lights[MAX_LIGHT_DATA_STRUCTS];
};
uniform highp sampler2DShadow shadow_atlas; // texunit:-5
struct ReflectionData {
mediump vec4 box_extents;
@ -767,7 +733,6 @@ layout(std140) uniform ReflectionProbeData { //ubo:6
};
uniform mediump sampler2D reflection_atlas; // texunit:-3
#ifdef USE_FORWARD_LIGHTING
uniform int omni_light_indices[MAX_FORWARD_LIGHTS];
@ -781,7 +746,6 @@ uniform int reflection_count;
#endif
#if defined(SCREEN_TEXTURE_USED)
uniform highp sampler2D screen_texture; // texunit:-7
@ -825,22 +789,20 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
if (length(screen_rel) < 0.00001)
return 1.0; // too small, don't do anything
/*float pixel_size; //approximate pixel size
/*
float pixel_size; // approximate pixel size
if (screen_rel.x > screen_rel.y) {
pixel_size = abs((pos.x - endpoint.x) / (screen_rel.x / screen_pixel_size.x));
} else {
pixel_size = abs((pos.y - endpoint.y) / (screen_rel.y / screen_pixel_size.y));
}*/
vec4 bias = projection_matrix * vec4(pos+vec3(0.0,0.0,max_distance*0.5), 1.0); //todo un-harcode the 0.04
}
*/
vec4 bias = projection_matrix * vec4(pos + vec3(0.0, 0.0, max_distance * 0.5), 1.0);
vec2 pixel_incr = normalize(screen_rel) * screen_pixel_size;
float steps = length(screen_rel) / length(pixel_incr);
steps = min(2000.0, steps); // put a limit to avoid freezing in some strange situation
//steps = 10.0;
@ -864,7 +826,6 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
}
}
ratio += ratio_incr;
steps -= 1.0;
}
@ -874,7 +835,6 @@ float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) {
#endif
// This returns the G_GGX function divided by 2 cos_theta_m, where in practice cos_theta_m is either N.L or N.V.
// We're dividing this factor off because the overall term we'll end up looks like
// (see, for example, the first unnumbered equation in B. Burley, "Physically Based Shading at Disney", SIGGRAPH 2012):
@ -927,16 +887,13 @@ float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float c
return 1.0 / max(M_PI * alpha_x * alpha_y * d * d, 0.001);
}
float SchlickFresnel(float u)
{
float SchlickFresnel(float u) {
float m = 1.0 - u;
float m2 = m * m;
return m2 * m2 * m; // pow(m,5)
}
float GTR1(float NdotH, float a)
{
float GTR1(float NdotH, float a) {
if (a >= 1.0) return 1.0 / M_PI;
float a2 = a * a;
float t = 1.0 + (a2 - 1.0) * NdotH * NdotH;
@ -961,7 +918,6 @@ void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec
LIGHT_SHADER_CODE
#else
float NdotL = dot(N, L);
float cNdotL = max(NdotL, 0.0); // clamped NdotL
@ -975,7 +931,6 @@ LIGHT_SHADER_CODE
float diffuse_brdf_NL; // BRDF times N.L for calculating diffuse radiance
#endif
#if defined(DIFFUSE_LAMBERT_WRAP)
// energy conserving lambert wrap shader
diffuse_brdf_NL = max(0.0, (NdotL + roughness) / ((1.0 + roughness) * (1.0 + roughness)));
@ -986,7 +941,6 @@ LIGHT_SHADER_CODE
// see http://mimosa-pudica.net/improved-oren-nayar.html
float LdotV = dot(L, V);
float s = LdotV - NdotL * NdotV;
float t = mix(1.0, max(NdotL, NdotV), step(0.0, s));
@ -1005,7 +959,6 @@ LIGHT_SHADER_CODE
{
vec3 H = normalize(V + L);
float cLdotH = max(0.0, dot(L, H));
@ -1021,7 +974,8 @@ LIGHT_SHADER_CODE
float lightScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotL, 5.0);
float viewScatter = f0 + (fd90 - f0) * pow(1.0 - cNdotV, 5.0);
diffuse_brdf_NL = lightScatter * viewScatter * energyFactor;*/
diffuse_brdf_NL = lightScatter * viewScatter * energyFactor;
*/
}
#else
// lambert
@ -1034,17 +988,14 @@ LIGHT_SHADER_CODE
diffuse_light += light_color * diffuse_color * (vec3(1.0 / M_PI) - diffuse_brdf_NL) * transmission * attenuation;
#endif
#if defined(LIGHT_USE_RIM)
float rim_light = pow(max(0.0, 1.0 - cNdotV), max(0.0, (1.0 - roughness) * 16.0));
diffuse_light += rim_light * rim * mix(vec3(1.0), diffuse_color, rim_tint) * light_color;
#endif
}
if (roughness > 0.0) { // FIXME: roughness == 0 should not disable specular light entirely
// D
#if defined(SPECULAR_BLINN)
@ -1122,7 +1073,6 @@ LIGHT_SHADER_CODE
float Fr = mix(.04, 1.0, cLdotH5);
float Gr = G_GGX_2cos(cNdotL, .25) * G_GGX_2cos(cNdotV, .25);
float specular_brdf_NL = 0.25 * clearcoat * Gr * Fr * Dr * cNdotL;
specular_light += specular_brdf_NL * light_color * specular_blob_intensity * attenuation;
@ -1130,11 +1080,9 @@ LIGHT_SHADER_CODE
#endif
}
#endif //defined(USE_LIGHT_SHADER_CODE)
}
float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 pos, float depth, vec4 clamp_rect) {
#ifdef SHADOW_MODE_PCF_13
@ -1168,7 +1116,6 @@ float sample_shadow(highp sampler2DShadow shadow, vec2 shadow_pixel_size, vec2 p
return textureProj(shadow, vec4(pos, depth, 1.0));
#endif
}
#ifdef RENDER_DEPTH_DUAL_PARABOLOID
@ -1177,11 +1124,8 @@ in highp float dp_clip;
#endif
#if 0
// need to save texture depth for this
vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 pos, float distance) {
float scale = 8.25 * (1.0 - translucency) / subsurface_scatter_width;
@ -1193,7 +1137,8 @@ vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 po
* (It can be precomputed into a texture, for maximum performance):
*/
float dd = -d * d;
vec3 profile = vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) +
vec3 profile =
vec3(0.233, 0.455, 0.649) * exp(dd / 0.0064) +
vec3(0.1, 0.336, 0.344) * exp(dd / 0.0484) +
vec3(0.118, 0.198, 0.0) * exp(dd / 0.187) +
vec3(0.113, 0.007, 0.007) * exp(dd / 0.567) +
@ -1242,7 +1187,6 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino
clamp_rect.y += clamp_rect.w;
}
*/
}
splane.xy /= splane.z;
@ -1258,15 +1202,12 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino
float contact_shadow = contact_shadow_compute(vertex, normalize(light_rel_vec), min(light_length, omni_lights[idx].shadow_color_contact.a));
shadow = min(shadow, contact_shadow);
}
#endif
light_attenuation *= mix(omni_lights[idx].shadow_color_contact.rgb, vec3(1.0), shadow);
}
#endif //SHADOWS_DISABLED
light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, omni_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, omni_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, rim * omni_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
}
void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent, vec3 albedo, vec3 transmission, float roughness, float metallic, float rim, float rim_tint, float clearcoat, float clearcoat_gloss, float anisotropy, float p_blob_intensity, inout vec3 diffuse_light, inout vec3 specular_light) {
@ -1295,7 +1236,6 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
float contact_shadow = contact_shadow_compute(vertex, normalize(light_rel_vec), min(light_length, spot_lights[idx].shadow_color_contact.a));
shadow = min(shadow, contact_shadow);
}
#endif
light_attenuation *= mix(spot_lights[idx].shadow_color_contact.rgb, vec3(1.0), shadow);
@ -1303,7 +1243,6 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi
#endif //SHADOWS_DISABLED
light_compute(normal, normalize(light_rel_vec), eye_vec, binormal, tangent, spot_lights[idx].light_color_energy.rgb, light_attenuation, albedo, transmission, spot_lights[idx].light_params.z * p_blob_intensity, roughness, metallic, rim * spot_attenuation, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
}
void reflection_process(int idx, vec3 vertex, vec3 normal, vec3 binormal, vec3 tangent, float roughness, float anisotropy, vec3 ambient, vec3 skybox, inout highp vec4 reflection_accum, inout highp vec4 ambient_accum) {
@ -1333,7 +1272,6 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta
vec3 rbmax = (box_extents - local_pos) / nrdir;
vec3 rbmin = (-box_extents - local_pos) / nrdir;
vec3 rbminmax = mix(rbmin, rbmax, greaterThan(nrdir, vec3(0.0, 0.0, 0.0)));
float fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z);
@ -1341,7 +1279,6 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta
local_ref_vec = posonbox - reflections[idx].box_offset.xyz;
}
vec4 clamp_rect = reflections[idx].atlas_clamp;
vec3 norm = normalize(local_ref_vec);
norm.xy /= 1.0 + abs(norm.z);
@ -1368,7 +1305,6 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta
#ifndef USE_LIGHTMAP
if (reflections[idx].ambient.a > 0.0) { //compute ambient using skybox
vec3 local_amb_vec = (reflections[idx].local_matrix * vec4(normal, 0.0)).xyz;
vec3 splane = normalize(local_amb_vec);
@ -1409,7 +1345,6 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta
}
ambient_out.rgb *= ambient_out.a;
ambient_accum += ambient_out;
}
#endif
}
@ -1470,8 +1405,6 @@ vec3 voxel_cone_trace(mediump sampler3D probe, vec3 cell_size, vec3 pos, vec3 am
void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds, vec3 cell_size, vec3 pos, vec3 ambient, vec3 environment, bool blend_ambient, float multiplier, mat3 normal_mtx, vec3 ref_vec, float roughness, float p_bias, float p_normal_bias, inout vec4 out_spec, inout vec4 out_diff) {
vec3 probe_pos = (probe_xform * vec4(pos, 1.0)).xyz;
vec3 ref_pos = (probe_xform * vec4(pos + ref_vec, 1.0)).xyz;
ref_vec = normalize(ref_pos - probe_pos);
@ -1505,8 +1438,7 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec
vec3(0.267617, 0.823639, 0.5),
vec3(-0.700629, 0.509037, 0.5),
vec3(-0.700629, -0.509037, 0.5),
vec3(0.267617, -0.823639, 0.5)
);
vec3(0.267617, -0.823639, 0.5));
float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.15, 0.15, 0.15, 0.15, 0.15);
float cone_angle_tan = 0.577;
@ -1519,8 +1451,7 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec
vec3(0.707107, 0, 0.707107),
vec3(0, 0.707107, 0.707107),
vec3(-0.707107, 0, 0.707107),
vec3(0, -0.707107, 0.707107)
);
vec3(0, -0.707107, 0.707107));
float cone_weights[MAX_CONE_DIRS] = float[](0.25, 0.25, 0.25, 0.25);
float cone_angle_tan = 0.98269;
@ -1533,7 +1464,6 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec
vec3 dir = normalize((probe_xform * vec4(pos + normal_mtx * cone_dirs[i], 1.0)).xyz - probe_pos);
light += cone_weights[i] * voxel_cone_trace(probe, cell_size, probe_pos, ambient, blend_ambient, dir, cone_angle_tan, max_distance, p_bias);
}
light *= multiplier;
@ -1548,10 +1478,8 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec
//irr_light=vec3(0.0);
out_spec += vec4(irr_light * blend, blend);
}
void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_specular, inout vec3 out_ambient) {
roughness = roughness * roughness;
@ -1591,13 +1519,10 @@ void gi_probes_compute(vec3 pos, vec3 normal, float roughness, inout vec3 out_sp
out_specular += spec_accum.rgb;
out_ambient += diff_accum.rgb;
}
#endif
void main() {
#ifdef RENDER_DEPTH_DUAL_PARABOLOID
@ -1634,7 +1559,6 @@ void main() {
float side = 1.0;
#endif
#if defined(ALPHA_SCISSOR_USED)
float alpha_scissor = 0.5;
#endif
@ -1677,12 +1601,10 @@ void main() {
{
FRAGMENT_SHADER_CODE
}
#if defined(ALPHA_SCISSOR_USED)
if (alpha < alpha_scissor) {
discard;
@ -1745,8 +1667,6 @@ FRAGMENT_SHADER_CODE
vec3 eye_vec = -normalize(vertex_interp);
#ifdef USE_RADIANCE_MAP
#ifdef AMBIENT_LIGHT_DISABLED
@ -1760,11 +1680,9 @@ FRAGMENT_SHADER_CODE
ref_vec = normalize((radiance_inverse_xform * vec4(ref_vec, 0.0)).xyz);
vec3 radiance = textureDualParaboloid(radiance_map, ref_vec, roughness) * bg_energy;
env_reflection_light = radiance;
}
//no longer a cubemap
//vec3 radiance = textureLod(radiance_cube, r, lod).xyz * ( brdf.x + brdf.y);
}
#ifndef USE_LIGHTMAP
{
@ -1820,10 +1738,8 @@ FRAGMENT_SHADER_CODE
bool use_blend = true;
#endif
#ifdef LIGHT_USE_PSSM4
if (depth_z < shadow_split_offsets.y) {
if (depth_z < shadow_split_offsets.x) {
@ -1831,7 +1747,6 @@ FRAGMENT_SHADER_CODE
highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0));
pssm_coord = splane.xyz / splane.w;
#if defined(LIGHT_USE_PSSM_BLEND)
splane = (shadow_matrix2 * vec4(vertex, 1.0));
@ -1849,11 +1764,9 @@ FRAGMENT_SHADER_CODE
pssm_coord2 = splane.xyz / splane.w;
pssm_blend = smoothstep(shadow_split_offsets.x, shadow_split_offsets.y, depth_z);
#endif
}
} else {
if (depth_z < shadow_split_offsets.z) {
highp vec4 splane = (shadow_matrix3 * vec4(vertex, 1.0));
@ -1875,12 +1788,9 @@ FRAGMENT_SHADER_CODE
use_blend = false;
#endif
}
}
#endif //LIGHT_USE_PSSM4
#ifdef LIGHT_USE_PSSM2
@ -1890,7 +1800,6 @@ FRAGMENT_SHADER_CODE
highp vec4 splane = (shadow_matrix1 * vec4(vertex, 1.0));
pssm_coord = splane.xyz / splane.w;
#if defined(LIGHT_USE_PSSM_BLEND)
splane = (shadow_matrix2 * vec4(vertex, 1.0));
@ -1906,7 +1815,6 @@ FRAGMENT_SHADER_CODE
use_blend = false;
#endif
}
#endif //LIGHT_USE_PSSM2
@ -1918,7 +1826,6 @@ FRAGMENT_SHADER_CODE
}
#endif
//one one sample
float shadow = sample_shadow(directional_shadow, directional_shadow_pixel_size, pssm_coord.xy, pssm_coord.z, light_clamp);
@ -1935,15 +1842,11 @@ FRAGMENT_SHADER_CODE
float contact_shadow = contact_shadow_compute(vertex, -light_direction_attenuation.xyz, shadow_color_contact.a);
shadow = min(shadow, contact_shadow);
}
#endif
light_attenuation = mix(mix(shadow_color_contact.rgb, vec3(1.0), shadow), vec3(1.0), pssm_fade);
}
#endif // !defined(SHADOWS_DISABLED)
#endif //LIGHT_DIRECTIONAL_SHADOW
@ -1955,7 +1858,6 @@ FRAGMENT_SHADER_CODE
light_compute(normal, -light_direction_attenuation.xyz, eye_vec, binormal, tangent, light_color_energy.rgb, light_attenuation, albedo, transmission, light_params.z * specular_blob_intensity, roughness, metallic, rim, rim_tint, clearcoat, clearcoat_gloss, anisotropy, diffuse_light, specular_light);
#endif
#endif //#USE_LIGHT_DIRECTIONAL
#ifdef USE_GI_PROBES
@ -1981,9 +1883,7 @@ FRAGMENT_SHADER_CODE
vec3(0.267617, 0.823639, -0.5),
vec3(-0.700629, 0.509037, -0.5),
vec3(-0.700629, -0.509037, -0.5),
vec3(0.267617, -0.823639, -0.5)
);
vec3(0.267617, -0.823639, -0.5));
vec3 local_normal = normalize(camera_matrix * vec4(normal, 0.0)).xyz;
vec4 captured = vec4(0.0);
@ -2001,13 +1901,11 @@ FRAGMENT_SHADER_CODE
} else {
ambient_light = captured.rgb;
}
}
#endif
#ifdef USE_FORWARD_LIGHTING
highp vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0);
highp vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0);
for (int i = 0; i < reflection_count; i++) {
@ -2025,7 +1923,6 @@ FRAGMENT_SHADER_CODE
}
#endif
#ifdef USE_VERTEX_LIGHTING
diffuse_light *= albedo;
@ -2043,9 +1940,6 @@ FRAGMENT_SHADER_CODE
#endif
#ifdef RENDER_DEPTH
//nothing happens, so a tree-ssa optimizer will result in no fragment shader :)
#else
@ -2060,13 +1954,10 @@ FRAGMENT_SHADER_CODE
diffuse_light *= ao_light_affect;
#endif
//energy conservation
diffuse_light *= 1.0 - metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point
ambient_light *= 1.0 - metallic;
{
#if defined(DIFFUSE_TOON)
@ -2085,15 +1976,12 @@ FRAGMENT_SHADER_CODE
vec3 specular_color = metallic_to_specular_color(metallic, specular, albedo);
specular_light *= AB.x * specular_color + AB.y;
#endif
}
if (fog_color_enabled.a > 0.5) {
float fog_amount = 0.0;
#ifdef USE_LIGHT_DIRECTIONAL
vec3 fog_color = mix(fog_color_enabled.rgb, fog_sun_color_amount.rgb, fog_sun_color_amount.a * pow(max(dot(normalize(vertex), -light_direction_attenuation.xyz), 0.0), 8.0));
@ -2123,25 +2011,20 @@ FRAGMENT_SHADER_CODE
float rev_amount = 1.0 - fog_amount;
emission = emission * rev_amount + fog_color * fog_amount;
ambient_light *= rev_amount;
specular_light *rev_amount;
diffuse_light *= rev_amount;
}
#ifdef USE_MULTIPLE_RENDER_TARGETS
#ifdef SHADELESS
diffuse_buffer = vec4(albedo.rgb, 0.0);
specular_buffer = vec4(0.0);
#else
//approximate ambient scale for SSAO, since we will lack full ambient
float max_emission = max(emission.r, max(emission.g, emission.b));
float max_ambient = max(ambient_light.r, max(ambient_light.g, ambient_light.b));
@ -2163,10 +2046,8 @@ FRAGMENT_SHADER_CODE
sss_buffer = sss_strength;
#endif
#else //USE_MULTIPLE_RENDER_TARGETS
#ifdef SHADELESS
frag_color = vec4(albedo, alpha);
#else
@ -2175,9 +2056,5 @@ FRAGMENT_SHADER_CODE
#endif //USE_MULTIPLE_RENDER_TARGETS
#endif //RENDER_DEPTH
}

View file

@ -1,6 +1,5 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
layout(location = 4) in vec2 uv_in;
@ -16,7 +15,6 @@ void main() {
[fragment]
in vec2 uv_interp;
in vec2 pos_interp;
@ -40,10 +38,8 @@ uniform float depth_tolerance;
uniform float distance_fade;
uniform float curve_fade_in;
layout(location = 0) out vec4 frag_color;
vec2 view_to_screen(vec3 view_pos, out float w) {
vec4 projected = projection * vec4(view_pos, 1.0);
projected.xyz /= projected.w;
@ -52,20 +48,14 @@ vec2 view_to_screen(vec3 view_pos,out float w) {
return projected.xy;
}
#define M_PI 3.14159265359
void main() {
////
vec4 diffuse = texture(source_diffuse, uv_interp);
vec4 normal_roughness = texture(source_normal_roughness, uv_interp);
vec3 normal;
normal = normal_roughness.xyz * 2.0 - 1.0;
float roughness = normal_roughness.w;
@ -83,13 +73,10 @@ void main() {
return;
}
//ray_dir = normalize(view_dir - normal * dot(normal,view_dir) * 2.0);
//ray_dir = normalize(vec3(1, 1, -1));
////////////////
// make ray length and clip it against the near plane (don't want to trace beyond visible)
float ray_len = (vertex.z + ray_dir.z * camera_z_far) > -camera_z_near ? (-camera_z_near - vertex.z) / ray_dir.z : camera_z_far;
vec3 ray_end = vertex + ray_dir * ray_len;
@ -101,11 +88,9 @@ void main() {
vec2 vp_line_dir = vp_line_end - vp_line_begin;
// we need to interpolate w along the ray, to generate perspective correct reflections
w_begin = 1.0 / w_begin;
w_end = 1.0 / w_end;
float z_begin = vertex.z * w_begin;
float z_end = ray_end.z * w_end;
@ -114,7 +99,6 @@ void main() {
float z_dir = z_end - z_begin;
float w_dir = w_end - w_begin;
// clip the line to the viewport edges
float scale_max_x = min(1.0, 0.99 * (1.0 - vp_line_begin.x) / max(1e-5, vp_line_dir.x));
@ -182,14 +166,10 @@ void main() {
prev_pos = pos;
}
if (found) {
float margin_blend = 1.0;
vec2 margin = vec2((viewport_size.x + viewport_size.y) * 0.5 * 0.05); // make a uniform margin
if (any(bvec4(lessThan(pos, -margin), greaterThan(pos, viewport_size + margin)))) {
// clip outside screen + margin
@ -202,7 +182,6 @@ void main() {
vec2 margin_grad = mix(pos - viewport_size, -pos, lessThan(pos, vec2(0.0)));
margin_blend = 1.0 - smoothstep(0.0, margin.x, max(margin_grad.x, margin_grad.y));
//margin_blend = 1.0;
}
vec2 final_pos;
@ -212,15 +191,8 @@ void main() {
float fade = pow(clamp(1.0 - grad, 0.0, 1.0), distance_fade) * initial_fade;
final_pos = pos;
#ifdef REFLECT_ROUGHNESS
vec4 final_color;
// if roughness is enabled, do screen space cone tracing
if (roughness > 0.001) {
@ -261,8 +233,8 @@ void main() {
vec2 sample_pos = (line_begin + cone_dir * (cone_len - radius)) * pixel_size;
// radius is in pixels, so it's natural that log2(radius) maps to the right mipmap for the amount of pixels
float mipmap = clamp(log2(radius), 0.0, max_mipmap);
//mipmap = max(mipmap - 1.0, 0.0);
// do sampling
vec4 sample_color;
@ -293,8 +265,6 @@ void main() {
cone_len -= radius * 2.0; // go to next (smaller) circle.
gloss_mult *= gloss;
}
} else {
final_color = textureLod(source_diffuse, final_pos * pixel_size, 0.0);
@ -306,13 +276,7 @@ void main() {
frag_color = vec4(textureLod(source_diffuse, final_pos * pixel_size, 0.0).rgb, fade * margin_blend);
#endif
} else {
frag_color = vec4(0.0, 0.0, 0.0, 0.0);
}
}

View file

@ -1,6 +1,5 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
void main() {
@ -14,21 +13,15 @@ void main() {
#define TWO_PI 6.283185307179586476925286766559
#ifdef SSAO_QUALITY_HIGH
#define NUM_SAMPLES (80)
#endif
#ifdef SSAO_QUALITY_LOW
#define NUM_SAMPLES (15)
#endif
#if !defined(SSAO_QUALITY_LOW) && !defined(SSAO_QUALITY_HIGH)
#define NUM_SAMPLES (40)
#endif
// If using depth mip levels, the log of the maximum pixel offset before we need to switch to a lower
@ -43,7 +36,8 @@ void main() {
// This is the number of turns around the circle that the spiral pattern makes. This should be prime to prevent
// taps from lining up. This particular choice was tuned for NUM_SAMPLES == 9
const int ROTATIONS[] = int[]( 1, 1, 2, 3, 2, 5, 2, 3, 2,
const int ROTATIONS[] = int[](
1, 1, 2, 3, 2, 5, 2, 3, 2,
3, 3, 5, 5, 3, 4, 7, 5, 5, 7,
9, 8, 5, 5, 7, 7, 7, 8, 5, 8,
11, 12, 7, 10, 13, 8, 11, 8, 7, 14,
@ -52,7 +46,8 @@ const int ROTATIONS[] = int[]( 1, 1, 2, 3, 2, 5, 2, 3, 2,
13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
19, 27, 21, 25, 39, 29, 17, 21, 27 );
19, 27, 21, 25, 39, 29, 17, 21, 27
);
//#define NUM_SPIRAL_TURNS (7)
const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];
@ -111,8 +106,6 @@ vec3 reconstructCSFaceNormal(vec3 C) {
return normalize(cross(dFdy(C), dFdx(C)));
}
/** Returns a unit vector and a screen-space radius for the tap on a unit disk (the caller should scale by the actual disk radius) */
vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR) {
// Radius relative to ssR
@ -123,7 +116,6 @@ vec2 tapLocation(int sampleNumber, float spinAngle, out float ssR){
return vec2(cos(angle), sin(angle));
}
/** Read the camera-space position of the point at screen-space pixel ssP + unitOffset * ssR. Assumes length(unitOffset) == 1 */
vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
// Derivation:
@ -138,7 +130,6 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
// Manually clamp to the texture size because texelFetch bypasses the texture unit
ivec2 mipP = clamp(ssP >> mipLevel, ivec2(0), (screen_size >> mipLevel) - ivec2(1));
if (mipLevel < 1) {
//read from depth buffer
P.z = texelFetch(source_depth, mipP, 0).r;
@ -147,7 +138,6 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
P.z = ((P.z + (camera_z_far + camera_z_near) / (camera_z_far - camera_z_near)) * (camera_z_far - camera_z_near)) / 2.0;
#else
P.z = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - P.z * (camera_z_far - camera_z_near));
#endif
P.z = -P.z;
@ -157,15 +147,12 @@ vec3 getOffsetPosition(ivec2 ssC, vec2 unitOffset, float ssR) {
P.z = -(float(d) / 65535.0) * camera_z_far;
}
// Offset to pixel center
P = reconstructCSPosition(vec2(ssP) + vec2(0.5), P.z);
return P;
}
/** Compute the occlusion due to sample with index \a i about the pixel at \a ssC that corresponds
to camera-space point \a C with unit normal \a n_C, using maximum screen-space sampling radius \a ssDiskRadius
@ -209,22 +196,20 @@ float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius,in fl
// return 2.0 * float(vv < radius * radius) * max(vn - bias, 0.0);
}
void main() {
// Pixel being shaded
ivec2 ssC = ivec2(gl_FragCoord.xy);
// World space point being shaded
vec3 C = getPosition(ssC);
/* if (C.z <= -camera_z_far*0.999) {
/*
if (C.z <= -camera_z_far * 0.999) {
// We're on the skybox
visibility=1.0;
return;
}*/
}
*/
//visibility = -C.z / camera_z_far;
//return;
@ -286,8 +271,4 @@ void main() {
}
visibility = A;
}

View file

@ -1,9 +1,7 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
void main() {
gl_Position = vertex_attrib;
@ -12,15 +10,12 @@ void main() {
[fragment]
uniform sampler2D source_ssao; //texunit:0
uniform sampler2D source_depth; //texunit:1
uniform sampler2D source_normal; //texunit:3
layout(location = 0) out float visibility;
//////////////////////////////////////////////////////////////////////////////////////////////
// Tunable Parameters:
@ -110,9 +105,7 @@ void main() {
//weight *= max(0.0, dot(temp_normal, normal));
// range domain (the "bilateral" weight). As depth difference increases, decrease weight.
weight *= max(0.0, 1.0
- edge_sharpness * abs(temp_depth - depth)
);
weight *= max(0.0, 1.0 - edge_sharpness * abs(temp_depth - depth));
sum += value * weight;
totalWeight += weight;

View file

@ -1,6 +1,5 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
void main() {
@ -10,7 +9,6 @@ void main() {
[fragment]
#ifdef MINIFY_START
#define SDEPTH_TYPE highp sampler2D
@ -32,7 +30,6 @@ layout(location = 0) out mediump uint depth;
void main() {
ivec2 ssP = ivec2(gl_FragCoord.xy);
// Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.
@ -52,8 +49,4 @@ void main() {
#else
depth = texelFetch(source_depth, clamp(ssP * 2 + ivec2(ssP.y & 1, ssP.x & 1), ivec2(0), from_size - ivec2(1)), source_mipmap).r;
#endif
}

View file

@ -1,12 +1,10 @@
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
void main() {
uv_interp = uv_in;
@ -19,7 +17,6 @@ void main() {
#define QUALIFIER const
#ifdef USE_25_SAMPLES
const int kernel_size = 25;
QUALIFIER vec2 kernel[25] = vec2[] (
vec2(0.530605, 0.0),
@ -48,13 +45,10 @@ QUALIFIER vec2 kernel[25] = vec2[] (
vec2(0.00333804, 2.52083),
vec2(0.000973794, 3.0)
);
#endif //USE_25_SAMPLES
#ifdef USE_17_SAMPLES
const int kernel_size = 17;
QUALIFIER vec2 kernel[17] = vec2[](
vec2(0.536343, 0.0),
vec2(0.00317394, -2.0),
@ -74,14 +68,11 @@ QUALIFIER vec2 kernel[17] = vec2[](
vec2(0.0100386, 1.53125),
vec2(0.00317394, 2.0)
);
#endif //USE_17_SAMPLES
#ifdef USE_11_SAMPLES
const int kernel_size = 11;
QUALIFIER vec2 kernel[11] = vec2[](
vec2(0.560479, 0.0),
vec2(0.00471691, -2.0),
@ -95,11 +86,8 @@ QUALIFIER vec2 kernel[11] = vec2[](
vec2(0.0192831, 1.28),
vec2(0.00471691, 2.0)
);
#endif //USE_11_SAMPLES
uniform float max_radius;
uniform float camera_z_far;
uniform float camera_z_near;
@ -121,10 +109,8 @@ void main() {
// Fetch color of current pixel:
vec4 base_color = texture(source_diffuse, uv_interp);
if (strength > 0.0) {
// Fetch linear depth of current pixel:
float depth = texture(source_depth, uv_interp).r * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION
@ -135,8 +121,6 @@ void main() {
float scale = unit_size / depth; //remember depth is negative by default in OpenGL
#endif
// Calculate the final step to fetch the surrounding pixels:
vec2 step = max_radius * scale * dir;
step *= strength; // Modulate it using the alpha channel.
@ -165,8 +149,7 @@ void main() {
depth_cmp = 2.0 * camera_z_near * camera_z_far / (camera_z_far + camera_z_near - depth_cmp * (camera_z_far - camera_z_near));
#endif
float s = clamp(300.0f * scale *
max_radius * abs(depth - depth_cmp),0.0,1.0);
float s = clamp(300.0f * scale * max_radius * abs(depth - depth_cmp), 0.0, 1.0);
color = mix(color, base_color.rgb, s);
#endif
@ -179,7 +162,6 @@ void main() {
color *= color_s;
#endif
color_accum += color;
}
#ifdef ENABLE_STRENGTH_WEIGHTING

View file

@ -5,8 +5,7 @@ layout (location = 4) in vec2 uv_in;
out vec2 uv_interp;
void main()
{
void main() {
gl_Position = vertex_attrib;
uv_interp = uv_in;
@ -53,52 +52,43 @@ layout (location = 0) out vec4 frag_color;
#ifdef USE_GLOW_FILTER_BICUBIC
// w0, w1, w2, and w3 are the four cubic B-spline basis functions
float w0(float a)
{
float w0(float a) {
return (1.0f / 6.0f) * (a * (a * (-a + 3.0f) - 3.0f) + 1.0f);
}
float w1(float a)
{
float w1(float a) {
return (1.0f / 6.0f) * (a * a * (3.0f * a - 6.0f) + 4.0f);
}
float w2(float a)
{
float w2(float a) {
return (1.0f / 6.0f) * (a * (a * (-3.0f * a + 3.0f) + 3.0f) + 1.0f);
}
float w3(float a)
{
float w3(float a) {
return (1.0f / 6.0f) * (a * a * a);
}
// g0 and g1 are the two amplitude functions
float g0(float a)
{
float g0(float a) {
return w0(a) + w1(a);
}
float g1(float a)
{
float g1(float a) {
return w2(a) + w3(a);
}
// h0 and h1 are the two offset functions
float h0(float a)
{
float h0(float a) {
return -1.0f + w1(a) / (w0(a) + w1(a));
}
float h1(float a)
{
float h1(float a) {
return 1.0f + w3(a) / (w2(a) + w3(a));
}
uniform ivec2 glow_texture_size;
vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod)
{
vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) {
float lod = float(p_lod);
vec2 tex_size = vec2(glow_texture_size >> p_lod);
vec2 pixel_size = vec2(1.0f) / tex_size;
@ -131,8 +121,7 @@ layout (location = 0) out vec4 frag_color;
#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) textureLod(m_tex, m_uv, float(m_lod))
#endif
vec3 tonemap_filmic(vec3 color, float white)
{
vec3 tonemap_filmic(vec3 color, float white) {
const float A = 0.15f;
const float B = 0.50f;
const float C = 0.10f;
@ -147,8 +136,7 @@ vec3 tonemap_filmic(vec3 color, float white)
return clamp(color_tonemapped / white_tonemapped, vec3(0.0f), vec3(1.0f));
}
vec3 tonemap_aces(vec3 color, float white)
{
vec3 tonemap_aces(vec3 color, float white) {
const float A = 2.51f;
const float B = 0.03f;
const float C = 2.43f;
@ -161,19 +149,16 @@ vec3 tonemap_aces(vec3 color, float white)
return clamp(color_tonemapped / white_tonemapped, vec3(0.0f), vec3(1.0f));
}
vec3 tonemap_reindhart(vec3 color, float white)
{
vec3 tonemap_reindhart(vec3 color, float white) {
return clamp((color) / (1.0f + color) * (1.0f + (color / (white))), vec3(0.0f), vec3(1.0f)); // whitepoint is probably not in linear space here!
}
vec3 linear_to_srgb(vec3 color) // convert linear rgb to srgb, assumes clamped input in range [0;1]
{
vec3 linear_to_srgb(vec3 color) { // convert linear rgb to srgb, assumes clamped input in range [0;1]
const vec3 a = vec3(0.055f);
return mix((vec3(1.0f) + a) * pow(color.rgb, vec3(1.0f / 2.4f)) - a, 12.92f * color.rgb, lessThan(color.rgb, vec3(0.0031308f)));
}
vec3 apply_tonemapping(vec3 color, float white) // inputs are LINEAR, always outputs clamped [0;1] color
{
vec3 apply_tonemapping(vec3 color, float white) { // inputs are LINEAR, always outputs clamped [0;1] color
#ifdef USE_REINDHART_TONEMAPPER
return tonemap_reindhart(color, white);
#endif
@ -189,8 +174,7 @@ vec3 apply_tonemapping(vec3 color, float white) // inputs are LINEAR, always out
return clamp(color, vec3(0.0f), vec3(1.0f)); // no other seleced -> linear
}
vec3 gather_glow(sampler2D tex, vec2 uv) // sample all selected glow levels
{
vec3 gather_glow(sampler2D tex, vec2 uv) { // sample all selected glow levels
vec3 glow = vec3(0.0f);
#ifdef USE_GLOW_LEVEL1
@ -224,8 +208,7 @@ vec3 gather_glow(sampler2D tex, vec2 uv) // sample all selected glow levels
return glow;
}
vec3 apply_glow(vec3 color, vec3 glow) // apply glow using the selected blending mode
{
vec3 apply_glow(vec3 color, vec3 glow) { // apply glow using the selected blending mode
#ifdef USE_GLOW_REPLACE
color = glow;
#endif
@ -249,8 +232,7 @@ vec3 apply_glow(vec3 color, vec3 glow) // apply glow using the selected blending
return color;
}
vec3 apply_bcs(vec3 color, vec3 bcs)
{
vec3 apply_bcs(vec3 color, vec3 bcs) {
color = mix(vec3(0.0f), color, bcs.x);
color = mix(vec3(0.5f), color, bcs.y);
color = mix(vec3(dot(vec3(1.0f), color) * 0.33333f), color, bcs.z);
@ -258,8 +240,7 @@ vec3 apply_bcs(vec3 color, vec3 bcs)
return color;
}
vec3 apply_color_correction(vec3 color, sampler2D correction_tex)
{
vec3 apply_color_correction(vec3 color, sampler2D correction_tex) {
color.r = texture(correction_tex, vec2(color.r, 0.0f)).r;
color.g = texture(correction_tex, vec2(color.g, 0.0f)).g;
color.b = texture(correction_tex, vec2(color.b, 0.0f)).b;
@ -267,8 +248,7 @@ vec3 apply_color_correction(vec3 color, sampler2D correction_tex)
return color;
}
void main()
{
void main() {
vec3 color = textureLod(source, uv_interp, 0.0f).rgb;
// Exposure