I have a double-sided material saved to an rmtl file. I want to load that in and then add an hdr environment texture to both front and back materials. I really have looked and looked and have found several examples by @jesterking , but none of the examples seems to be quite what I’m looking for (load a material from a file and add an hdr texture to it…much less to the front and back materials). To be fair, maybe one of his examples was what I was looking for, but maybe I’m just not quite smart enough to understand it, and it is all starting to making my head spin…document materials and render materials being created from each other for some reason and textures and childslots and parameters etc.
here’s an example of a base material I would like to modify…
Gem - Stylized - Amethyst.rmtl (19.9 KB)
and a code stub of what I could come up with so far…
#! python 2
import scriptcontext as sc
import Rhino.Render as rr
mtl_path = "path\\to\\my\\custom\\material\\Gem - Stylized - Amethyst.rmtl"
hdr_path = "path\\to\\any\\hdr\\will\\be\\fine.hdr"
mtl = rr.RenderContent.LoadFromFile(mtl_path)
fmtl = mtl.FindChild('front')
bmtl = mtl.FindChild('back')
# add hdr to the environment slot of the front and back materials here
sc.doc.RenderMaterials.Add(mtl)
10 posts - 2 participants