render: manually correct gamma before fog calculations

This commit is contained in:
Edgaru089 2022-01-21 21:07:39 +08:00
parent f4f784a7d3
commit 73669001c3
2 changed files with 1 additions and 3 deletions

View File

@ -41,12 +41,12 @@ void main() {
color += vec4(texpixel.rgb * light, 0.0f); color += vec4(texpixel.rgb * light, 0.0f);
color.a = texpixel.a; color.a = texpixel.a;
color.rgb = pow(color.rgb, vec3(1.0/gamma));
float z = gl_FragCoord.z / gl_FragCoord.w; float z = gl_FragCoord.z / gl_FragCoord.w;
float fog = clamp(exp(-fogDensity * z * z), 0.2, 1); float fog = clamp(exp(-fogDensity * z * z), 0.2, 1);
outputColor = mix(fogColor, color, fog); outputColor = mix(fogColor, color, fog);
//outputColor.rgb = pow(outputColor.rgb, vec3(1.0/gamma));
} }
void lightSun() { void lightSun() {

View File

@ -124,7 +124,5 @@ func (r *WorldRenderer) Render(world *world.World, view *View) {
r.shader.SetUniformVec4f("fogColor", itype.Vec4f{0.6, 0.8, 1.0, 1.0}) r.shader.SetUniformVec4f("fogColor", itype.Vec4f{0.6, 0.8, 1.0, 1.0})
r.shader.SetUniformVec3f("sun", normalSun) r.shader.SetUniformVec3f("sun", normalSun)
gl.Enable(gl.FRAMEBUFFER_SRGB)
world.Render() world.Render()
gl.Disable(gl.FRAMEBUFFER_SRGB)
} }