Is it possible?

Started by DMerz III, December 01, 2015, 04:48:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DMerz III

I'm a little nervous that I am starting one of the first threads in this section.
This may be extremely hard to follow, but I'll do my best.
Will admit, I know nothing about scripting or python. I just read the Keyshot quickstart guide to scripting, and it got overwhelming pretty quickly.

BUT, I am not trying to tackle my problem alone. I do plan on consulting with a coder who knows how to write Python.

With that being said, I'd like to explain what it is I'm trying to accomplish, and I'm wondering if anyone can answer if it's possible or not before I go down the road of trying to hire someone to help me write this script.

Theoretically speaking:

Let's say I have a product. This product has many color ways, and not just at 1 level, but multiple configurations. (As an example) You can have a Silver case, with a Red buckle, and a Blue belt. Or you can have a Silver Case, with a Silver Buckle, and a Silver belt. Let's say each of these variables has between 5-10 options, and there are several combinations. When you matrix this out, there is a possibility in the thousands.

How this has been done before was, each combination had to be manually turned on/off to produce the correct result in the scene tree, then queued up and rendered. Then those combinations had to be renamed to something specific so it could be found in a directory and be descriptive enough to point to the configuration options.

What I'd like to know:

Is it possible to write a script that not only will cycle through these thousands of configurations, turn on and off the correct parts, queue them up for render, and be able to use the "part name" in the file output name (to save time on renaming).

If that wasn't completely hard enough, I'd also like to be able to do multiple viewsets as a variable.

I feel like this would be possible with the right script, and a very smart person who knows what to code. But if anyone has insights on parts of this that ARE definitely not possible. Please let me know.

THANK YOU SO MUCH IN ADVANCE, if you actually have an answer!







TpwUK

The options to cycle through can be achieved with embedded loops which is pretty standard coding, so a big yes for that part. As for injecting view-sets i am not sure. My coding skills are pretty poor at best with Python so i did not experiment much in this area during the beta phase so i am not sure if view-sets are open to scripting yet so we both need a better qualified person to enlighten us on that part.

Martin

Morten Kristensen

#2
Hello David,

Nothing to be nervous about. :)

You can indeed write a script that goes through a list of materials and then applying them as you want and/or hiding/showing different parts of your scene tree as well. I need more specifics but essentially, as Martin said, you'd loop over the values and apply them. For each iteration you can render to an image file or you can add to the local queue (using render option setAddToQueue()). The part name is exposed by interfacing with the nodes of the scene tree (lux.getSceneTree()) by calling the corresponding getName() function of a node.

Unfortunately, you can't set viewsets right now but you can change cameras and configurations. See: setCamera(), setCameraDirection(), setCameraLookAt(), setCameraPosition(), setCameraUp(), and setEnvironmentImage().

As an example, let's say you wanted to hide all nodes called something with "Silver" and show all nodes called "Case":

root = lux.getSceneTree()
for node in root.find(name = "Silver"):
    node.hide()
for node in root.find(name = "Case"):
    node.show()


I hope that helps you a bit? Don't hesitate to question further.
Thanks

DMerz III

Wonderful answers, thanks to both of you for your replies. This will definitely help us go in the right direction.
The view set variable isn't necessarily a make or break, just wondering the possibilities.

Thanks again, I'm sure I'll have some more questions soon.


Will Gibbons

Hi dmerziii,

Your question wasn't hard to follow at all! : )

I've been in your shoes in the past. Not knowing any scripting at all, I accomplished a nearly identical task. My client produces a sports wristband and he wanted to do something similar to Nike ID where the consumer can customize each color/part of the band. We did a front and rear view with 6 areas that could be customized with 12 colors, so yes, many color combos.

Here's the result: http://ionme.com/product/customize/

My solution wasn't quite as elegant as I'd have liked it to be. Here's what I did.

1. Queue up both front and rear view all parts solid color (so, 24 in total)
2. Export clown pass of both front and rear view
3. Load all into stack in Photoshop
4. Use clown pass to create a clipping mask for all 12 parts/channels
5. Put the 12 full-color renderings into a folder
6. Make a copy of the folder for each part/channel
7. Repeat process for rear view
8. If you wish, you could automate or record an action to toggle these layers on and off to export each combination from Photoshop.

The website coders took my Photoshop file and saved each part and wrote a corresponding code to turn on each layer/item otherwise it would have taken up too much bandwidth to host high-res. images of each combination.

Just wanted to share my experience with this kind of thing since the two or so years ago I did that, I'd have loved to know how to script it out in KeyShot.

Morten Kristensen

Thanks for sharing, Will.
Looks great :)

DMerz III

Awesome, thanks very much Will!

Will Gibbons