Fix disabled shadowmap
This commit is contained in:
parent
4414d164cc
commit
c68b13c081
|
@ -2201,6 +2201,9 @@ class ArmoryExporter:
|
|||
|
||||
o['contexts'] = []
|
||||
|
||||
if not material.use_nodes:
|
||||
material.use_nodes = True
|
||||
|
||||
sd, is_transluc = make_material.parse(material, o, self.materialToObjectDict, ArmoryExporter.renderpath_id)
|
||||
if is_transluc:
|
||||
transluc_used = True
|
||||
|
|
|
@ -184,14 +184,16 @@ def compile_project(target_name=None, is_publish=False, watch=False, patch=False
|
|||
if patch:
|
||||
if state.compileproc == None: # Already compiling
|
||||
# Patch running game, stay silent, disable krafix and haxe
|
||||
# cmd.append('--silent')
|
||||
cmd.append('--noproject')
|
||||
cmd.append('--haxe')
|
||||
cmd.append('""')
|
||||
cmd.append('--krafix')
|
||||
cmd.append('""')
|
||||
cmd.append('--haxe')
|
||||
cmd.append('""')
|
||||
# cmd.append('--silent')
|
||||
cmd.append('--noproject')
|
||||
# Khamake throws error when krafix is not found, hide for now
|
||||
state.compileproc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
|
||||
# state.compileproc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
|
||||
# shell=False results in --krafix arg not parsed
|
||||
state.compileproc = subprocess.Popen(' '.join(cmd), stderr=subprocess.PIPE, shell=True)
|
||||
if state.playproc == None:
|
||||
if state.in_viewport:
|
||||
mode = 'play_viewport'
|
||||
|
|
|
@ -41,6 +41,8 @@ def make_forward(cam):
|
|||
l = nodes['Begin'].outputs[0].links[0]
|
||||
links.remove(l)
|
||||
links.new(nodes['Begin'].outputs[0], nodes['Set Target Mesh'].inputs[0])
|
||||
relink('Bind Target Mesh SM', 'Draw Meshes Mesh') # No shadowmap bind
|
||||
relink('Bind Target Transluc SM', 'Draw Meshes Transluc')
|
||||
|
||||
if not cam.rp_worldnodes:
|
||||
relink('Draw World', 'Set Target Accum')
|
||||
|
@ -63,6 +65,11 @@ def make_deferred(cam):
|
|||
l = nodes['Loop Lamps'].outputs[1].links[0]
|
||||
links.remove(l)
|
||||
links.new(nodes['Loop Lamps'].outputs[1], nodes['Deferred Light'].inputs[0])
|
||||
l = nodes['Deferred Light'].inputs[3].links[0] # No shadowmap bind
|
||||
links.remove(l)
|
||||
l = nodes['Volumetric Light'].inputs[6].links[0]
|
||||
links.remove(l)
|
||||
relink('Bind Target Transluc SM', 'Draw Meshes Transluc')
|
||||
|
||||
# if not cam.rp_decals:
|
||||
# relink('Set Target.005', 'SSAO')
|
||||
|
|
|
@ -60,10 +60,6 @@ def build_node_tree(world):
|
|||
if wrd.generate_clouds:
|
||||
wrd.world_defs += '_EnvClouds'
|
||||
|
||||
# Shadows disabled
|
||||
if wrd.generate_shadows == False:
|
||||
wrd.world_defs += '_NoShadows'
|
||||
|
||||
# Percentage closer soft shadows
|
||||
if wrd.generate_pcss_state == 'On':
|
||||
wrd.world_defs += '_PCSS'
|
||||
|
@ -87,7 +83,8 @@ def build_node_tree(world):
|
|||
for cam in bpy.data.cameras:
|
||||
if cam.is_probe:
|
||||
wrd.world_defs += '_Probes'
|
||||
break
|
||||
if cam.rp_shadowmap == 'None':
|
||||
wrd.world_defs += '_NoShadows'
|
||||
|
||||
# Area lamps
|
||||
for lamp in bpy.data.lamps:
|
||||
|
|
|
@ -228,11 +228,17 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
frag.write('float dotNH = dot(n, h);')
|
||||
frag.write('float dotVH = dot(v, h);')
|
||||
|
||||
if '_NoShadows' in wrd.world_defs:
|
||||
is_shadows = False
|
||||
else:
|
||||
is_shadows = True
|
||||
if '_PCSS' in wrd.world_defs:
|
||||
is_pcss = True
|
||||
else:
|
||||
is_pcss = False
|
||||
|
||||
frag.write('float visibility = 1.0;')
|
||||
if is_shadows:
|
||||
if tese != None:
|
||||
tese.add_out('vec4 lampPos')
|
||||
tese.add_uniform('mat4 LVP', '_lampViewProjectionMatrix')
|
||||
|
@ -251,7 +257,7 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
frag.add_uniform('sampler2D shadowMap', included=True)
|
||||
frag.add_uniform('bool receiveShadow')
|
||||
frag.add_uniform('float shadowsBias', '_lampShadowsBias')
|
||||
frag.write('float visibility = 1.0;')
|
||||
|
||||
frag.write('if (receiveShadow && lampPos.w > 0.0) {')
|
||||
frag.tab += 1
|
||||
frag.write('vec3 lpos = lampPos.xyz / lampPos.w;')
|
||||
|
|
|
@ -292,7 +292,6 @@ def init_properties():
|
|||
bpy.types.World.generate_ssao_size = bpy.props.FloatProperty(name="Size", default=0.12, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_ssao_strength = bpy.props.FloatProperty(name="Strength", default=0.25, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_ssao_texture_scale = bpy.props.FloatProperty(name="Texture Scale", default=1.0, min=0.0, max=1.0, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_shadows = bpy.props.BoolProperty(name="Shadows", default=True, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_bloom = bpy.props.BoolProperty(name="Bloom", default=True, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_bloom_threshold = bpy.props.FloatProperty(name="Threshold", default=20.0, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_bloom_strength = bpy.props.FloatProperty(name="Strength", default=0.5, update=assets.invalidate_shader_cache)
|
||||
|
|
|
@ -248,8 +248,6 @@ class PropsRPDataPropsPanel(bpy.types.Panel):
|
|||
wrd = bpy.data.worlds['Arm']
|
||||
|
||||
if obj.type == 'CAMERA':
|
||||
layout.prop(wrd, 'generate_shadows')
|
||||
if wrd.generate_shadows:
|
||||
layout.prop(wrd, 'generate_pcss_state')
|
||||
if wrd.generate_pcss_state == 'On' or wrd.generate_pcss_state == 'Auto':
|
||||
layout.prop(wrd, 'generate_pcss_rings')
|
||||
|
|
|
@ -243,10 +243,6 @@ const float seaFade = """ + str(round(wrd.generate_ocean_fade * 100) / 100) + ""
|
|||
const float ssaoStrength = """ + str(round(wrd.generate_ssao_strength * 100) / 100) + """;
|
||||
const float ssaoTextureScale = """ + str(round(wrd.generate_ssao_texture_scale * 10) / 10) + """;
|
||||
""")
|
||||
# if wrd.generate_shadows:
|
||||
# f.write(
|
||||
# """const float shadowsBias = """ + str(wrd.generate_shadows_bias) + """;
|
||||
# """)
|
||||
if wrd.generate_bloom:
|
||||
f.write(
|
||||
"""const float bloomThreshold = """ + str(round(wrd.generate_bloom_threshold * 100) / 100) + """;
|
||||
|
|
Loading…
Reference in a new issue