From 8631ff0a89601c65b7cbf8028963c8b65c7cb729 Mon Sep 17 00:00:00 2001 From: Ysaline Willm Date: Tue, 9 Dec 2025 21:44:40 +0100 Subject: [PATCH 1/3] =?UTF-8?q?feat=20(visite=20360)=20:=20ajout=20type=20?= =?UTF-8?q?de=20cam=C3=A9ra=20panoramique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- render-scene-fast.py | 38 ++++++++++++++++++++++++++++++++++---- render-scene-import.py | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/render-scene-fast.py b/render-scene-fast.py index 2f6e2b7..9109f28 100644 --- a/render-scene-fast.py +++ b/render-scene-fast.py @@ -46,6 +46,8 @@ camera = bpy.context.active_object +print(f'Creating camera of {cameraType}') + # creation de la caméra en fonction du type if cameraType == 'perspective': aspectRatio = cameraValues[1] @@ -59,7 +61,36 @@ camera.data.angle = float(fov) camera.data.clip_start = float(znear) camera.data.clip_end = float(zfar) - + bpy.context.scene.camera = camera +elif cameraType == 'panoramic': + # Supprime toutes les caméras existantes + bpy.ops.object.select_all(action='DESELECT') + bpy.ops.object.select_by_type(type='CAMERA') + bpy.ops.object.delete() + + scene = bpy.context.scene + # WIDTH, HEIGHT = 8192, 4096 + WIDTH, HEIGHT = 800, 400 + SAMPLES = 128 + + scene.render.engine = 'CYCLES' + scene.cycles.samples = SAMPLES + bpy.ops.object.camera_add(location=(positionX, positionY, positionZ), + rotation=(orientationX, orientationY, orientationZ)) + camera = bpy.context.active_object + + scene.camera = camera + camera.data.type = 'PANO' + + try: + camera.data.cycles.panorama_type = 'EQUIRECTANGULAR' + except AttributeError: + if hasattr(camera.data, "panorama_type"): + camera.data.panorama_type = 'EQUIRECTANGULAR' + + scene.render.resolution_x = WIDTH + scene.render.resolution_y = HEIGHT + scene.render.resolution_percentage = 100 else: znear = cameraValues[1] zfar = cameraValues[2] @@ -70,8 +101,7 @@ camera.data.ortho_scale = float(xmag) camera.data.clip_start = float(znear) camera.data.clip_end = float(zfar) - -bpy.context.scene.camera = camera + bpy.context.scene.camera = camera # on change la position du soleil sun = bpy.data.objects["__render_sun"] @@ -81,4 +111,4 @@ hdrMapSunRotation = 0.86924 bpy.data.worlds["World"].node_tree.nodes["Mapping"].inputs[2].default_value[2] = hdrMapSunRotation - sceneSunRotation -print(f'--- render-scene-fast-import.py execution time: {time.time() - startTime} seconds ---') +print(f'--- render-scene-fast-import.py execution time: {time.time() - startTime} seconds ---') \ No newline at end of file diff --git a/render-scene-import.py b/render-scene-import.py index 0b5e583..0c3bf15 100644 --- a/render-scene-import.py +++ b/render-scene-import.py @@ -563,6 +563,8 @@ def applyCustomColorToMaterial(material, colorToApply): camera = bpy.context.active_object +print(f'Creating camera of {cameraType}') + # creation de la caméra en fonction du type if cameraType == 'perspective': aspectRatio = cameraValues[1] @@ -576,7 +578,36 @@ def applyCustomColorToMaterial(material, colorToApply): camera.data.angle = float(fov) camera.data.clip_start = float(znear) camera.data.clip_end = float(zfar) + bpy.context.scene.camera = camera +elif cameraType == 'panoramic': + # Supprime toutes les caméras existantes + bpy.ops.object.select_all(action='DESELECT') + bpy.ops.object.select_by_type(type='CAMERA') + bpy.ops.object.delete() + scene = bpy.context.scene + #WIDTH, HEIGHT = 8192, 4096 + WIDTH, HEIGHT = 800, 400 + SAMPLES=128 + + scene.render.engine = 'CYCLES' + scene.cycles.samples = SAMPLES + bpy.ops.object.camera_add(location=(positionX, positionY, positionZ), + rotation=(orientationX, orientationY, orientationZ)) + camera = bpy.context.active_object + + scene.camera = camera + camera.data.type = 'PANO' + + try: + camera.data.cycles.panorama_type = 'EQUIRECTANGULAR' + except AttributeError: + if hasattr(camera.data, "panorama_type"): + camera.data.panorama_type = 'EQUIRECTANGULAR' + + scene.render.resolution_x = WIDTH + scene.render.resolution_y = HEIGHT + scene.render.resolution_percentage = 100 else: znear = cameraValues[1] zfar = cameraValues[2] @@ -585,8 +616,7 @@ def applyCustomColorToMaterial(material, colorToApply): camera.data.type = 'ORTHO' camera.data.ortho_scale = float(xmag) - -bpy.context.scene.camera = camera + bpy.context.scene.camera = camera bpy.ops.wm.save_as_mainfile(filepath=f"./cache/scene-{sceneEnvironment}-{session}.blend") @@ -594,4 +624,4 @@ def applyCustomColorToMaterial(material, colorToApply): print(f'--- render-scene-import.py execution time: {time.time() - startTime} seconds ---') print(f'importedObjectsCount: {importedObjectsCount}') print(f'importedMaterialsCount: {importedMaterialsCount}') -print(f'importedColorsCount: {importedColorsCount}') +print(f'importedColorsCount: {importedColorsCount}') \ No newline at end of file From f00fb7a4b470eda8edaf85f3b8da9fa06e85b1cc Mon Sep 17 00:00:00 2001 From: Ysaline Willm Date: Mon, 2 Feb 2026 15:35:47 +0100 Subject: [PATCH 2/3] =?UTF-8?q?feat=20(360tour)=20:=20on=20remet=20les=20p?= =?UTF-8?q?aram=C3=A8tres=20sur=208k=20pour=20les=20rendus=20panoramiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- render-scene-fast.py | 3 +-- render-scene-import.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/render-scene-fast.py b/render-scene-fast.py index 9109f28..1591b8f 100644 --- a/render-scene-fast.py +++ b/render-scene-fast.py @@ -69,8 +69,7 @@ bpy.ops.object.delete() scene = bpy.context.scene - # WIDTH, HEIGHT = 8192, 4096 - WIDTH, HEIGHT = 800, 400 + WIDTH, HEIGHT = 8192, 4096 SAMPLES = 128 scene.render.engine = 'CYCLES' diff --git a/render-scene-import.py b/render-scene-import.py index 0c3bf15..9ce640e 100644 --- a/render-scene-import.py +++ b/render-scene-import.py @@ -586,8 +586,7 @@ def applyCustomColorToMaterial(material, colorToApply): bpy.ops.object.delete() scene = bpy.context.scene - #WIDTH, HEIGHT = 8192, 4096 - WIDTH, HEIGHT = 800, 400 + WIDTH, HEIGHT = 8192, 4096 SAMPLES=128 scene.render.engine = 'CYCLES' From ab4c09a487174ced415e7ed28fb9bd80dfcd7d22 Mon Sep 17 00:00:00 2001 From: Ysaline Willm Date: Fri, 6 Mar 2026 18:24:19 +0100 Subject: [PATCH 3/3] feat (visites): ajout gestion webp pour les rendus panoramiques --- render-scene-fast.py | 17 +++++++++++++++-- render-scene-import.py | 11 ++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/render-scene-fast.py b/render-scene-fast.py index 1591b8f..d5769c5 100644 --- a/render-scene-fast.py +++ b/render-scene-fast.py @@ -72,15 +72,28 @@ WIDTH, HEIGHT = 8192, 4096 SAMPLES = 128 + scene.render.image_settings.file_format = 'WEBP' + scene.render.image_settings.color_mode = 'RGB' + scene.render.image_settings.color_depth = '8' + + if hasattr(scene.render.image_settings, "webp"): + ws = scene.render.image_settings.webp + ws.quality = 85 + ws.lossless = False + if hasattr(ws, "alpha_quality"): + ws.alpha_quality = 100 + elif hasattr(scene.render.image_settings, "quality"): + scene.render.image_settings.quality = 85 + scene.render.engine = 'CYCLES' scene.cycles.samples = SAMPLES + + # Ajoute la caméra et configure-la bpy.ops.object.camera_add(location=(positionX, positionY, positionZ), rotation=(orientationX, orientationY, orientationZ)) camera = bpy.context.active_object - scene.camera = camera camera.data.type = 'PANO' - try: camera.data.cycles.panorama_type = 'EQUIRECTANGULAR' except AttributeError: diff --git a/render-scene-import.py b/render-scene-import.py index 9ce640e..674560b 100644 --- a/render-scene-import.py +++ b/render-scene-import.py @@ -589,12 +589,21 @@ def applyCustomColorToMaterial(material, colorToApply): WIDTH, HEIGHT = 8192, 4096 SAMPLES=128 + scene.render.image_settings.file_format = 'WEBP' + scene.render.image_settings.color_mode = 'RGB' + + if hasattr(scene.render.image_settings, "webp"): + ws = scene.render.image_settings.webp + ws.quality = 85 + ws.lossless = False + elif hasattr(scene.render.image_settings, "quality"): + scene.render.image_settings.quality = 85 + scene.render.engine = 'CYCLES' scene.cycles.samples = SAMPLES bpy.ops.object.camera_add(location=(positionX, positionY, positionZ), rotation=(orientationX, orientationY, orientationZ)) camera = bpy.context.active_object - scene.camera = camera camera.data.type = 'PANO'