MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / setup_world_hdr

Function setup_world_hdr

tools/cycles_reference/render.py:253–278  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

251
252
253def setup_world_hdr():
254 world = bpy.data.worlds.get("World")
255 if world is None:
256 world = bpy.data.worlds.new("World")
257 bpy.context.scene.world = world
258 world.use_nodes = True
259 nt = world.node_tree
260 nt.nodes.clear()
261
262 out = nt.nodes.new("ShaderNodeOutputWorld")
263 bg = nt.nodes.new("ShaderNodeBackground")
264 env = nt.nodes.new("ShaderNodeTexEnvironment")
265 mapn = nt.nodes.new("ShaderNodeMapping")
266 coord = nt.nodes.new("ShaderNodeTexCoord")
267
268 if os.path.isfile(OUTDOOR_HDR):
269 env.image = bpy.data.images.load(OUTDOOR_HDR, check_existing=True)
270 else:
271 print(f"[cycles_reference] WARNING: HDR not found at {OUTDOOR_HDR}", file=sys.stderr)
272
273 bg.inputs["Strength"].default_value = ENV_INTENSITY
274
275 nt.links.new(coord.outputs["Generated"], mapn.inputs["Vector"])
276 nt.links.new(mapn.outputs["Vector"], env.inputs["Vector"])
277 nt.links.new(env.outputs["Color"], bg.inputs["Color"])
278 nt.links.new(bg.outputs["Background"], out.inputs["Surface"])
279
280
281def add_sun(name, dir_bloom, color, strength):

Callers 1

mainFunction · 0.85

Calls 3

getMethod · 0.45
newMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected