Referenced material

Forums: Referenced material
Forum for OctaneRender Lua scripting examples, discussion and support.

Referenced material

Postby manalokos » Mon Sep 28, 2020 1:33 pm

manalokos Mon Sep 28, 2020 1:33 pm
Hello

I would like to know if it would be possible with LUA to create a scripted graph that generates a material that is an instance of an existing material (group)
and that updates in parallel with any changes you might do the original material?

This would be a solution to a problem that we usually have, as sometimes we have much more objects than materials, and to connect via nodes a material to several geometries
can be complicated.
The best would be to have this possibility natively in Octane Standalone, where you could choose Material#23
and it would use the material connected to the port #23 of a "material master node", this would allow to change a specific material in all the scene, in all the geometries at once.


Kind regards
Filipe
manalokos
Licensed Customer
Licensed Customer
 
Posts: 438
Joined: Fri Nov 18, 2011 4:43 pm

Re: Referenced material

Postby jobigoud » Mon Sep 28, 2020 8:28 pm

jobigoud Mon Sep 28, 2020 8:28 pm
Hi,
I made a small prototype script to see if this could work. See if it works for your use-case.

It will look for materials nodes with the same name and type as the reference material you plug into the script and try to keep them in sync with it.

Please backup the scene before testing, I can't guarantee that it won't crash, destroy the wrong node, etc. Do let me know of any issue. In order to replicate the reference material, including textures and everything that could be attached to it, it needs to duplicate the entire node tree of the reference. This should work but it might be costly and if the reference material has expanded nodes they will be created at the original location which will make the whole graph weird.
Attachments
entangled-material.orbx
(105.12 KiB) Downloaded 240 times
entangledMaterial.lua
(2.47 KiB) Downloaded 236 times
User avatar
jobigoud
OctaneRender Team
OctaneRender Team
 
Posts: 230
Joined: Sat Aug 15, 2015 1:28 pm

Re: Referenced material

Postby manalokos » Tue Sep 29, 2020 2:16 pm

manalokos Tue Sep 29, 2020 2:16 pm
Hello jobigoud!

Thank you so much!
I gave it a try and I can confirm that it works pretty well for simple materials, but if you have a more complex material inside a nodegraph group with a material output, add a texture, or change connections it does not work that well... but it can be used for small tweaks in a pre-assembled material, but it will be messy since it can't be inside a group.

I am not sure that doing this by scripting will ever be stable enough, what do you think?
Maybe if it was the instanced materials that had a scripted operator that would fetch a Nodegraph with a specific name, and copy it and connect to it?

Kind regards
Filipe
manalokos
Licensed Customer
Licensed Customer
 
Posts: 438
Joined: Fri Nov 18, 2011 4:43 pm

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 3 guests

Tue Apr 16, 2024 10:27 pm [ UTC ]