Notifications
Clear all

[Closed] Create masks from layer

Hello guys,

I would like to know if any body knows how I could create masks for all layers including child layers in the scene.
Could find anything useful in the net.

If someone could give me a hint or further documentation I would highly appreciate it.

8 Replies

What is “masks” for all layers?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

It was my question

Corona crises, everyone must ware mask – no exceptions
And turn antivirus on

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

Ohhh… it makes sense now

Ha ha guys

Sorry, was so obvious for me.

I mean a alpha matte layer for usage in photoshop. Normally I’m using psd-manager for this task, but I would like to search for other ways.

To sum it, I would like to create one psd, exr or other format which can hold multiple alpha masks/mattes. One mask for each layer in the scene. I would prefer to not render every mask seperated but instead use the gbuffer from max. I think this is the same approach the psd manager does.

Step 1. Assign g-buffer IDs to layer nodes

for i = 0 to LayerManager.count-1 do
(
	local layer_nodes = #()	
	(LayerManager.getLayer i).Nodes &layer_nodes
	
	if layer_nodes.Count > 0 do
	(
		layer_nodes.gbufferchannel = i
	)
)

Step 2. Add render elements that suits your render engine

Great, thank you very much.
Will test it asap.

When I understand it correctly I need to create a render element for every layer node object. In vray this should be a MultiMatte or ObjectID element, if I’m not mistaken.

If this is correct, is it possible to create this render elements only temporary? When you rendering?

You can probably use #preRender and #postRender callbacks to add and remove these temporary elements, but I failed to make it work.
It seems like render element gets added too late and not present in the list in frame buffer. It would be great if someone could show a solution.

That’s the only way it works for me. Pre-render and Post-render script files
%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5