Controlling Vantage by maxscript ?

Dear Chaos,

Is it possible to controle Vantage in Live link throug Maxscript?

Kind regards,
Christian.

Hi Christian,

This is currently not possible Can you give more information on what do you want to control via Script?

Best regards,
Alexander

We have a new product that we call the cloud configurator. This is a front-end online web environment which sends instructions to a back-end PC on our office. The back-end is now a raytraced Unity environment but we would like it to be an Vantage environment because it’s much nicer and easier to make. Things we would like to configure in such environment is endless. From moving walls to switching furniture, materials, colors, scenes and so on. If we could do this through max while in Live Link mode where we in max switch layers, add materials etc. and then Vantage give an instruction to render it to a path then we could upload the image to the web again.

This would be a huge advantage to us.

Would a general scripting language like Python work for your use case? We already have such a request from other clients and it’s on our TODO list.

Sure, that is also an option. We work generally in c# but Python is also a possibility.

From moving walls to switching furniture, materials, colors, scenes and so on. If we could do this through max while in Live Link mode where we in max switch layers, add materials etc. and then Vantage give an instruction to render it to a path then we could upload the image to the web again.

From what I understand, the only piece that’s missing here is the ability to send Vantage a command (while the live link is running) to render to a specific path.

All the other stuff you mentioned is something that should be possible with max script already, I guess ?

Greetings,
Vladimir Nedev

Hi Vladimir, if that’s already possible how can we adress live link then? Which commands does Live Link use now in 3Ds max? And if we can mimic the animation render button with only one frame it’s going in the direction of what we have in mind.

I mean all the stuff you mentioned about changing the scene through script is not specific to Vantage or even V-Ray.
You just execute some (max script) commands to change the scene and (I guess) the live link should update.

Have you tested this ?

Greetings.
Vladimir Nedev

We didn’t tested this but I assumed it was possible. But maxscript is not something we are good at, at the moment. A command line approach would be easier to start. But if it’s possible with maxscript and we can render from maxscript it is a solution which we can live with.

A command line approach would be easier to start.

I assume you mean sending commands to Vantage directly (no 3ds Max/V-Ray/live link running) ?
It would take quite a bit of time to implement all the possible commands you might want.

On the other hand, they should already be possible through max script (or Python scripting in 3ds Max if you prefer that).

Greetings,
Vladimir Needev

So if I understand it correct, it is possible to give with maxscript a render command to vantage with a custom outputh path, samples and noise threshold? Is it possible to give an example maxscript code we can test?
Then the ony thing we need to do is connecting maxscript as a listener to a front end website.

To clarify what Vladimir is saying. 3ds Max allows you to modify the scene through maxscript and Python and V-Ray should detect scene changes while IPR is running (Live link uses IPR) and send them to Vantage. You can do a lot of things this way, but there are some things outside the scope of the Max scene. For example you won’t be able to toggle the opacity setting in Vantage and stuff like that.

Then we have a command that we use for the “render animation” button in the Vantage toolbar in Max, which internally uses maxscript and communicates with vantage.exe over localhost HTTP protocol. You could use this to start a render, though it may be a bit tricky to use (maxscript is not made for asynchronous code). It is was not intended for use directly by end users, but it might work for you…

Yeah, this could work. The opacity mode we can enable by hand after the live link is initialised. What is the code snippet you use with the render animation button so we can test it?

The relevant script is: C:\Program Files\Chaos Group\Vantage\dcc_scripts\3dsMax\Vantage-UtilityFunctions.ms (again, this is not a public API)

Basically the command is a JSON object (text) which is sent as the body of a HTTP POST request.

You can use or imitate the code in VRayVantage_startVantageSequence (which in turn calls VRayVantage_sendVantageCommand). It requires that live link is already running, of course. If you want to also make the script wait for this to finish it gets a lot more complicated though.

Noise threshold is not currently one of the command parameters, so it has to be set in advance in Vantage. (And opacity was just an example, there are many render settings, post-processing settings, etc. that you can’t control through a http command or through live link currently).

We finally got it working, thanks npg!!!

The time the image updates is a bit slow (about 7 seconds in total) but we could make this faster if the export is an JPG file (faster saving, upload an download).Triggering the save screenshot button after say 1 second of rendering could also speed up things. Besides this, if we could send the instructions directly to Vantage this would also save us some seconds.

So hopefully all of this will be possible in the future because then the possibilities could be endless.

You can try our demo here:
https://xr-group.nl/Apps/CloudRendering/CR\_Frontend\_PKVantage\_2/

That’s very interesting !
Can you list the exact steps you are doing, so we can figure out how to improve the responsiveness in the easiest way possible ?

Greetings,
Vladimir Nedev

VR-studio, I implemented saving to jpeg today (using the excellent libjpeg-turbo library). I made a quick test with a couple of scenes. Depending on the image contents the speedup compared to PNG at 720p is roughly as follows: 120 down to 20ms for a simple image with little detail and 440 down to 50ms for a more complex scene. The files are also about 3 times smaller.

We haven’t implemented this earlier because it didn’t seem necessary and JPG is a lossy format (you can always convert png to jpeg later). But we never imagined your particular use case.

This feature will come with the next Vantage update, but I’m not sure exactly when that is. I hope you can wait a bit :slight_smile:

That’s super cool!
I’m also interested in whats needed to get that working

Hello!
A little follow up; We have been using this to great effect. I am currently building a turntable rendering function, which uses a combination of this, with the VRaySDK. however I have noticed that if I have a VRayScene with an animated camera in it, and then proceed to post something like:

$““command”:“startLiveLinkSequence”,“path”:\ “{URL}”, “width”:”
+ 800 + “, “height”:” + 800 + “,“samples”:5”, “startFrame”:0, “endFrame”:11";

It does not render beyond frame 0, furthermore, once the livelink is established, I cannot even drag the timeline to another frame (or rather, i can, but the animation does not follow). is there any way I could tackle this issue?​