Skip to content

Vray for Max Domemaster3D Shader Compiling

Andrew Hazelden edited this page Dec 16, 2016 · 6 revisions

Compiling a Vray for 3DS Max Lens Shader

This step-by-step guide attempts to explain every major step you need to carry out compile a native Vray for 3DS Max version of the Domemaster3D shaders on Windows.

Install Visual Studio 2013 Community Edition

Step 1. Download and install the free Visual Studio 2013 Community Edition from Microsoft:

https://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx

The direct download link for the Visual Studio Community 2013 ISO is:

http://go.microsoft.com/?linkid=9863609

After you have installed Visual Studio 2013 Community Edition you should apply any SP (service pack) updates that are provided. You may have to install the Visual Studio "platform" file as well.

Note: If you compile your lens shaders with Visual Studio 2013 then the end users will have to install the free Microsoft Visual C++ Redistributable Package for Visual Studio 2013 x64 on their workstations to use the .dll library files you create.

Install the 3DS Max SDK

Step 2. You need to download and run the 3DS Max SDK installer that lines up with the current version of 3DS Max that is being used to run the Vray for 3DS Max plugin.

Before you go and download the 3DS Max installer again, you can check if you still have the original Autodesk 3DS Max installer files sitting on your hard disk from your original Max installation. These 3DS Max SDK installer .msi files are typically located inside the C:\Autodesk\ folder at that a path that is similar to this folder location:

C:\Autodesk\Autodesk_3ds_Max_<Max Version>_EFGJKS_Win_64bit_dlm\x64\Tools\MAXSDK\

Note: In the above example you would replace the text "<Max Version>" with the actual 3DS Max version number like 2014, 2015, 2016, etc...

If you can't locate those SDK files on your system you can still download the required 3DS Max installer files from your Autodesk Account - All Products & Services Page, or you could try using the Autodesk Virtual Assistant site, too.

If you need to re-download the 3DS Max installer files, you can run the initial 3DS Max installer to expand the and de-compress each of the MSI installer files to the C:\Autodesk\ folder. After you get through the first few "info" screens of the installer program you should be able to quit the installer once you check and see the SDK installer files now stored in the Autodesk directory.

Search inside the new Autodesk folder on your C: drive for the SDK installer named like this "SDK_3dsMax<Max Version>.msi".

Open this folder up and copy the "SDK_3dsMax<Max Version>.msi" installer to your desktop. This installer is what provides the Max SDK version specific lib and include files that are needed in Visual Studios to compile any 3DS Max plugin, or to compile the Vray for Max based lens shaders.

Now you need to run the actual 3DS Max SDK installer.

If you are running the 3DS Max 2014 SDK installer for example, it will place the resulting library and include files at:

C:\Program Files\Autodesk\3ds Max 2014 SDK\

If you are running the 3DS Max 2015 SDK installer for example, it will place the files at:

C:\Program Files\Autodesk\3ds Max 2015 SDK\maxsdk\

If you are running the 3DS Max 2016 SDK installer for example, it will place the files at:

C:\Program Files\Autodesk\3ds Max 2016 SDK\maxsdk\

If you are running the 3DS Max 2017 SDK installer for example, it will place the files at:

C:\Program Files\Autodesk\3ds Max 2017 SDK\maxsdk\

Install Vray for 3DS Max

Step 3. Install a recent version of Vray 3.x for 3DS Max:

http://www.chaosgroup.com/en/2/downloads.html?s=v-ray

Note: You need to use a full version of Vray for Max to compile the lens shader. A trial version of the Vray for Max plugin does not include the extra source code folders, and header file and library resources that are needed by Visual Studio.

Install Domemaster3D for Windows

Step 4. Download the newest copy of Domemaster3D from the Domemaster Stereo Shader project's GitHub releases page. You can use either the preferred approach of the automated Windows installer, or the manual install zip file to install Domemaster3D on Windows.

This installation process will create a new Domemaster3D folder on your hard disk:

C:\Program Files\Domemaster3D\

Step 5. Open up the Domemaster3D folder using the Windows Explorer folder view and browse into the lens shader's Vray source code folder:

C:\Program Files\Domemaster3D\vray\source\3dsmax\vray 3.0 for 3ds Max 2015\

You should see two lens shader folder items in this directory:

vraydomemasterstereo
vraylatlongstereo

If you need to compile a version of the lens shaders to work with an older Vray or 3DS Max release you can look in this source code folder here:

C:\Program Files\Domemaster3D\vray\source\3dsmax\vray legacy code\

Select the "vraydomemasterstereo" and "vraylatlongstereo" lens shader source code folders and copy them into this folder:

C:\Program Files\Chaos Group\V-Ray\3dsmax <Max Version> for x64\samples\3dsmax_plugins\

This will place a folders named "vraylatlongstereo" and "vraydomemasterstereo" into the Vray samples 3dsmax_plugins source code folder. This allows the Visual Studio project files to be able to compile correctly using relative paths to find the Vray library and header files.

When you look at the source code examples, you might notice that Vray hasn't updated the Visual Studio (Microsoft Developer Studio) .dsp project files that come with the source code in years. This means the project files have to be manually edited and revised when using newer versions of Visual Studio like Visual Studio 2013.

Editing a Visual Studio Project File

Step 6. We are going to use a programmer's text editor like Notepad++, to search and replace content inside of the Domemaster3D for Vray lens shader's Visual Studio project files for occurrences of the 3DS Max version number like "2015" and replace those references with the active version of 3DS Max we want to compile the lens shader with.

For example we could search for "2015" (for 3DS Max 2015), and replace that text with "2014" to generate a 3DS Max 2014 compatible visual studio solution. Or we could search for every occurrence of "2015" and replace that with "2016" for 3DS Max 2016, or "2017" for 3DS Max 2017 support.

After you have done the 3DS Max version number find and replace editing operation, you should do a second round of find and replaces to adjust for the current 3DS Max SDK folder location.

The SDK folder moved down a directory between the Max 2015 and Max 2014 releases from "3ds Max 2015 SDK\maxsdk\" to "3ds Max 2014 SDK\". So this type of editing would mean we search for the word "maxsdk\" and replace it with nothing ie: "" if we wanted to compile a version of the shaders to work with the older 3DS Max release.

Also, the capitalization of the library file "paramblk2.lib" in Max 2015 needs to be changed to a capital letter based filename of "Paramblk2.lib" if we are compiling a version of the lens shaders for Max 2014.

The following Visual Studio files have to be edited with the "2015" find and replace command to make the lens shaders compile with a different version of 3DS Max:

vraylatlongstereo.dsp
vraylatlongstereo.sln
vraylatlongstereo.vcxproj
vraylatlongstereo.vcxproj.filters

Step 7. I had to edit the Max 2015 based lens shader vraylatlongstereo.cpp source code file to change the following lines for Max 2014 compatibility:

// From ReferenceMaker
// Vray 3.4 for Max 2015 Change [ACH]
//RefResult NotifyRefChanged(NOTIFY_REF_CHANGED_ARGS);

// Vray 3.4 for Max 2014 Change [ACH]
RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message);

and

// Vray 3.4 for Max 2015 Change [ACH]
//RefResult VRayCamera::NotifyRefChanged(NOTIFY_REF_CHANGED_ARGS) {

// Vray 3.4 for Max 2014 Change[ACH]
RefResult VRayCamera::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message) {

Also when compiling a Max 2014 build you need to search for the Visual Studio version string "vc11" and change it to the newer "vc101" value.

Step 8. Use Visual Studio 2013 to open the "vraylatlongstereo.sln" file located at:

C:\Program Files\Chaos Group\V-Ray\3dsmax 2014 for x64\samples\3dsmax_plugins\vraylatlongstereo\vraylatlongstereo.sln

Set the compiler to output a Max Release Official (non debugging version) and compile the source code. If everything worked as expected in Visual Studio, you should now have a freshly compiled Vray for 3DS Max lens shader. You can read in the Visual Studio output logs where the newly compiled lens shader file was saved.

This new lens shader file will have a name like "vraydomemasterstereo2015.dlo" or "vraylatlongstereo2015.dlo" if you are compiling a 3DS Max 2015 version. If you are compiling a different version of the shader it will have that Max version number written just before the .dlo file extension on the shader dll library file.

Note: If you forget to change the Visual Studio output to the release version and have the project set to a Debugging version of the shader you will get a compiler error. Now would be a good time to try the instructions in step 8 again and switch Visual Studio to the Max Release Official output and the error messages will disappear.

Closing Notes

If you run into issues when compiling a custom Visual Studio based build of the Domemaster3D Vray for 3DS Max lens shaders you can post a new issue on the Domemaster Stereo Shader GitHub Issues page.

Clone this wiki locally