Description
Principaux enseignements
- Learn the basics of 3ds Max SDK for plug-in development.
- Learn about the use of scripting languages and tools in 3ds Max.
- Learn tips and tricks for learning 3ds Max SDK and scripting tools.
- Learn how to port MaxPlus code to pymxs and learn Design Automation for 3ds Max.
Intervenant
- DGDenis GrigorI like to know how everything works under the hood, so I am not afraid of low-level stuff like bits, buffers, pointers, stack, heap, threads, shaders and of course Math. Now I am slowly specializing on 3D for Web, from raw WebGL to libraries and frameworks with different levels of abstractions. I like to speak C++ (mostly with modern dialect) and Python, but I also started to like my new "tool” named Go.
DENIS GRIGOR: Hi, everyone. Welcome to the beginner's guide to learning 3ds Max and its SDK components. Welcome to this session. First warning is that this is not a guide for learning 3ds Max. This is more about the SDK components, kind of the programming. So how to get started, where to start, what to look at, and things like that, because it could be overwhelming depending on what you want to achieve.
The second warning is that in these slides I will go quickly over the things where to start, what to look into things, and so on. But the most-- let's say the meat of this presentation will be with code snippets and things like that in hands out. So if you are interested in something like step by step and things like that to be on your own pace, I will put a lot of effort in giving you a good handout. This one is more like a brief explanation of that, and I will point about different things.
So again, this is for developers or wanting to be developers, or everyone who wants to see what actually it contains, the SDK, what it's capable, what are the options, and so on and so forth. So if we look at the agenda, of course, I separate it two parts. In first part we will talk about the main tools for plugin development, so what languages are available. What are the strengths and weaknesses of each tool.
We will touch some tips and tricks for using and learning the SDK, so support. And this part, let's say sincerely for an experienced developer or experienced plugin developer, this will be not very interesting. For someone who is just starting, might be interesting and even may be overwhelming. This is why, again, I'm pointing to the hands out where I will put everything in the order.
The second one will be-- we'll talk about something beyond desktop development. So OK, you already have your tool. You have your plugin and things like that. So is it possible to automate them, running it in the cloud, and things like that? So this actually will be more interesting for the seasoned developer. But of course, for beginners, it's also interesting to see where actually you can head to because, as I like the saying, if you don't know where you're heading, no port is favorable or harbor is favorable.
OK, so let's start with the very first part, the main tools for plugin development, what we have at hand. We have a bunch of ways to write plugins, and it depends on the scope. It depends on your proficiency. It depends how much time do you want to dedicate. It depends on what actually you expect. So what is your hardware, what is the performance, and things like that.
And actually I put it on purpose. I grouped in the three columns. So as you can see here, the mock script and the Python SDK. We will see later why they come together. The same thing, C++ SDK and .Net SDK, where they come together. And somehow orphan is the Max Creation Graph. I will touch it very briefly. Because it's a separate thing, it's not based programming UI thing, I will show, of course-- illustrate some examples.
But this is not a real programming. Let's be sincere. It's more like to try out different things. However, I was astonished some people were doing a great job about that. But they were achieving a limit of performance because willingly or not it works on small scale, but if you want to do something more complicated, you will reach the limit of this technology.
And this is why kind of you have to know what tools or what is kind of the job-- what is the right tool for the right job and things like that. And the Max Creation Graph, at least for me, it's kind of on the side. Sometimes I use it. You should be aware that it has its own limitations. And again, we will discuss about that.
But let's take each tool separately and look at it and maybe even do some hands on programming, or at least show you what it looks like in order to do this programming. And we will start with, let's say, first class citizen for 3ds Max, MaxScript. So it's a scripting language that was developed specifically for 3ds Max. It is very simple and easy to use and it's an interpreted, so no compile thing. Compile is needed. You just go, code, run it, and it works.
And the good thing about it is that it's actually omnipresent. So we will see in the demo part that it's actually present everywhere, and you could easily do different things. Especially it's used for automating things, and there are a lot of things that you can do. And this is basically you should look at it if you want to customize the user interface, do some automation, and things like that, or use some kind of things.
Like let's say connecting two elements, and you want to know the distance and things like that. So it's something like-- to test some algorithms or things like that. Later I will show you that there is an option to use it also within C++, or vice versa. You can actually use C++ to extend it by writing some custom functions and things like that. But this important thing is that it's basically omnipresent.
And you can use it for basic things or you can even use it for crazy things. So I saw so many crazy things that people were doing with MaxScript. I was kind of shocked that it's possible. And let's say that one of the champions that-- I might say for me at least, one of the champions of the craziest things that is not related to graphics or let's say 3ds Max but it's integrated in 3ds Max.
It's basically a MaxScript used in order to create-- well, since we have Autodesk University is in Las Vegas, it's a MaxScript that creates basically a blackjack game. So imagine that everything is in screen, everything is run by MaxScript, and things like that. Well, later I will show you also that it's possible-- by the way, the AI is also implemented, so it's very interesting.
But it's a good example of how actually you can use the scripting language in order to do things that it was, well, not designed for, which shows its power. And you can do almost everything with it. So you could touch geometry, cameras, slides, rendering, particles, and things like that. Automate imports, exports, render, of course, materials and things like that. It's omnipresent. This is the word that I like to use because you can find MaxScript in any element of 3ds Max.
So just kind of a very, very brief illustration of what is kind of possible. As you can see here, we have a MaxScript listener. So basically we can write a MaxScript right away. But would like to show you-- to explain you that it's indeed omnipresent, I would like to show you another thing. So instead of doing here some code, something like-- OK, no, this is not yet.
For instance, this is a code that I will run later to illustrate to you. But the main idea is when I say that it's omnipresent, it means that it exists everywhere. And even when you are creating elements. So very interesting thing. Let's prepare here a page just to show you. It's a so-called macro recorder. So imagine that you want to do something and you want to repeat that, but you have no idea how actually to invoke that in MaxScript or use in MaxScript or things like that.
This is how actually you can enable this macro recorder and do things. So for instance, let's say I want to add here a cylinder. And now look here, that this is actually the call, the MaxScript call that is needed in order to create a cylinder. OK. Let me put it like the height segment will be more, and let me add to it something like a modifier, of course.
The band one is the one that is the easier to show and illustrate. And look here again. The mod panel, add modifier to the selection band. And let's change the angle. OK. You see a very simple operation, things like that. The cool thing about that-- let us reset the story. The scene. Copy this one. I will reset the scene. I will not save. And just an illustration how actually this flex-- how flexible this one is. OK. I could save all these actions that I did in the MaxScript.
So it serves two purposes. First of all, it's learning what actually I want. Well, I don't need this last action about resetting the file. But it shows you what are the MaxScript calls in order to do something, so adding an object, kind of adding a modifier, change the properties, and things like that. However, the second thing is that, as I said, it also can be served as a sort of like-- not only as a learning, but you could save these steps and replay them basically as a script.
So in this case, I'm just creating a new file, tools, and I'm evaluating all. And I will have exactly what I did before, because the MaxScript here just interprets these things. And of course, this is a very simple example of the basic that you could do, but you could start right now. Open 3ds Max, open the script listener, which is in scripting here.
Once you have the script listener, add the-- enable the macros recorder and do the job that you are doing, and it will record all the steps. Now select only the steps that you need and then use it. Now, imagine that could extend this something like, OK, I have one cylinder, but I need, like, 30 cylinders, put it in a circle, or things like that, and bending randomly or things like that. No problem. You already have the core here. And now comes for loops.
Now comes random numbers and so forth. So as you can see here, this is a very good way to start experimenting. And investing time in MaxScript will benefit a lot because you could automate a lot of things that you are doing. You could start writing complex things. And again, as a funny thing here is how in MaxScript in, like, what, 380 lines-- of course with comments-- written by Martin Habberstad in 2008, a game of tic-tac.
And as you can see here, it's also implementing AI, so it's quite interesting. It has logics and things like that implemented. So I will lose now. OK. And here I lost. So it implements also the AI part. So it's quite powerful. You have the UI part, so in MaxScript you of course can create the UI things with the spinners, buttons, and things like that.
And as I told you that it's kind of a very powerful. If you want to invest time in learning MaxScript, it will benefit a lot. Well, it's not that it will allow you to create a TikTok in-- tic-tac-toe in 3ds Max, but it will be very helpful in your day to day tasks. Let's keep for now-- let's stop the demo. I will come back to MaxScript when I will show you also other things. Let's go back to the presentation and go quickly for the next one, the Python SDK.
So the Python SDK is, let's say-- I cannot say it's a poster child. I cannot say it's a first class citizen because actually the Python SDK was brought to 3ds Max and the pymsx-- pymxs-- I always confuse this one. It's actually sort of a layer over the MaxScript. So the main purpose of this SDK is to facilitate the Python integration.
As I was showing you previously, yes, You can do a lot of things, automate, but sometimes you need something like, let's say NumPy. So it's a Python library specifically created for numerical operations, and it's kind of powerful having a lot of presetted functionality. And you would like to bring that into 3ds Max. With MaxScript, you are actually limited to MaxScript. If you bring Python, it basically opens you the world to the external libraries like NumPy.
And this is the main purpose is to facilitate bringing different libraries into 3ds Max, and Python SDK is actually a sort of a layer over the MaxScript. Even in documentation, you can see something like, OK, documentation for Python SDK is quite, let's say, not so rich as for MaxScript, but it's more or less one to one with MaxScript.
So once you understand the idea behind MaxScript, to translate it into Python is easy because it more or less follows the very same approach, but keeping in-- well, let's say taking into account the Python syntaxes, of course. So but 3ds Max comes with the Python 39. I think in the latest version it's already 3.310.
And the PySide2 is used in order to create the UI. So starting with-- oh, I don't remember in starting with which version 3ds Max brought QT. But right now the QT is the way to go in order to create your custom interface or custom UI. And the PySide2 is basically the, well, QT for Python used to link to the UI or create the UI component and link the Python to that UI.
So having this, of course, when would you use the Python SDK, Let's say over the MaxScript? Because we saw the MaxScript. Well, as I said, it's because you have access to a lot of libraries. And moreover, one of the most important thing compared with the MaxScript is that you will have a lot of developers, which already know Python. So compared with MaxScript you have to learn it from the scratch.
You have to invest some time in learning a language which is powerful in context of 3ds Max, but beyond it, it's kind of, well, useless. In case of Python investment, time investment in Python, worth because you can use it within 3ds Max, we can use it outside the 3ds Max. A lot of other application like Maya and Blender also use Python. So we see this is a skill that can be used, or it's a transferable skill, in other words.
And, well, let's do a short demo about-- yeah, let's do a short demo. It will be quite weak. But again, in hands out I will show you more sophisticated examples. I will even show you an example, a real example, or let's say a real life example about the sustainability and things like that.
Here I want just to show you the-- yeah, this is wrong. It's not MaxScript. It should be Python. But I will switch into Python, and as you can see here, you automatically can understand what it actually does, this script. I could even put it side by side something like creating a teapot in MaxScript to show you how-- basically how close it is to MaxScript. Well, actually, why should I spend time if I can just put the teapot here.
And I can see the call that it is here. Like teapot-- well, position I can ignore. It's selected. I can ignore. And reduce I can ignore. So basically in MaxScript I can just call something like teapot and that's it, and it will create for me with default values. So as you can see here, in order to use Python, it's basically pymxs library. It's a wrapper of MaxScript which has a runtime. And using this runtime, I'm doing all these calls.
So basically creating here a teapot while changing also the name of it. And it could get very sophisticated, especially when it comes to UI. It could become very complicated because you can embed here, again, libraries like NumPy and things like that. So it's very powerful. But again, first of all, it's not a first class citizen. So let's say that you feel it, that it's not native to 3ds Max.
The developing team is working on that to make it more integrable. But anyway, the MaxScript is here the king of the show when it comes to scripting, changing, and things like that. Let's go to the next one. OK. So now you already know why actually I group them together, because Python SDK by itself is a wrapper of the MaxScript, and the main purpose of it is, of course, to serve as a gateway to Python libraries into 3ds Max world.
Now let's go to the next column, which is C++ SDK and .Net SDK. And I will start with .Net SDK because, well, let's say that .Net SDK is the weakest of these two, and you will understand at the end why actually it is that. And well, again, the .Net SDK is provided a set of assemblies.
It can be used with managed language like C#, even C++, CLI, the manager part of C++, or Visual Basic .NET. And again, the purpose of this .Net SDK is sort of like to serve as a gateway for .Net world. And it's actually a wrapper over the C++. And this is why I say that it's weaker, because any time when you have a wrapper or something which is not native, willingly or not you have some loss in translation.
You have some kind of bugs or things like that or something that it was not well translated or not well covered and things like that. And this is why basically a .Net should be used only when you are-- you're in need with let's say the .Net libraries, or let's say that the .Net is the language of choice or things like that. Well, sort of mostly for interfacing with other .Net API components. This is the main purpose of the .Net API.
And I will not illustrate you, I will not do a demo on it because, well, it's quite simple. It's installed Max SDK and choose a managed language ID and things like that. And of course, the reference example. I would rather do that for C++ and then along the way we'll show you where actually you could use. But once you know the C++ part, the .Net is a piece of cake. And this is where actually is the meat of the plugin development, the C++.
This is sort of like king of the SDK in 3ds Max environment and it's used for doing everything in 3ds Max. Moreover, anything that you see in 3ds Max, even that teapot that we were creating, or cylinder or things like that is, of course, created as a plugin in 3ds Max. Almost everything that you see in the UI, different modifiers and things like that, are separate plugins. And we will see later that actually you can even look at the source code of some of them.
So even that band modifier is exposed as a sample. So basically a good part of the code of 3ds Max being created as a plugin is exposed, basically, as a sample. So we can see how actually it works under the hood. So as you can see, it's full of resources. You have the opportunity to see actually how Max is written and what is the format of writing a very good plugin. And of course, it has excellent interoperability with MaxScript.
Well, and .Net API. But with MaxScript it's important because technically you could write in C++-- or let's say the C++ is the way of extending the MaxScript. So if in MaxScript you are lacking some methods, some functions or things like that, well, C++ SDK is way to go in order to write that thing. So for instance, you have something like, OK, you hit some performance issues with the MaxScript.
Then you can just take that part, think how you can actually break it down, and integrate into or implement in C++, and then just expose the function to-- which is called the function publishing. Publish that function that will do the work using the C++, because C++ is compiled language and this is why the performance is the key here.
So again, C++ should be used when you need flexibility, performance, and basically anything that is-- let's say that anything that you want to do you should try first with MaxScript. And if you hit the performance, try the C++. Of course, the drawback is that C++ is quite hard to master and there's no-- well, it's not so easy to find good or skilled developers.
Let's say that if you're searching for Python developers, it's high chance that you will find a good one than C++. However, in C++ world, either you are good or you are not. It's easy to define. So this is the main drawback is that in order to get into that, it's quite complicated. And let us quickly switch to 3ds Max and see what is actually-- what it takes to write a plugin. And I will show you also what is covered.
So let us-- oh, yeah. Let us look at the how to part. So when you are downloading the SDK and in order to get your hands on SDK, you have to go to APS Autodesk, developer 3ds Max, and things like that. And here you have the SDK itself. And when you're downloading, you're not only downloading the SDK alone. So let me open it here.
Let's say it's on the C program files and Autodesk. And here we have the SDK. So when you download the SDK, you will have these kind of tools. And here the most important are the samples and how-tos. Samples itself is, as I told you, contains the code, a runnable code about different kind of things. As you can see here, the modifier meshes. So for instance, in meshes we have here the editor poly. I want to show you some objects. So for instance, the G sphere.
So if you're interested in donut, G sphere, cylinder, or things like that, the code is already here. But also there is another part is called how to, and it contains another part. For instance, a very good example here which I opened is the band modifier. So why it's not a sample but it's a how to, because it shows you but it's not the code that it's exist and is used in 3ds Max. It's mostly like an illustration, how to implement a vendor modifier.
Some kind of, let's say modifiers usually have some logic there. There's some optimization or things like that might be proprietary. But at least it shows you how to implement different things like of widgets, modifiers, and things like that. And you can see that it's-- it might look scary at first, but once you understand the logic, it gets easy. And moreover, some of-- not some, but many of these lines are boilerplate.
And the most interesting thing is that you see here, this was written in '95 and updated in 2000. So the one thing that is very interesting is that actually once you write the code, you have just to recompile it for the new version. Unless, of course, there is not something drastic happening, kind of deprecation of some libraries or things like that. But the most interesting thing is that actually it's runnable and it will be kind of transferable.
So it means that with the next update you will just have to recompile. So it's not super breaking change or things like that, and if you design it correctly, it could last for what now? Almost 30 years? So now let's create one from scratch just to illustrate you how actually easy. Yeah. It looks very complicated and things like that, but it's very easy because we will be relying on a so-called plugin wizard. So we'll create a plugin wizard.
We'll call it something like demoAU2023. Something like that. It will be here. Create next. And here comes the interesting thing. So basically, based on what type of plugin you want to create, it will create you the boilerplate. So for instance, if let's say you want to create a camera, then it will set up everything there. If you want to create an object, it will set up everything there. It will subclass from the needed class and things like that.
So the very first-- or let's say the simplest plugin that you could write that you could test also is the-- where it is? If I can find it. Yeah. Global utility plugin. And I will explain you later why actually this is the simplest when we will run it. So we'll put the ran. Here we'll put some category. I don't know. AU 2023 or something like that. Plugin description. This is mostly for you. And that's it. So it's kind of this is all that we need.
And as you can see here, we can specify that we want to use QT, but we will not do that. We will rely right now to the simplest one. Yeah. And it already should be here. OK. Let me pin this one to have it handy. And this is it. So this is basically the boilerplate that was created for you. And basically the-- the plugin is already here and ready to go.
So it means that you already can run it. And you already have the hints where actually you should do, where you should put the initialization part in case of the save, in case of loading like that. And this is basically the parts of the class itself. So you see, for instance, in this case, we are the global utility plugin. Object. Well, class. Without going into details and going into different things, let us run. But here is the very first important thing.
Don't run in debug, but run it in hybrid mode. In hybrid mode it will link with 3ds Max instance, and then you can run it. And once it is compiled and everything is done, it will automatically start a 3ds Max instance. And you could basically work it with breakpoints and things like that. It's necessary in order to integrate with product itself. So as you can see, very neat.
We just created in two clicks-- in a couple of clicks we created a boilerplate code that is already running and it already has something that we can test on our side. And why I'm using-- why I'm saying that this is very useful is because usually, let's say that you can distinct plugins in two categories. The very first one is the headless one. So it means that it could do something in background or without your interaction or things like that.
However, in order to debug that is kind of difficult, or if you want to test some logic, you will not rely on this category of plugins. You will rely rather on the second category of plugins, where actually you have to enable, push, and see the results. And this is the way how you can test some ideas, test things. The global utility plugin is in-- our plugin is in tools. Yeah.
Things here will pop up from our previous thing. Is in tools, and here we can search for it. And it was something like-- either it's this one or it's another one. I think it's this one. OK. And-- well, kind of have the interaction with the spinner and things like that. So it's basically showing you not only the plugin itself but also a dialogue and things like that. This is a child game. I mean that it's just kind of a toy right now. But this is how you start the things.
And if you will create something like another plugin, like a rendering plugin or object plugin or things like that, it will, again, create you a boilerplate that will be a skeleton. So it will be a not very interesting thing, but it will create you the skeleton for everything that you have, and it will be basically good to go to start and implement the logic. This is how you get started. By the way, a lot of things that I showed you here about the wizard.
In the hands out I will put-- well, actually I've already put the part where how to set up. So how to set up your Visual Studio in order to have this plugin, how to configure it in order to have this behavior. One click or a couple of clicks, and you already have a running plugin. And that's it, at least for now for this, for the C++ SDK. Again, it's very powerful. It's the most powerful tool when it comes to plugin development.
But of course, it's kind of the most difficult to master. You have to work a lot in order to create it. However, you will have the best performance and basically it's very rewarding. Now, we already looked at all these kind of types of plugins that we have. Let's say the next step that could be also like an incentive for you to start learning the plugin development is to start to share these plugins.
Of course, you can monetize, you can share them freely, you can create demos and things like that. So the very first and easy or the simplest way to monetize or to share your plugin is through so-called Autodesk App Store. And I think it will be better if I will show you on the screen. All right, here. If I will put something like apps.autodesk.com and here you will have four different things. We're interested in this session with 3ds Max.
And of course, here you have the learning one. You have the-- you can filter for categories. So for instance, this one is created by my colleague and maintained by my colleague which shows you how to create a very simple plugin in order to create something like explode geometry. So you are creating a geometry, and it will basically prepare it for explosion by separating different phases and creating geometry or extruding them and creating volume and things like that.
By the way, this one is available as a sample on GitHub, and I have-- we have there not only the .Net implementation, but also the Python implementation. So I was responsible for updating the Python implementation for this very sample just to show you that it's possible. And again, this one, for instance, is free. But you can monetize your plugin once it is ready. And it's a very nice tool because it's basically you can click on it and automatically it self-installs on your instance of 3ds Max.
Very convenient. So the very-- let's say the way to go when you want to share your work. And this concludes the very first part of this presentation where actually I showed you the tools and things like that. And I want to use this opportunity to share you yet another step. So imagine that you created some plugins that are generating things or processing some things, or you want to process the 3ds Max kind of files.
Let's say you have something like, OK, I have thousand of 3ds Max files and I want to extract the textures from every 3ds Max file. So you can, of course, do that on your machine, opening, saving or exporting, and things like that. However, this is kind of the next step when actually you can automate that. And by the way, I say here that process your design in the cloud, but technically this approach is-- let's say the cloud is the extreme way of it if you want to automate.
So for instance, you can say something like, again, we have those thousand of 3ds Max file and you can send in the cloud not in a sequential way, but in parallel way. But in hands out, I will also include how you could do that on your own computer. So basically this is the workflow. Before sending to the cloud, you actually have to debug on your computer. So if you have to debug on your computer, it means that you actually can automate also or use this approach in order to automate on your computer.
But this will be a very good kind of example of how you can develop some plugins that will be used in the 3ds Max context in 3ds Max instance running in the cloud. And what are the requirements I will also kind of explain. Before going that, I will just tell you that I will be using design automation as an illustration. And it's very easy to reach its APS.
We're interested in cloud technology and the design automation. Did I miss it? Yeah. Design automation. And this is basically the API to do that. It's a REST API, so it's very easy to master. However, again, it might look daunting at first, but you will see that it's kind of nice. And at the end of this one, I will show you a project that I did a while ago that illustrates why it is a neat thing and how you could do something similar with some warnings, of course.
When it is good to go to use and when it is not. So the design automation uses the following concepts. Engine, activity, appbundle, and work item. And basically the engine, you are specifying that what you want to run. In our case, we will specify that we want to run 3ds Max. But the very same APIs, very same workflow, approach, and things like that is working for AutoCAD, Inventor, Revit. Now it's added Civil 3D, and some new engines will be added along the way.
So the good thing is that once you master this approach, this is a transferable skill to other engines. And it uses the concept of activity to specify what you want to do and how you want to do. And we will see it in a minute in real time, sort of. And it's basically activity. I say it's like function definition. You are saying, OK, this is my inputs and I want this output. You can specify also libraries, and this is where your plugin comes in.
So I will show you later that, for instance, you could have a bunch of MaxScripts that you could bundle into a plugin. Or you could have a C++ one or .Net one that you could basically add into a bundle. And the good thing that it's reusable. So I mean that this plugin or a bundle format is reusable.
First of all, you could use it to publish on App Store because in order to publish in App Store, your plugin should satisfy some criterias. Basically not criterias, but it has to have a certain structure to specify which versions of 3ds Max it supports and things like that. But also, it's used here and also educates you how to assemble your bundle or your plugin. So for instance, you developed a plugin, but how should I distribute it or in which format should I distribute it?
So this is the way to go. Documentation contains how actually to assemble this bundle. And as you can see here, this is the format also used by design automation in order to add additional libraries. And the work item is the element that is basically you are invoking. This is something like invoking a function, providing certain parameters or certain objects. In this case, it's basically you could do a run in parallel.
So you can spawn hundreds of work items in parallel without any problem because it's async. So I mean that you send it a work item. Then either you can check the status or you can provide even a callback that will hit when the job is done. So the workflow is very simple. List the available engines. Pick the one that you need. Optional. Optional because it's not necessary. You could rely on the script I will show you in a minute.
Create an app bundle and upload it. Create the activity. Create work items. Start the job. And so forth. This is the workflow for design automation, and let's quickly go through-- I prepared here. So I'm using [AUDIO OUT] to show you the workflow. So of course, very first thing. Any time when we're using the platform is to use the notification. So basically any call is having the access token. We can list the available engines and I can see here that I already did that.
So we can see here that this is the supported things. We are interested only in 3ds Max ones, so we can see the versions that is supported. We can get the list of available activities or we can create an activity. And this is the interesting part is that you could-- in activity you could specify the script that you want to run upon. So in this case, let's say that in this very example, I want to get the list of all available renders in form of YAML file.
And this is the MaxScript that I will be invoking on 3ds Max. So for instance, in this case it will be something like, OK, run in the cloud 3ds Max, then run this script. This script will generate the YAML file. Then return me the YAML file so I can see what actually renders are available. These details and things like that, just to make sure that it's done, we can prepare where actually we want to put the YAML file.
So I won't say like, OK, I want this YAML file to be put here. The only requirement here is to be easy accessible. So mean that our cloud 3ds Max should be able to access this endpoint in order to put the results. And I'm sending the work item. Basically I'm saying something like, OK, send the work item, and it will be saying like, OK, it's pending. Check on me later. And when it is done, it will give you the status that it's success and things like that, and the result will be available in that file that we specified here.
So basically that file, we can access it and we can see the renders that are available on that instance. So now we can plan accordingly. This is the simplest possible activity that could be done. And it could get more complicated, which will involve different plugins, different calls, or things like that. So for instance, in this case I want to render a scene.
So basically if we are looking here in activity, we are specifying something like, OK, I will have an input file, an input 3ds Max file, and I want an output file to be kind of a PNG. And again, it's just a script. But this is, again, the simplest way. When it comes to something more complicated, something like, OK, render me all the cameras or things like that, then we have to rely on bundles. And this is, for instance, in my case, for instance-- in my case, I have here created a bundle.
As you can see, it has specific requirements. I created a bundle where actually I put all the MaxScript that I'm interested in. So this one is used-- let's say render me a camera with this kind of width and height. Create me a panorama at point and things like that, or render a view at this position with XYZ and this size and things like that. And these are the scripts that are ready to go, so exposed as functions, and I only invoke them when I need.
So as an illustration where I use this kind of approach is the very first-- the next example where actually I am integrating the 3D view of a 3ds Max scene. It's a web page where actually I can visualize the model, the 3ds Max model that I have. And what did kind of in this case is basically creating a plugin, or let's say an extension for this scene or this viewer, a render dialog, and the panorama rendering dialog.
So these two buttons. And once you click the button, you will be presented with an interface that will allow you to take snapshots. When you press the Render button, what happens is basically taking this 3ds Max scene, taking the data from the camera that I have in this, the browser, sending to design automation, and asking, OK, render me this kind of-- this scene from this camera, having the parameters, and send me back the rendered results.
And I can do that asynchronously, so it means that I can move around and things like that and it will render for me the images. Now keep in mind that this is done on the service, and to be sincere, I just accelerated here. And I showed that, for instance, for some images, it's taking five minutes, two minutes, and so on and so forth, until it finished the job. But this is the work that is done in the cloud. So it means that you can do whatever you want.
And the nice thing is that it will save the position that the render was taking and based on that, it will show you, OK, this is the point that you asked. This is the result of the rendering. And it's a very neat thing. And the same thing or almost the same approach is for panorama. So when you are clicking the render me from this point, it will basically take the position where the camera is and use this point in order to create your panorama.
And this was done through those scripts. There is no performance issue here from the scripting point of view because it's just invoking the rendering. The only problem with this kind of approach is that, well, this is just an illustration what is possible, but it's not very well optimized. Because what I showed you is the worst case scenario. When we are rendering in the cloud a scene on virtual machine in the cloud, which is not optimized for rendering.
So this could not be translated in the rendering form. A rendering form is optimized. It will break your rendering zone into small rendering zone and each machine will receive just a rendering zone and so forth. So it's more optimized for that one, but I hope that it's illustrated you the maximum that you could achieve. So basically we started from hello, world plugin or hello, world script, MaxScript, and we progress through C++ and creating a plugin.
And then we looked at the automation, and this is basically the maximum that you can achieve. To write plugins that could be run in the cloud and automate at maximum your work. I hope this is the conclusion that you had. Now let us quickly do a retrospective of what we have at hand here. On purpose I took away the .Net and the Max Creation Graph because these are the workhorse that will be used in order to create your plugins.
And as I said, you have to know what is the right tool for the right job. So for instance, if you're interested in something like quickly and no compilation needed and things like that, MaxScript is way to go. However, as I said, that it's specific only to 3ds Max, and you must understand that. Anyway, it's interpreted language, so even if it's no compilation required, even if it's quick and even it has no compilation required, it has its limits.
So if you want to do something extraordinary and things like that, you will hit the limits. That's for sure. The performance limits. And the good thing is that it's extensible through C++. So it means that you can extend it and bend it to your own needs. And again, as I said, it's omnipresent in 3ds Max. Anything that you can see or touch in 3ds Max 100% has a MaxScript for that, to call, to invoke, to set the parameter, to set the settings, and things like that.
Now in case of Python, the only drawback that I see-- well, of course-- again, it's interpreted language, so it also might be quick but with limits. The only drawback that I see is that it's not yet a first class citizen. You can feel it, that it's not native. This is the only drawback that I see, but it's a popular language.
You will easily find developers that know this language and will engage into that. And, of course, allow use of external libs and Python. I think it's champion at libraries, anything from machine learning, image processing, to, I don't know, tic-tac-toe. And C++ SDK, of course, is the king of the show because of the performance because, again, you can do anything in it for 3ds Max. I mean, the SDK itself, we basically cover everything.
Well, if you hit something that is not covered, it basically-- means that you became a champion in 3ds Max plugin development because for sure it's something related to maybe some graphic vectors, pixels not rendering well in your renderer, or something like not showing a helper nice or things like that.
So if you hit these kind of limits, there are, for sure, ways to overcome that. But if you hit these limits, it means that you become really proficient with the SDK. It has excellent interoperability with MaxScript, so not only it allows you to extend the MaxScript, but also it allows you to call MaxScript in C++.
There are cases where actually this is necessary. So for instance, someone created a plugin, and the only option of exposing that plugin to programmatically drive it is through MaxScript. No problem. So in our C++ plugin, we have the way to call that MaxScript and use it. Again, it's very powerful, well, because it's going to cover everything. It's compilable. And of course, the main drawback is that it requires good C++ skills.
When I say good, it means that beyond average. That for sure in order to make a useful plugin. And that's it from my side. Again, as I told you at the beginning, this is a very quick tour of what we have, how to do, and things like that. The hands out will go into it deeper and provide you more information.
And it will be not so quick so you'll have a nice pace of reading it. You cannot teach anyone in 60 minutes programming or things like that. That takes at least months. The only thing that I can recommend you-- so when I was showing you the-- when I was showing you the developer help. Here, let me quickly find it here. So yes, APS Autodesk.
Anyway, it will be in hand out. Not only you can download the SDK, but there is also here some tutorials. So this is like, I think a three hours long tutorial, which basically holds your hand through writing a C++ plugin, how to set up things, what are the classes that you need, what is the important things of each class or what to look at, and things like that. It's very, very, very nice one.
Very thorough. So this is the way to go if you want to start with 3ds Max SDK. And again, I hope you liked this presentation, and now you at least have a overview of what's possible and what you need in order to achieve what is possible. Yeah. So this is it from my side. I hope that you find this interesting. Yeah. Thank you for your attention.
Downloads
Étiquettes
Produit | |
Secteurs d'activité | |
Thèmes |