Forward path voxels
This commit is contained in:
parent
505ccb7caf
commit
9d3930ab85
|
@ -363,9 +363,31 @@ def make_forward(rpdat):
|
|||
nodes['Begin'].inputs[1].default_value = rpdat.rp_hdr
|
||||
nodes['Screen'].inputs[0].default_value = int(rpdat.rp_supersampling)
|
||||
|
||||
if rpdat.rp_gi == 'Voxel GI' or rpdat.rp_gi == 'Voxel AO':
|
||||
n = nodes['Image 3D Voxels']
|
||||
if rpdat.rp_gi == 'Voxel AO':
|
||||
n.inputs[4].default_value = 'R8'
|
||||
elif rpdat.rp_voxelgi_hdr:
|
||||
n.inputs[4].default_value = 'RGBA64'
|
||||
# One lamp only for now - draw shadow map in advance
|
||||
links.new(nodes['Draw Meshes SM'].outputs[0], nodes['Branch Function Voxelize'].inputs[0])
|
||||
links.new(nodes['Merge Stages Voxelize'].outputs[0], nodes['Set Target Mesh'].inputs[0])
|
||||
res = int(rpdat.rp_voxelgi_resolution)
|
||||
n.inputs[1].default_value = res
|
||||
n.inputs[2].default_value = res
|
||||
n.inputs[3].default_value = int(res * float(rpdat.rp_voxelgi_resolution_z))
|
||||
n = nodes['Set Viewport Voxels']
|
||||
n.inputs[1].default_value = res
|
||||
n.inputs[2].default_value = res
|
||||
else:
|
||||
relink('Bind Target Mesh Voxels', 'Draw Meshes Mesh')
|
||||
|
||||
if not rpdat.rp_hdr:
|
||||
nodes['lbuf'].inputs[4].default_value = 'RGBA32'
|
||||
|
||||
if not rpdat.rp_depthprepass:
|
||||
relink('Draw Meshes Depth', 'Bind Target Mesh SM')
|
||||
|
||||
if rpdat.rp_shadowmap != 'None':
|
||||
n = nodes['Shadow Map']
|
||||
n.inputs[1].default_value = n.inputs[2].default_value = int(rpdat.rp_shadowmap)
|
||||
|
|
|
@ -494,6 +494,7 @@ def make_forward(con_mesh):
|
|||
if not blend:
|
||||
frag.add_out('vec4 fragColor')
|
||||
frag.write('fragColor = vec4(direct * lightColor * visibility + indirect * occlusion * envmapStrength, 1.0);')
|
||||
# frag.write('fragColor = vec4(indirect, 1.0);') # AO view
|
||||
|
||||
if '_LDR' in wrd.world_defs:
|
||||
frag.add_include('../../Shaders/std/tonemap.glsl')
|
||||
|
@ -666,3 +667,21 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
frag.write('indirect += prefilteredColor * (f0 * envBRDF.x + envBRDF.y) * 1.5;')
|
||||
else:
|
||||
frag.write('vec3 indirect = albedo;')
|
||||
|
||||
if '_VoxelGI' in wrd.world_defs or '_VoxelAO' in wrd.world_defs:
|
||||
frag.add_include('../../Shaders/std/conetrace.glsl')
|
||||
frag.add_uniform('sampler3D voxels', included=True)
|
||||
if '_VoxelGICam' in wrd.world_defs:
|
||||
frag.add_uniform('vec3 eyeSnap', link='_cameraPositionSnap')
|
||||
frag.write('vec3 voxpos = (wposition - eyeSnap) / voxelgiHalfExtents;')
|
||||
else:
|
||||
frag.write('vec3 voxpos = wposition / voxelgiHalfExtents;')
|
||||
if '_VoxelAO' in wrd.world_defs:
|
||||
frag.write('indirect *= vec3(1.0 - traceAO(voxpos, n));')
|
||||
# frag.write('indirect = vec3(1.0 - traceAO(voxpos, n));') # AO view
|
||||
else:
|
||||
frag.write('vec4 indirectDiffuse = traceDiffuse(voxpos, n);')
|
||||
frag.write('vec3 indirectSpecular = traceSpecular(voxpos, n, vVec, roughness);')
|
||||
frag.write('indirectSpecular *= f0 * envBRDF.x + envBRDF.y;')
|
||||
frag.write('indirect = indirect * voxelgiEnv + vec3(indirectDiffuse.rgb * voxelgiDiff * basecol + indirectSpecular * voxelgiSpec);')
|
||||
|
||||
|
|
|
@ -966,6 +966,8 @@ class ArmRenderPathPanel(bpy.types.Panel):
|
|||
layout.prop(wrd, "rp_preset")
|
||||
layout.separator()
|
||||
layout.prop(rpdat, "rp_renderer")
|
||||
if rpdat.rp_renderer == 'Forward':
|
||||
layout.prop(rpdat, 'rp_depthprepass')
|
||||
layout.prop(rpdat, "arm_material_model")
|
||||
layout.prop(rpdat, "rp_shadowmap")
|
||||
if rpdat.rp_shadowmap != 'None':
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue