Set layer for Dynamic objects

Just playing around with dynamic instantiation.

		this.sceneObj = await Sc.create("Plane", {
			width: 0.1,
			height: 0.1,
			x: Math.random() - 0.5,
			y: Math.random() - 0.5,
			hidden: false,

It works fine, but how do I specify layer for this object? if I use “layer” key it throws an error.

I don’t see any way to get/set the layer in script. One solution would be to use render passes to control the rendering order.

I thought about it, but I found it really difficult to blend everything without strange results. Do I need to use blend node?

What I ended up doing is creating the empty null objects in your scene manually (with the correct order), and then adding dynamic objects into the proper null objects.

This also solves the problem that I couldn’t create a working particle system dynamically so I ended up having particle systems created in advance, in between the null objects that are used to put the dynamic objects in.


Yes, blend node is how I usually create layers. “Normal” mode is just alpha blending, but you have to be sure to set the background color on your scene render passes to be transparent.


I just found that render scene render passes could be stacked. By the way the order is reversed i.e. the most left objects will render behind.

1 Like