This commit is contained in:
chk
2026-05-30 13:32:03 +02:00
parent 35655de8b4
commit 261691b8d2
3 changed files with 63 additions and 1 deletions

View File

@@ -36,6 +36,22 @@
"sunEnergy": 0.35,
"areaEnergy": 120,
"exposure": -1.5,
"lensDirt": true,
"lensDirtStrength": 0.08,
"dofEnabled": true,
"dofFStop": 16,
"arucoDust": false,
"arucoDustStrength": 0.00005,
"localizedBlur": false,
"localizedBlurStrength": 0.15,
"vignette": true,
"vignetteStrength": 0.08,
"sensorNoise": true,
"sensorNoiseStrength": 0.01,
"lensDistortion": true,
"lensDistortionStrength": 0.002,
"materials": {
"wood": {
"baseColor": [0.72, 0.52, 0.33],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -59,6 +59,15 @@ def as_bool(value: Any, default: bool = False) -> bool:
show_skeleton = as_bool(rendering_info.get("showSkeleton", False))
show_markers = as_bool(rendering_info.get("showMarkers", False))
lens_dirt = as_bool(rendering_info.get("lensDirt", False))
lens_dirt_strength = float(rendering_info.get("lensDirtStrength", 0.08))
dof_enabled = as_bool(rendering_info.get("dofEnabled", True))
dof_fstop = float(rendering_info.get("dofFStop", 7.5))
aruco_dust = as_bool(rendering_info.get("arucoDust", False))
aruco_dust_strength = float(rendering_info.get("arucoDustStrength", 0.0005))
state: Dict[str, float] = {k: 0.0 for k in STATE_KEYS}
for source_name in ("defaultPosition", "recognized", "movements"):
source = robot.get(source_name, {}) or {}
@@ -413,12 +422,22 @@ cam_pos = resolve_vec3_m(rendering_info.get("cameraPosition", [-400, -700, 300])
cam_target = resolve_vec3_m(rendering_info.get("cameraTarget", [0, 0, 0]), state)
cam_obj.location = cam_pos
cam_data.lens = 50
if dof_enabled:
cam_data.dof.use_dof = True
cam_data.dof.focus_distance = (mathutils.Vector(cam_target) - mathutils.Vector(cam_pos)).length
cam_data.dof.aperture_fstop = dof_fstop
else:
cam_data.dof.use_dof = False
cam_vec = mathutils.Vector(cam_target) - mathutils.Vector(cam_pos)
if cam_vec.length == 0:
cam_vec = mathutils.Vector((1, 0, 0))
cam_obj.rotation_euler = cam_vec.to_track_quat("-Z", "Y").to_euler()
scene.camera = cam_obj
# ============================================================
# EXPORT CAMERA CALIBRATION (.npz)
# ============================================================
@@ -651,7 +670,34 @@ for link_name, link_info in links_def.items():
tex.image = image
links.new(tex.outputs["Color"], bsdf.inputs["Base Color"])
if aruco_dust:
noise = nodes.new("ShaderNodeTexNoise")
ramp = nodes.new("ShaderNodeValToRGB")
mix = nodes.new("ShaderNodeMixRGB")
noise.location = (-600, -220)
ramp.location = (-360, -220)
mix.location = (-120, -120)
noise.inputs["Scale"].default_value = 80.0
noise.inputs["Detail"].default_value = 1.0
ramp.color_ramp.elements[0].position = 0.49
ramp.color_ramp.elements[1].position = 0.51
mix.blend_type = "MIX"
mix.inputs["Fac"].default_value = aruco_dust_strength
mix.inputs["Color2"].default_value = (0.97, 0.97, 0.97, 1.0)
if aruco_dust:
links.new(tex.outputs["Color"], mix.inputs["Color1"])
links.new(noise.outputs["Fac"], ramp.inputs["Fac"])
links.new(ramp.outputs["Color"], mix.inputs["Fac"])
links.new(mix.outputs["Color"], bsdf.inputs["Base Color"])
else:
links.new(tex.outputs["Color"], bsdf.inputs["Base Color"])
links.new(bsdf.outputs["BSDF"], out.inputs["Surface"])
return mat