Skip to content

Instantly share code, notes, and snippets.

View soswow's full-sized avatar

Aleksandr Motsjonov soswow

View GitHub Profile
@soswow
soswow / irradiance-optimisation.py
Last active June 13, 2025 11:35
Some vibe coding I've been doing around Lambertian reflectance and how to position lights in front of a surface such that it illuminates it perfectly with least amount of contrast (diff between darket and lightest). IT was covered in three videos so far: https://youtu.be/O_toTbA5PNc https://youtu.be/-O-LlncUULM https://youtu.be/PtKmvTEz1Og
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from irradiance_studies_3d_corners import calc_irradiance_points
import time
from enum import Enum
class VisualizationMode(Enum):
OPTIMIZATION = "optimization" # Original optimization mode
CONTRAST_MAP = "contrast_map" # 2D contrast map at fixed Z
@soswow
soswow / blender-persistent.py
Last active August 2, 2025 10:36
Blender persistent xray feature
import bpy
def debug(msg):
print(f"[DEBUG] {msg}")
# Register custom properties
def register_properties():
wm = bpy.types.WindowManager
debug("Registering properties")
wm.xray_sync_enabled = bpy.props.BoolProperty(