From ebaeafdb1206e3cbb3bcc37fd1d0efe9534326f4 Mon Sep 17 00:00:00 2001 From: vanous Date: Sat, 6 Jan 2024 18:07:11 +0100 Subject: [PATCH] Small gobo optimisations --- fixture.py | 9 +++++++-- gdtf.py | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fixture.py b/fixture.py index 048e4edc..faec932e 100644 --- a/fixture.py +++ b/fixture.py @@ -312,7 +312,7 @@ def build(self, name, profile, mode, universe, address, gel_color, display_beams for image in gobos: gobo = self.images.add() gobo.name = image["name"] - gobo.image = image["image"].copy() + gobo.image = image["image"] gobo.image.pack() links = {} @@ -335,7 +335,8 @@ def build(self, name, profile, mode, universe, address, gel_color, display_beams self.lights[-1].name = light_name self.lights[light_name].object = links[obj.name] if has_gobos: - self.lights[light_name].object.data.shadow_soft_size = 0 # non zero spot diameter causes gobos to be blurry + self.lights[light_name].object.data.shadow_soft_size = 0.001 # larger spot diameter causes gobos to be blurry + self.lights[light_name].object.data.shadow_buffer_clip_start = 0.002 elif 'Target' in obj.name: self.objects.add() self.objects[-1].name = 'Target' @@ -753,6 +754,10 @@ def updateZoom(self, zoom): for obj in self.collection.objects: if "gobo" in obj.get("geometry_type", ""): + beam_diameter = obj.get("beam_radius", 0) * 2 + if beam_diameter: + if gobo_diameter > beam_diameter: + gobo_diameter = beam_diameter obj.dimensions = (gobo_diameter, gobo_diameter, 0) for light in self.lights: diff --git a/gdtf.py b/gdtf.py index 3e3f83d8..894806bb 100644 --- a/gdtf.py +++ b/gdtf.py @@ -370,9 +370,8 @@ def create_beam(geometry): light_data.energy = light_data['flux'] #set by default to full brightness for devices without dimmer light_data.spot_blend = calculate_spot_blend(geometry) - light_data.spot_size = geometry.beam_angle - light_data.spot_size = geometry.beam_angle*3.1415/180.0 - light_data.shadow_soft_size = geometry.beam_radius # non zero spot diameter causes gobos to be blurry + light_data.spot_size = math.radians(geometry.beam_angle) + light_data.shadow_soft_size = geometry.beam_radius light_data.shadow_buffer_clip_start=0.0001 light_object = bpy.data.objects.new(name="Spot", object_data=light_data) light_object.location = obj_child.location @@ -381,12 +380,15 @@ def create_beam(geometry): constraint.target = obj_child collection.objects.link(light_object) - goboGeometry = SimpleNamespace(name=f"gobo {sanitize_obj_name(geometry)}", length=2, width=2, height = 0, primitive_type = "Plane") + goboGeometry = SimpleNamespace(name=f"gobo {sanitize_obj_name(geometry)}", + length=2, width=2, height = 0, primitive_type = "Plane", + beam_radius = geometry.beam_radius) create_gobo(geometry, goboGeometry) def create_gobo(geometry, goboGeometry): obj = DMX_GDTF.loadBlenderPrimitive(goboGeometry) obj["geometry_type"] = "gobo" + obj["beam_radius"] = goboGeometry.beam_radius obj.name = goboGeometry.name objs[sanitize_obj_name(goboGeometry)]=obj