KeyShot Forum

Technical discussions => Extending KeyShot => Scripting => Topic started by: EjS on May 31, 2018, 11:57:29 PM

Title: New thread on change of materials
Post by: EjS on May 31, 2018, 11:57:29 PM
Hi All,

Just bought Keyshot, great program guys, very impressed!


So I'm picking up this thread about changing materials on nodes, here goes:
- I have an AI application which needs large amounts of training data
- I have potentially app. 800 step-files consisting of 2 nodes
- Let's say for each node there is 60 materials, and the items can have all combinations of materials on the 2 nodes
- Furthermore, I would like to have many camera angles and change properties of material/texture etc.

So I already done scripting and ran into the challenge that after first call of "setMaterialTemplate" I change out the content in the kmt file to change materials, however Keyshot does not update materials calling same material template again.

Instead tried to generate new kmt-files (with new folder and name) for each "setMaterialTemplate" call (instead of just updating same kmt file with new materials). This is working but generates and awful lot of folders and files.

So questions are:
1. is this the best (only?) approach to generate all the images I need for my AI product? It means 3.600 folders under "Material Templates" in Keyshot
2. Did not try yet: can kmt files in each "Material Template" directory call mtl files in another directory (e.g. Materials), because in this case I do not need to copy mtl files into each folder generated?
3. Does anybody have better ideas for forcing Keyshot to change materials?
4. Right now I have generated mtl files manually in the GUI. I plan to auto-generate mtl files or at least modify them, they seem to be pure text. However, there is a long text string after **** "attribute" "--MATMETA-- ... ****
Will mtl work if I leave it as is or is it some kind of code/checksum Keyshot needs to work correctly?
5. I was told by a short conversation with Luxion personnel that textures cannot be changed out like materials. However, I see texture settings in the mtl files. So if I'm able to change settings here I can change texture right?

Awaiting materials API in Keyshot 8  8)

Best regards
Esben
Talmo - Applied Vision
Title: Re: New thread on change of materials
Post by: eimclark on June 11, 2018, 06:39:49 AM
Have you tried using the Studios panel?
You can create multi-materials with as many combinations of colours, textures etc. and use the Studios panel to create studios that set the specific material from the multi-material. In this video you can see this in action.

https://www.youtube.com/watch?v=BPGx3W5f3wc (https://www.youtube.com/watch?v=BPGx3W5f3wc)