Skip to content

Commit

Permalink
Small gobo optimisations
Browse files Browse the repository at this point in the history
  • Loading branch information
vanous committed Jan 6, 2024
1 parent 83c173a commit ebaeafd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 7 additions & 2 deletions fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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'
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions gdtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit ebaeafd

Please sign in to comment.