forked from LeenkxTeam/LNXSDK
Patch_2
This commit is contained in:
@ -198,7 +198,7 @@ def make_deferred(con_mesh, rpasses):
|
||||
rpdat = lnx.utils.get_rp()
|
||||
|
||||
lnx_discard = mat_state.material.lnx_discard
|
||||
parse_opacity = lnx_discard or 'translucent' or 'refraction' in rpasses
|
||||
parse_opacity = lnx_discard or 'translucent' in rpasses or 'refraction' in rpasses
|
||||
|
||||
make_base(con_mesh, parse_opacity=parse_opacity)
|
||||
|
||||
@ -213,6 +213,7 @@ def make_deferred(con_mesh, rpasses):
|
||||
opac = '0.9999' # 1.0 - eps
|
||||
frag.write('if (opacity < {0}) discard;'.format(opac))
|
||||
|
||||
|
||||
frag.add_out(f'vec4 fragColor[GBUF_SIZE]')
|
||||
|
||||
if '_gbuffer2' in wrd.world_defs:
|
||||
@ -281,7 +282,7 @@ def make_deferred(con_mesh, rpasses):
|
||||
frag.write('#endif')
|
||||
|
||||
if '_SSRefraction' in wrd.world_defs or '_VoxelRefract' in wrd.world_defs:
|
||||
frag.write('fragColor[GBUF_IDX_REFRACTION] = vec4(1.0, 1.0, 0.0, 1.0);')
|
||||
frag.write('fragColor[GBUF_IDX_REFRACTION] = vec4(1.0, 0.0, 0.0, 1.0);')
|
||||
|
||||
return con_mesh
|
||||
|
||||
@ -559,7 +560,7 @@ def make_forward(con_mesh):
|
||||
frag.write('fragColor[0] = vec4(direct + indirect, packFloat2(occlusion, specular));')
|
||||
frag.write('fragColor[1] = vec4(n.xy, roughness, metallic);')
|
||||
if rpdat.rp_ss_refraction or rpdat.lnx_voxelgi_refract:
|
||||
frag.write(f'fragColor[2] = vec4(1.0, 1.0, 0.0, 0.0);')
|
||||
frag.write(f'fragColor[2] = vec4(1.0, 0.0, 0.0, 1.0);')
|
||||
|
||||
else:
|
||||
frag.add_out('vec4 fragColor[1]')
|
||||
@ -716,8 +717,12 @@ def make_forward_base(con_mesh, parse_opacity=False, transluc_pass=False):
|
||||
else:
|
||||
frag.write('vec3 indirect = envl;')
|
||||
|
||||
if '_VoxelShadow' in wrd.world_defs or '_VoxelGI' in wrd.world_defs:
|
||||
velocity_already_defined = '_gbuffer2' in wrd.world_defs and '_Veloc' in wrd.world_defs
|
||||
if not velocity_already_defined:
|
||||
frag.write('vec2 velocity = gl_FragCoord.xy;')
|
||||
|
||||
if '_VoxelGI' in wrd.world_defs:
|
||||
frag.write('vec2 velocity = gl_FragCoord.xy;')
|
||||
frag.write('vec4 diffuse_indirect = traceDiffuse(wposition, n, voxels, clipmaps);')
|
||||
frag.write('indirect = (diffuse_indirect.rgb * albedo * (1.0 - F) + envl * (1.0 - diffuse_indirect.a)) * voxelgiDiff;')
|
||||
frag.write('if (roughness < 1.0 && specular > 0.0) {')
|
||||
@ -810,12 +815,11 @@ def make_forward_base(con_mesh, parse_opacity=False, transluc_pass=False):
|
||||
frag.write(', true, spotData.x, spotData.y, spotDir, spotData.zw, spotRight')
|
||||
if '_VoxelShadow' in wrd.world_defs:
|
||||
frag.write(', voxels, voxelsSDF, clipmaps')
|
||||
if '_Veloc' in wrd.world_defs or '_VoxelShadow' in wrd.world_defs:
|
||||
frag.write(', velocity')
|
||||
if '_MicroShadowing' in wrd.world_defs:
|
||||
frag.write(', occlusion')
|
||||
if '_SSRS' in wrd.world_defs:
|
||||
frag.add_uniform('sampler2D gbufferD')
|
||||
frag.add_uniform('sampler2D gbufferD', top=True)
|
||||
frag.add_uniform('mat4 invVP', '_inverseViewProjectionMatrix')
|
||||
frag.add_uniform('vec3 eye', '_cameraPosition')
|
||||
frag.write(', gbufferD, invVP, eye')
|
||||
|
||||
Reference in New Issue
Block a user