Particle fixes

This commit is contained in:
Lubos Lenco 2017-09-29 17:00:21 +02:00
parent 487cc19435
commit 743a8d1a39
5 changed files with 18 additions and 3 deletions

View file

@ -2398,7 +2398,7 @@ class ArmoryExporter:
o['type'] = 0 if psettings.type == 'Emitter' else 1 # Hair
# Emission
o['count'] = psettings.count
o['count'] = psettings.count * psettings.arm_count_mult
o['frame_start'] = psettings.frame_start
o['frame_end'] = psettings.frame_end
o['lifetime'] = psettings.lifetime

View file

@ -457,15 +457,24 @@ def make_forward(con_mesh):
frag.write('fragColor.rgb = tonemapFilmic(fragColor.rgb);')
# frag.write('fragColor.rgb = pow(fragColor.rgb, vec3(1.0 / 2.2));')
# Particle opacity
# if mat_state.material.arm_particle == 'gpu':
# frag.write('fragColor.rgb *= popac;')
def make_forward_base(con_mesh, parse_opacity=False):
wrd = bpy.data.worlds['Arm']
make_base(con_mesh, parse_opacity=parse_opacity)
arm_discard = mat_state.material.arm_discard
make_base(con_mesh, parse_opacity=(parse_opacity or arm_discard))
vert = con_mesh.vert
frag = con_mesh.frag
tese = con_mesh.tese
if arm_discard:
opac = mat_state.material.arm_discard_opacity
frag.write('if (opacity < {0}) discard;'.format(opac))
frag.main_pre += """
vec3 vVec = normalize(eyeDir);
float dotNV = max(dot(n, vVec), 0.0);

View file

@ -38,6 +38,10 @@ def write(vert):
vert.write('spos.xyz += ppos;')
# Particle opacity
# vert.add_out('float popac')
# vert.write('popac = sin(min((ptime / 2) * 3.141592, 3.141592));')
def write_tilesheet(vert):
# tilesx, tilesy, framerate - pd[3][0], pd[3][1], pd[3][2]
vert.write('int frame = int((ptime / 2) / pd[3][2]);')

View file

@ -328,6 +328,7 @@ def init_properties():
bpy.types.Material.lock_cache = bpy.props.BoolProperty(name="Lock Material Cache", description="Prevent is_cached from updating", default=False)
# Particles
bpy.types.ParticleSettings.arm_gpu_sim = bpy.props.BoolProperty(name="GPU Simulation", description="Calculate particle simulation on GPU", default=False, update=assets.invalidate_shader_cache)
bpy.types.ParticleSettings.arm_count_mult = bpy.props.FloatProperty(name="Multiply Count", description="Multiply particle count when rendering in Armory", default=1.0)
create_wrd()

View file

@ -101,6 +101,7 @@ class ParticlesPropsPanel(bpy.types.Panel):
return
layout.prop(obj.settings, 'arm_gpu_sim')
layout.prop(obj.settings, 'arm_count_mult')
class PhysicsPropsPanel(bpy.types.Panel):
bl_label = "Armory Props"