From fa425a98a5c4094e5e031a13270f2b99505c3591 Mon Sep 17 00:00:00 2001 From: Onek8 Date: Sat, 7 Jun 2025 20:35:01 +0000 Subject: [PATCH 1/6] t3du - Add export option for particles --- leenkx/blender/lnx/exporter.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/leenkx/blender/lnx/exporter.py b/leenkx/blender/lnx/exporter.py index c35de79..0067299 100644 --- a/leenkx/blender/lnx/exporter.py +++ b/leenkx/blender/lnx/exporter.py @@ -540,7 +540,7 @@ class LeenkxExporter: o['material_refs'].append(lnx.utils.asset_name(material)) def export_particle_system_ref(self, psys: bpy.types.ParticleSystem, out_object): - if psys.settings.instance_object is None or psys.settings.render_type != 'OBJECT' or not psys.settings.instance_object.lnx_export: + if psys.settings.instance_object is None or psys.settings.render_type != 'OBJECT' or not psys.settings.instance_object.lnx_export or not bpy.data.objects[out_object['name']].modifiers[psys.name].show_render: return self.particle_system_array[psys.settings] = {"structName": psys.settings.name} @@ -910,7 +910,8 @@ class LeenkxExporter: out_object['particle_refs'] = [] out_object['render_emitter'] = bobject.show_instancer_for_render for i in range(num_psys): - self.export_particle_system_ref(bobject.particle_systems[i], out_object) + if bobject.modifiers[bobject.particle_systems[i].name].show_render: + self.export_particle_system_ref(bobject.particle_systems[i], out_object) aabb = bobject.data.lnx_aabb if aabb[0] == 0 and aabb[1] == 0 and aabb[2] == 0: @@ -2280,6 +2281,15 @@ class LeenkxExporter: if len(self.particle_system_array) > 0: self.output['particle_datas'] = [] for particleRef in self.particle_system_array.items(): + padd = False; + for obj in self.output['objects']: + if 'particle_refs' in obj: + for pref in obj['particle_refs']: + if pref['particle'] == particleRef[1]["structName"]: + if bpy.data.objects[obj['name']].modifiers[pref['name']].show_render == True: + padd = True; + if not padd: + continue; psettings = particleRef[0] if psettings is None: From 8786798edda6a0cbc2377a4b4b0ac17b5a70ef8b Mon Sep 17 00:00:00 2001 From: Onek8 Date: Sat, 7 Jun 2025 20:39:01 +0000 Subject: [PATCH 2/6] t3du - Fix DoF references and small changes --- leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl b/leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl index 4d8acf6..cebb884 100644 --- a/leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl +++ b/leenkx/Shaders/compositor_pass/compositor_pass.frag.glsl @@ -144,7 +144,7 @@ float ConvertEV100ToExposure(float EV100) { return 1/0.8 * exp2(-EV100); } float ComputeEV(float avgLuminance) { - const float sqAperture = PPComp1[0].x * PPComp1.x; + const float sqAperture = PPComp1.x * PPComp1.x; const float shutterTime = 1.0 / PPComp1.y; const float ISO = PPComp1.z; const float EC = PPComp2.x; From 9b9289d27d7507d7af14f016f5d6429a458cadd1 Mon Sep 17 00:00:00 2001 From: Onek8 Date: Sat, 7 Jun 2025 20:42:31 +0000 Subject: [PATCH 3/6] t3du - Fix DoF references and small changes --- leenkx/Sources/leenkx/renderpath/Postprocess.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leenkx/Sources/leenkx/renderpath/Postprocess.hx b/leenkx/Sources/leenkx/renderpath/Postprocess.hx index 8e2d640..95703d9 100644 --- a/leenkx/Sources/leenkx/renderpath/Postprocess.hx +++ b/leenkx/Sources/leenkx/renderpath/Postprocess.hx @@ -49,7 +49,7 @@ class Postprocess { 0.01, //4: Fisheye Distortion 1, //5: DoF AutoFocus ยงยง If true, it ignores the DoF Distance setting 10.0, //6: DoF Distance - 160.0, //7: DoF Focal Length mm + 50.0, //7: DoF Focal Length mm 128, //8: DoF F-Stop 0, //9: Tonemapping Method 2.0, //10: Distort From 40d893e139d24462663723af10b484f31a95a1aa Mon Sep 17 00:00:00 2001 From: Onek8 Date: Sat, 7 Jun 2025 21:06:35 +0000 Subject: [PATCH 4/6] t3du - Fix DoF references and small changes --- leenkx/blender/lnx/make_renderpath.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/leenkx/blender/lnx/make_renderpath.py b/leenkx/blender/lnx/make_renderpath.py index c3c6cbe..f728472 100644 --- a/leenkx/blender/lnx/make_renderpath.py +++ b/leenkx/blender/lnx/make_renderpath.py @@ -240,8 +240,8 @@ def build(): compo_depth = True focus_distance = 0.0 - if len(bpy.data.cameras) > 0 and bpy.data.cameras[0].dof.use_dof: - focus_distance = bpy.data.cameras[0].dof.focus_distance + if len(bpy.data.cameras) > 0 and lnx.utils.get_active_scene().camera.data.dof.use_dof: + focus_distance = lnx.utils.get_active_scene().camera.data.dof.focus_distance if focus_distance > 0.0: wrd.compo_defs += '_CDOF' From 7f0153f8162a8629c204220e5e72dbc50091945b Mon Sep 17 00:00:00 2001 From: Onek8 Date: Sat, 7 Jun 2025 21:07:45 +0000 Subject: [PATCH 5/6] t3du - Fix DoF references and small changes --- leenkx/blender/lnx/props_renderpath.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leenkx/blender/lnx/props_renderpath.py b/leenkx/blender/lnx/props_renderpath.py index 907a963..2304642 100644 --- a/leenkx/blender/lnx/props_renderpath.py +++ b/leenkx/blender/lnx/props_renderpath.py @@ -445,7 +445,7 @@ class LnxRPListItem(bpy.types.PropertyGroup): name='Depth Texture', description='Whether materials can read from a depth texture', default='Auto', update=update_depth_texture_state) rp_stereo: BoolProperty(name="VR", description="Stereo rendering", default=False, update=update_renderpath) rp_water: BoolProperty(name="Water", description="Enable water surface pass", default=False, update=update_renderpath) - rp_pp: BoolProperty(name="Realtime postprocess", description="Realtime postprocess", default=False, update=update_renderpath) + rp_pp: BoolProperty(name="Realtime post process", description="Realtime post process", default=False, update=update_renderpath) lnx_clouds: BoolProperty(name="Clouds", description="Enable clouds pass", default=False, update=assets.invalidate_shader_cache) lnx_ssrs: BoolProperty(name="SSRS", description="Screen-space ray-traced shadows", default=False, update=assets.invalidate_shader_cache) lnx_micro_shadowing: BoolProperty(name="Micro Shadowing", description="Use the shaders' occlusion parameter to compute micro shadowing for the scene's sun lamp. This option is not available for render paths using mobile or solid material models", default=False, update=assets.invalidate_shader_cache) From a48ec4d0344ba899cf665eeb38172a21caed7880 Mon Sep 17 00:00:00 2001 From: Onek8 Date: Sat, 7 Jun 2025 21:12:31 +0000 Subject: [PATCH 6/6] t3du - Fix DoF references and small changes --- leenkx/blender/lnx/write_data.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/leenkx/blender/lnx/write_data.py b/leenkx/blender/lnx/write_data.py index 3716770..a613815 100644 --- a/leenkx/blender/lnx/write_data.py +++ b/leenkx/blender/lnx/write_data.py @@ -818,16 +818,17 @@ const int compoChromaticSamples = {rpdat.lnx_chromatic_aberration_samples}; focus_distance = 0.0 fstop = 0.0 - if len(bpy.data.cameras) > 0 and bpy.data.cameras[0].dof.use_dof: - focus_distance = bpy.data.cameras[0].dof.focus_distance - fstop = bpy.data.cameras[0].dof.aperture_fstop + if len(bpy.data.cameras) > 0 and lnx.utils.get_active_scene().camera.data.dof.use_dof: + focus_distance = lnx.utils.get_active_scene().camera.data.dof.focus_distance + fstop = lnx.utils.get_active_scene().camera.data.dof.aperture_fstop + lens = lnx.utils.get_active_scene().camera.data.lens if focus_distance > 0.0: f.write( """const float compoDOFDistance = """ + str(round(focus_distance * 100) / 100) + """; const float compoDOFFstop = """ + str(round(fstop * 100) / 100) + """; -const float compoDOFLength = 160.0; -""") # str(round(bpy.data.cameras[0].lens * 100) / 100) +const float compoDOFLength = """ + str(round(lens * 100) / 100) +"""; +""") #160.0; if rpdat.rp_voxels != 'Off': f.write("""const ivec3 voxelgiResolution = ivec3(""" + str(rpdat.rp_voxelgi_resolution) + """, """ + str(rpdat.rp_voxelgi_resolution) + """, """ + str(rpdat.rp_voxelgi_resolution) + """);