Menu Close

Category: Demisfying 3dsMax

How to share your awesome MCGs – MCG Installation and network deployment

MCG had a big changed in 3dsMax 2018. This post is based on 3dsMax 2018+.

One of the biggest changes was Improved MCG Package Installation Experience. Let me just norrow the words from dev.

“In previous versions of MCG, the package installation process of an .mcg file involved the automatic extraction of its contained .maxtool and .maxcompound files into the user’s 3ds Max /Max Creation Graph/Tools/Downloads directory. A consequence of this installation method was that common compounds would often conflict with each other, resulting in duplication messages.

In MCG 2018, we’ve simplified the package installation process to make it much more robust. You can now install a .mcg file by dragging it into the viewport. All installed packages now reside in the user’s 3ds Max 2018/Max Creation Graph/Packages directory, and are evaluated as standalone .mcg files. No more file extraction, no more conflicts, no more problems.”

Basically, 3dsMax will consume .mcg package file directly and use the compound in that package first to avoid compound version conflict. Now .mcg file act much like a plugin dll file.

Packaging MCG

MCG Editor > File > Package Tool Graph… will allow you to package the current tool graph and all compound in a .mcg file.

Installing MCG

It means just copying .mcg file into MCG package folder, and drag and dropping .mcg file into 3dsMax viewport will do that f or you. The MCG packages folder is in your user folder/Autodesk. 2018/2019 shares the same structure. But, 2020 MCG package folder is a slightly different.
C:\Users\[username]\Autodesk\3ds Max 2018\Max Creation Graph\Packages
C:\Users\[username]\Autodesk\3ds Max 2019\Max Creation Graph\Packages
C:\Users\[username]\Autodesk\3ds Max 2020\User Tools\Max Creation Graph\Packages

ProceduralContent.ms

Before I tal about network deployment. I need to mention about this file first. The mCG is implemented with dotnet and Maxscript. The engine is dotnet and UI and communicaion with 3dsMax portion id Maxscript. This means we can actually see the source of many MCG functions which are in C:\Program Files\Autodesk\3ds Max 2020\scripts\Startup\ProceduralContent.ms file. If you dissect this file, you can learn a lot about how MCG is working.

Custom MCG Path

By default, 3dsMax uses the above MCG folders. But, you can also have own custom path for MCGs. RegisterCustomGraphPaths function in ProceduralContentOps struct in  ProceduralContent.ms manages how to set the path.

By default, it is set to use 3dsMax.ini file, C:\Users\[username]\AppData\Local\Autodesk\3dsMax\2020 – 64bit\ENU\3dsMax.ini. You can type getMaxiniFIle() in Maxscript Listener to get your 3dsMax.ini file path

You can add MCG Compound Directories, MCG Tools Directories, MCG Package Directories sections and add path like this.

[MCG Tools Directories]
tools_dir=C:\path\to\my\tools
other_tools=C:\path\to\other\tools
[MCG Compound Directories]
common_compounds=C:\path\to\my\compounds
experimental_compounds=C:\path\to\experimental\compounds
[MCG Package Directories]
networkPackages=\\path\to\network\packages

Custom MCG path without using 3dsMax.ini #1

But, what if you do not want to use 3dsMax.ini. The one way of using own .ini file for MCG path would be modifying ProceduralContent.ms. Open the file,C:\Program Files\Autodesk\3ds Max 2020\scripts\Startup\ProceduralContent.ms, search “getMAXIniFile()”. Then, replace with whatever path you want.

fn RegisterCustomGraphPaths =
(
local iniFile = getMAXIniFile()
local settings = dotNetClass "Viper3dsMaxBridge.Settings"

Custom MCG path without using 3dsMax.ini #2

But, then you have to modify on all workstations and render node. That might be too much. The next methods is taking the function from ProceduralContent.ms and make own script.

If you check the code, you can see all the functionality is coming from Viper3dsMaxBridge.Main dotnet class. So, I check what kinds of methods it has with showMethods command. CompileGraphsByFolder is what we need. There are a lot more methods. But, I revmoed not to scare you.

bridge = dotNetClass "Viper3dsMaxBridge.Main" 
dotNetClass:Viper3dsMaxBridge.Main
showMethods bridge
.[static]CompileGraphsByFolder <System.String>folder
....

Now, this is the final maxscript you can use

local viperbridge = dotNetClass "Viper3dsMaxBridge.Main"
-- Just in case if Viper3dsMaxBridge.dll has not been loaded yet
if viperbridge == undefined then (
    local bridgePath = (symbolicPaths.getPathValue "$max") + @"\Viper3dsMaxBridge.dll"
    dotNet.loadAssembly bridgePath returnPassFail:true
    viperbridge = dotNetClass "Viper3dsMaxBridge.Main"
)
viperbridge.ReloadOperators()
viperbridge.CompileGraphsByFolder @"D:\myfolder1\"
viperbridge.CompileGraphsByFolder @"E:\myfolder2\

Put this in a .ms file like myMCGload.ms. Then, throw in one of your network shared plugin folder. I’m sure you probably already have a plugin folder for a free plugins. Any .ms fil in plugin folder will be automatically runs when 3dsMax start.

 

A few more things to know

  • mcg files are registered in 3dsMax file as an asset. It will show up in Asset Tracker and asset metadata stream.
  • If you use BackBurner and use Include Maps, .mcg filw will be submiited with the job like maps.
  • When 3dsMax starts in slave mode, it will automatically evaulate all .mcg file in the folder where the max files are. Therefore, if you use 3rd party render farm, all you need to do is put .mcgs in the same folder as max file. You don’t need to set any path.

I hope this post is helpful for MCGers.

3dsMax 2018 MCG improvement #1 – Easy Map / Live Types / Undo

3dsMax 2018 MCG has many fundamental core changes which make MCG easier to use/make for users. The MCG guru at 3dsMax dev team Martin has the introduction post of 3dsMax 2018 MCG on Area with awesome new sample packs. I’ll try to go over some of these changes here. Today let me talk about Easy Map / Live Types / Undo.

 

Easy Map

When you try to learn MCG, the first obstacle would be the understanding Map and Combine. Map/Combine is equivalent to for in other programming languages. It allows you to iterate a function through an array(or arrays).in 2018, Map operator actually renamed as For Each. Considering the most typical MCG task is doing something over a vertex/face array. This is probably the most important function in MCG world.

The problem was that how Map/Combine was presented in MCG editor was not that intuitive. You can not directly connect your input array to the connector of the function. You must leave the input connector open and draw the imaginary line in your mind to know which input goes where.

In 3dMax 2018 , you don’t need to use Map or Combine anymore for most cases. You can just directly connect input array to a function operator. Check out the following image. This is a simplified version of my ExtractDelta MCG modifier. I removed all error checking and stuff to make it easy/clear to see the core functions.

MCG_1_easyMap

What this modifier does is that, it read 2 objects and calculate the difference of vertex position between them and put that difference(delta) into the curent mesh.

Look at the calculate Detals. group. in 2017 graph. you need to use Combine to iterate over two vertex position arrays and subtract vectors from one array to another.

In 2017 graph(top). you need to use Combine to iterate over two vertex position arrays and subtract vectors from one array to another. The open connector of value1 is invisibly connected to the mesh vertices array of corrective shape. The open connector of value2 is invisibly connected to the mesh vertices array of original geometry.

in 2018 graph(bottom), you can see that you can just plug the two mesh vertice arrays into Subtract operator input.

The 2018 graph is more intuitive and a lot easier to understand what’s happening in the graph.

Next look at Add deltas to mesh group. After we got the deltas array, we want to multiply Amount input to the deltas and add the result to the vertex position of our current mesh.

In 2018, you can just directly plug delta array and Amount value to the Multiply Vector operator and plug the connection to Add operator. You don’t need to use Combine operator at all.

You can still use Map/Combine if you want to make your MCG backward compatible to the older version. If you use Easy Map method, your graph will be compatible with older version.

 

Live Type

Let me borrow the explanation from Martin’s blog.

One of the major challenges in previous versions of MCG was keeping track of all the types flowing through your nodes. If a problem crept up, you only knew about it when you tried to evaluate your graph, and that often meant doing some detective work based on an error message as your only clue.

In 2018, the types flowing through your nodes are updated as you wire them, so you know exactly where you’re going. If two types don’t match up, a red wire will indicate that the connection is incompatible or that the graph is incomplete.

So… what does this actually means in MCG graph? Let’s check out the above image again. If you see the output connector of Mesh Vertices operator and the input connector of Subtract operator in calculate Detals. group, 2017 graph connector label just shows as value(IArray). It doesn’t show what kinds of array this is. 2018 graph display the same thing as Array[vector3] to give more clear information. This labels will be dynamically updated as you update the connection. If you make a wrong connection,

Also If you make a wrong connection, for example trying to connect vector array and integer array for Add operator, the connection line color will be changed to red to show the input is wrong.

 

Undo

Finally you can undo your mistake in MCG editor! Ctrl+Z and Ctrl+Y.

OK. That’s al lto today.

FFmpeg plugin for 3ds Max 2015-2017(mp4/dpx decoder)

3ds Max magician Qinming released a free FFmpeg reader plugin for 2015-2017.

Basically you can read any image/video that FFmpeg supports directly in 3ds Max as background or map. For example, mp4, dpx and jpeg2000. Yes, finally you can read dpx!

More importantly, 2016 and 2017 version supports image cache option. You can play image sequence in real time. I tested with HD(1920×1080) resolution dpx sequence on my PC, i7-2600K with GTX 960. When cache was off, I got 6.4fps. When cache is on. I got 31.2fps!

Josef Wienerroither posted a great demo video on YouTube. Must visit!

Qinming included a detailed readme file.Therefore, I would not repeat how to install and things here.

Here is a few important things to remember.

Only FFVideo Plugin supports image cache. If you want to cache image sequence. You have to use IFL2 format. IFL2 is exactly same as IFL. Qinming just uses this extension to show a different setup dialog.

IFL2 also give us a very important benefit. IFL2 allow user read other natively supported format like jpg through this plugin. Why is this important? Let’s say you want to cache jpg sequence for your background. 3ds Max will try to read jpg using native jpg reader/writer. If you remove the jpg reader/writer bmi, you can make this plugin load jpg, But then you can’t write jpg since this plugin only read image files. So… if you want cache jpg sequence. just make IFL2 of jpg image sequence. Then this plugin will be used to read the jpg sequence instead of max native jpg reader.

The easiest way to make IFL2 file would be just making IFL as usual with Sequence checkbox and rename it.

sequence

Set Display Performance resolution same as image size. If you put smaller number, 3ds Max will try to rescale image which slows down play back.

displayperformanceapture

If you turn on Gamma in 2016, the playback will be slower. 2017 is OK. The Gamma problem is fixed in 2017 by Qinming.

FFmpeg plugin for 3ds Max 2015/2016:
Link1: https://www.dropbox.com/s/zqwymzuoz…eg2015.rar?dl=0
Link2: http://7xt4sg.com2.z0.glb.clouddn.com/ffmpeg2015.rar
FFmpeg plugin for 3ds Max 2017:
Link1: https://www.dropbox.com/s/kpc7vjvx6…eg2017.rar?dl=0
Link2: http://7xt4sg.com2.z0.glb.clouddn.com/ffmpeg2017.rar
This plugin requires FFmpeg 2.8.6 LGPL library, download from here:
Link1(Official):https://ffmpeg.zeranoe.com/builds/w…pl3.0-opencl.7z
Link2:http://7xt4sg.com2.z0.glb.clouddn.c…pl3.0-opencl.7z