Legacy shader fixes
This commit is contained in:
parent
5ddb0e32d1
commit
0ba60eea90
|
@ -1,6 +1,8 @@
|
|||
// Weighted blended OIT by McGuire and Bavoil
|
||||
#version 450
|
||||
|
||||
#include "compiled.glsl"
|
||||
|
||||
// uniform sampler2D gbufferD;
|
||||
uniform sampler2D gbuffer0; // saccum
|
||||
uniform sampler2D gbuffer1; // srevealage
|
||||
|
@ -11,11 +13,16 @@ in vec2 texCoord;
|
|||
out vec4 fragColor;
|
||||
|
||||
float maxComponent(vec4 v) {
|
||||
return max(max(max(v.x, v.y), v.z), v.w);
|
||||
return max(max(max(v.x, v.y), v.z), v.w);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
#ifdef _Legacy
|
||||
vec4 accum = texture(gbuffer0, texCoord);
|
||||
#else
|
||||
vec4 accum = texelFetch(gbuffer0, ivec2(texCoord * texSize), 0);
|
||||
#endif
|
||||
float revealage = 1.0 - accum.a;
|
||||
|
||||
// Save the blending and color texture fetch cost
|
||||
|
@ -25,9 +32,13 @@ void main() {
|
|||
}
|
||||
|
||||
if (isinf(maxComponent(abs(accum)))) {
|
||||
accum.rgb = vec3(revealage);
|
||||
}
|
||||
accum.rgb = vec3(revealage);
|
||||
}
|
||||
|
||||
#ifdef _Legacy
|
||||
float f = texture(gbuffer1, texCoord).r;
|
||||
#else
|
||||
float f = texelFetch(gbuffer1, ivec2(texCoord * texSize), 0).r;
|
||||
#endif
|
||||
fragColor = vec4(accum.rgb / clamp(f, 1e-4, 5e4), revealage);
|
||||
}
|
||||
|
|
|
@ -771,15 +771,15 @@ class RenderPathDeferred {
|
|||
var framebuffer = "";
|
||||
#end
|
||||
|
||||
#if ((rp_antialiasing == "Off") || (rp_antialiasing == "FXAA"))
|
||||
#if ((rp_antialiasing == "Off") || (rp_antialiasing == "FXAA") || (!rp_render_to_texture))
|
||||
{
|
||||
RenderPathCreator.finalTarget = path.currentTarget;
|
||||
path.setTarget(framebuffer);
|
||||
}
|
||||
#else
|
||||
{
|
||||
path.setTarget("buf");
|
||||
RenderPathCreator.finalTarget = path.currentTarget;
|
||||
path.setTarget("buf");
|
||||
}
|
||||
#end
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class FirstPersonController extends CameraController {
|
|||
var kb = Input.getKeyboard();
|
||||
|
||||
if (mouse.started() && !mouse.locked) mouse.lock();
|
||||
else if (kb.started("esc") && mouse.locked) mouse.unlock();
|
||||
else if (kb.started("escape") && mouse.locked) mouse.unlock();
|
||||
|
||||
if (mouse.locked || mouse.down()) {
|
||||
head.transform.rotate(xVec, -mouse.movementY / 250 * rotationSpeed);
|
||||
|
|
|
@ -52,15 +52,16 @@ def add_world_defs():
|
|||
elif rpdat.rp_gi == 'Voxel AO':
|
||||
voxelao = True
|
||||
# Shadows
|
||||
if rpdat.rp_shadowmap_cascades != '1':
|
||||
if voxelgi:
|
||||
log.warn('Disabling shadow cascades - Voxel GI does not support cascades yet')
|
||||
else:
|
||||
wrd.world_defs += '_CSM'
|
||||
assets.add_khafile_def('arm_csm')
|
||||
if rpdat.rp_shadowmap == 'Off':
|
||||
wrd.world_defs += '_NoShadows'
|
||||
assets.add_khafile_def('arm_no_shadows')
|
||||
else:
|
||||
if rpdat.rp_shadowmap_cascades != '1':
|
||||
if voxelgi:
|
||||
log.warn('Disabling shadow cascades - Voxel GI does not support cascades yet')
|
||||
else:
|
||||
wrd.world_defs += '_CSM'
|
||||
assets.add_khafile_def('arm_csm')
|
||||
# SS
|
||||
# if rpdat.rp_dfrs:
|
||||
# wrd.world_defs += '_DFRS'
|
||||
|
@ -110,6 +111,9 @@ def add_world_defs():
|
|||
if arm.utils.get_gapi().startswith('direct3d'): # Flip Y axis in drawQuad command
|
||||
wrd.world_defs += '_InvY'
|
||||
|
||||
if arm.utils.get_legacy_shaders() and not state.is_viewport:
|
||||
wrd.world_defs += '_Legacy'
|
||||
|
||||
# Area lamps
|
||||
for lamp in bpy.data.lamps:
|
||||
if lamp.type == 'AREA':
|
||||
|
@ -157,6 +161,9 @@ def build():
|
|||
assets.add(assets_path + 'noise256.png')
|
||||
assets.add_embedded_data('noise256.png')
|
||||
|
||||
if not rpdat.rp_render_to_texture or not rpdat.rp_compositornodes:
|
||||
assets.add_shader_pass('copy_pass')
|
||||
|
||||
if rpdat.rp_render_to_texture:
|
||||
assets.add_khafile_def('rp_render_to_texture')
|
||||
|
||||
|
@ -199,8 +206,6 @@ def build():
|
|||
if '_CDOF' in wrd.compo_defs or '_CFXAA' in wrd.compo_defs or '_CSharpen' in wrd.compo_defs:
|
||||
wrd.compo_defs += '_CTexStep'
|
||||
assets.add_shader_pass('compositor_pass')
|
||||
else:
|
||||
assets.add_shader_pass('copy_pass')
|
||||
|
||||
assets.add_khafile_def('rp_antialiasing={0}'.format(rpdat.rp_antialiasing))
|
||||
|
||||
|
|
Loading…
Reference in a new issue