Full BSDF
This commit is contained in:
@ -133,7 +133,6 @@ def add_world_defs():
|
||||
assets.add_shader_external(lnx.utils.get_sdk_path() + '/leenkx/Shaders/voxel_offsetprev/voxel_offsetprev.comp.glsl')
|
||||
assets.add_shader_external(lnx.utils.get_sdk_path() + '/leenkx/Shaders/voxel_temporal/voxel_temporal.comp.glsl')
|
||||
assets.add_shader_external(lnx.utils.get_sdk_path() + '/leenkx/Shaders/voxel_sdf_jumpflood/voxel_sdf_jumpflood.comp.glsl')
|
||||
#wrd.world_defs += "_VoxelCones" + rpdat.lnx_voxelgi_cones
|
||||
if rpdat.lnx_voxelgi_shadows and (point_lights > 0 or '_Sun' in wrd.world_defs):
|
||||
wrd.world_defs += '_VoxelShadow'
|
||||
assets.add_khafile_def('lnx_voxelgi_shadows')
|
||||
@ -173,9 +172,6 @@ def add_world_defs():
|
||||
wrd.world_defs += '_Brdf'
|
||||
assets.add_khafile_def("lnx_brdf")
|
||||
|
||||
if '_Anisotropy' in wrd.world_defs:
|
||||
assets.add_khafile_def('lnx_anisotropy')
|
||||
|
||||
def build():
|
||||
rpdat = lnx.utils.get_rp()
|
||||
project_path = lnx.utils.get_fp()
|
||||
@ -237,7 +233,7 @@ def build():
|
||||
assets.add_khafile_def('rp_compositornodes')
|
||||
compo_depth = False
|
||||
# wrd.compo_defs += ''
|
||||
if rpdat.lnx_tonemap != 'Off':
|
||||
if rpdat.lnx_tonemap != 'Off' and not state.is_viewport:
|
||||
wrd.compo_defs += '_CTone' + rpdat.lnx_tonemap
|
||||
if rpdat.lnx_dithering != 'Off':
|
||||
wrd.compo_defs += '_CDithering' + rpdat.lnx_dithering
|
||||
@ -444,7 +440,8 @@ def build():
|
||||
|
||||
if rpdat.rp_sss:
|
||||
assets.add_khafile_def('rp_sss')
|
||||
wrd.world_defs += '_SSS'
|
||||
if '_SSS' not in wrd.world_defs:
|
||||
wrd.world_defs += '_SSS'
|
||||
assets.add_shader_pass('sss_pass')
|
||||
|
||||
if (rpdat.rp_ssr and rpdat.lnx_ssr_half_res) or (rpdat.rp_ssao and rpdat.lnx_ssao_half_res) or (rpdat.rp_ssgi and rpdat.lnx_ssgi_half_res) or rpdat.rp_voxels != "Off":
|
||||
@ -487,13 +484,55 @@ def build():
|
||||
|
||||
if ignoreIrr:
|
||||
wrd.world_defs += '_IgnoreIrr'
|
||||
# TODO: avoid the prescan correctly
|
||||
if bpy.app.version >= (4, 0, 0):
|
||||
coat_name = 'Coat Weight'
|
||||
sheen_name = 'Sheen Weight'
|
||||
subsurf_name = 'Subsurface Weight'
|
||||
trans_name = 'Transmission Weight'
|
||||
else:
|
||||
coat_name = 'Clearcoat'
|
||||
sheen_name = 'Sheen'
|
||||
subsurf_name = 'Subsurface'
|
||||
trans_name = 'Transmission'
|
||||
for mat in bpy.data.materials:
|
||||
if mat.node_tree is None:
|
||||
continue
|
||||
for node in mat.node_tree.nodes:
|
||||
if node.type == 'BSDF_PRINCIPLED':
|
||||
coat_socket = node.inputs.get(coat_name)
|
||||
if coat_socket is not None and (coat_socket.is_linked or coat_socket.default_value > 0.0):
|
||||
if '_ClearCoat' not in wrd.world_defs:
|
||||
wrd.world_defs += '_ClearCoat'
|
||||
aniso_socket = node.inputs.get('Anisotropic')
|
||||
if aniso_socket is not None and (aniso_socket.is_linked or aniso_socket.default_value > 0.0):
|
||||
if '_Anisotropy' not in wrd.world_defs:
|
||||
wrd.world_defs += '_Anisotropy'
|
||||
sheen_socket = node.inputs.get(sheen_name)
|
||||
if sheen_socket is not None and (sheen_socket.is_linked or sheen_socket.default_value > 0.0):
|
||||
if '_Sheen' not in wrd.world_defs:
|
||||
wrd.world_defs += '_Sheen'
|
||||
subsurf_socket = node.inputs.get(subsurf_name)
|
||||
if subsurf_socket is not None and (subsurf_socket.is_linked or subsurf_socket.default_value > 0.0):
|
||||
if '_SSS' not in wrd.world_defs:
|
||||
wrd.world_defs += '_SSS'
|
||||
trans_socket = node.inputs.get(trans_name)
|
||||
if trans_socket is not None and (trans_socket.is_linked or trans_socket.default_value > 0.0):
|
||||
if '_Transmission' not in wrd.world_defs:
|
||||
wrd.world_defs += '_Transmission'
|
||||
elif node.type == 'SUBSURFACE_SCATTERING':
|
||||
if '_SSS' not in wrd.world_defs:
|
||||
wrd.world_defs += '_SSS'
|
||||
|
||||
gbuffer2 = '_Veloc' in wrd.world_defs or '_IgnoreIrr' in wrd.world_defs or '_VoxelGI' in wrd.world_defs or '_VoxelShadow' in wrd.world_defs or '_SSGI' in wrd.world_defs
|
||||
gbuffer2 = '_Veloc' in wrd.world_defs or '_IgnoreIrr' in wrd.world_defs or '_VoxelGI' in wrd.world_defs or '_VoxelShadow' in wrd.world_defs or '_SSGI' in wrd.world_defs or '_Anisotropy' in wrd.world_defs
|
||||
|
||||
if gbuffer2:
|
||||
assets.add_khafile_def('rp_gbuffer2')
|
||||
wrd.world_defs += '_gbuffer2'
|
||||
|
||||
if '_ClearCoat' in wrd.world_defs:
|
||||
assets.add_khafile_def('rp_clearcoat')
|
||||
|
||||
if callback is not None:
|
||||
callback()
|
||||
|
||||
@ -506,7 +545,7 @@ def get_num_gbuffer_rts_deferred()-> int:
|
||||
refraction_flags = {'_SSRefraction', '_VoxelRefract'}
|
||||
found_refraction_flag = False
|
||||
|
||||
for flag in ('_gbuffer2', '_EmissionShaded', '_SSRefraction', '_VoxelRefract'):
|
||||
for flag in ('_gbuffer2', '_EmissionShaded', '_SSRefraction', '_VoxelRefract', '_ClearCoat'):
|
||||
if flag in wrd.world_defs:
|
||||
if flag in refraction_flags and not found_refraction_flag:
|
||||
num += 1
|
||||
@ -514,7 +553,4 @@ def get_num_gbuffer_rts_deferred()-> int:
|
||||
else:
|
||||
num += 1
|
||||
|
||||
if '_Anisotropy' in wrd.world_defs:
|
||||
num += 1
|
||||
|
||||
return num
|
||||
|
||||
Reference in New Issue
Block a user