3ds Max Shaders for Stingray - Part 3 - DirectX Material

Login to Follow
  • Film & VFX
  • Games
  • Design Visualization
  • Modeling
  • Rendering
  • Shaders
  • Lighting
  • Lighting and Rendering
  • Workflow
  • 3ds Max
  • Stingray
Skill Level
  • Intermediate
12 min

3ds Max Shaders for Stingray - Part 3 - DirectX Material

In this tutorial, learn how to use 3ds Max DirectX Shader both in its native format and with a slightly edited preset. Editing the preset can be useful for creating your own custom shaders.

  • Recorded in: 3ds Max 2017.1 & Stingray 1.6
  • This tutorial is intended for use with 3ds Max version 2017.1 Update or higher.
00:00:06 --> 00:00:10
In the last movie, you took a glimpse at how to create PBR textures.

00:00:10 --> 00:00:19
In this movie, you learn to use them in conjunction with the DirectX Material that transfers to Stingray one-to-one, without any conversion.

00:00:20 --> 00:00:28
In 3ds Max, you will use the same scene as before, namely the scene named Pier_start.max you downloaded for this tutorial.

00:00:28 --> 00:00:33
A download link is available in the description section on this movie page.

00:00:33 --> 00:00:38
The scene shows a few simple objects that when put together, make a section of a pier.

00:00:39 --> 00:00:45
The objects have been unwrapped and collapsed to Editable polys, and therefore ready for material application.

00:00:45 --> 00:00:48
Press M to go to the Material Editor.

00:00:49 --> 00:00:53
Select and delete all the existing nodes so you can start from scratch.

00:00:53 --> 00:00:59
You've already covered the conversion limitations of standard 3ds Max materials when exported to Stingray.

00:00:59 --> 00:01:05
This time, you will use the DirectX Material that is 100% compatible with Stingray.

00:01:05 --> 00:01:09
Drag and drop a DirectX Shader node into the editor.

00:01:09 --> 00:01:12
Double-click the parent node to view its properties.

00:01:12 --> 00:01:20
Note that by default, a DirectX Shader has two nodes. The child node is only useful if you are planning to render in 3ds Max.

00:01:20 --> 00:01:27
If your goal is simply to send your scene to Stingray for real-time manipulation, you can in fact delete the child node.

00:01:28 --> 00:01:31
You can also leave it there as it won't affect the interoperability.

00:01:32 --> 00:01:42
Also note the default HLSL option which stands for Higher-Level Shading Language. You want to use the Stingray option for better compatibility.

00:01:43 --> 00:01:47
This changes the interface a little bit to better match the one in Stingray.

00:01:47 --> 00:01:51
Scroll the material definition to see the kind of channels you have access to.

00:01:52 --> 00:02:00
You'll see that you can map channels for Normal, Color, Metal, Roughness, Emissive and Occlusion data.

00:02:01 --> 00:02:06
Start by changing the name of this material, name it: "Pier_Shader".

00:02:06 --> 00:02:11
Apply it to all objects except the globe at the top of the lamppost.

00:02:14 --> 00:02:16
The shading in the viewport changes slightly.

00:02:17 --> 00:02:27
Next, click the normal_map "None" button. Browse to where you unpacked the downloaded files and select the file named: "Pier_nrm.jpg".

00:02:27 --> 00:02:31
Alternatively, you can drag the file in from Windows Explorer.

00:02:32 --> 00:02:40
Still at this time, the viewport shows no change. Even though you added a Normal map, you can't see its effect just yet.

00:02:40 --> 00:02:45
This is because you have the option of enabling or disabling a defined texture.

00:02:46 --> 00:02:51
Note the option to "use" a map, such as "Use Normal Map", "Use Color Map" etc…

00:02:52 --> 00:03:02
Even though these parameters are shown as number boxes, they're really on/off switches. 0 means a map is inactive, 1 means it's enabled.

00:03:02 --> 00:03:10
Set the Use Nomal Map value to 1, you can now certainly see the Normal Map effect in the viewport.

00:03:10 --> 00:03:19
Here is a very important tip: Even though the normal map is doing its job, the visuals are off because of Gamma control.

00:03:19 --> 00:03:25
Typically for most of your work in 3ds Max, you would enable Gamma correction to get the best renderings.

00:03:25 --> 00:03:36
But since you're interested in exporting to Stingray and not planning to render in 3ds Max, you want to disable Gamma for the DirectX Shader to display properly.

00:03:36 --> 00:03:43
Try it out, go to Customize > Preferences and disable Gamma correction.

00:03:45 --> 00:03:47
The viewport should look much better now.

00:03:51 --> 00:03:56
Go back to the material and add maps to cater for Color,

00:03:59 --> 00:04:00

00:04:01 --> 00:04:02

00:04:03 --> 00:04:06
and AO (occlusion).

00:04:07 --> 00:04:12
Make sure you activate each and every one of them to see their effect in the viewport.

00:04:16 --> 00:04:20
You may want to zoom in and test their individual effects.

00:04:28 --> 00:04:33
You just created a DirectX shader that is based on a template, or a preset if you will.

00:04:34 --> 00:04:41
To see what this preset looks like, click the Open ShaderFX button.

00:04:41 --> 00:04:48
You can see a graph that is an exact duplicate of the graph you would see in Stingray were you to open the editor there.

00:04:49 --> 00:04:53
You can also see a little red warning about making changes to the graph.

00:04:53 --> 00:05:01
In this particular case, you didn't make any changes to the graph itself, you only provided parameter values and bitmap inputs,

00:05:01 --> 00:05:06
so you don't need to worry about saving this tree, therefore you can exit the ShaderFX window.

00:05:07 --> 00:05:13
Now you need a second material for the lamppost globes, but this one only needs emissive properties.

00:05:14 --> 00:05:20
You could arguably use the same preset once again and only adjust the emissive properties and leave the other ones untouched.

00:05:20 --> 00:05:28
As an alternative, you can edit the preset by removing unwanted channels and thus simplifying it. Let's take a look at that.

00:05:29 --> 00:05:37
Create a new DirectX Shader in Stingray mode and name it: "Emissive_Shader".

00:05:40 --> 00:05:47
Open the Shader tree. It is based on the same preset as before and looks exactly like it did a few moments ago.

00:05:48 --> 00:05:53
However the idea this time around is to make actual changes to the graph.

00:05:53 --> 00:05:59
So the first order of business would be to dissociate this shader from any presets or parent materials.

00:06:00 --> 00:06:08
Select the Standard Base output node to the right of the tree and see how it references both a Preset and a Parent Material.

00:06:08 --> 00:06:15
To create a completely independent shader, start by making it Unique, using the appropriately named button.

00:06:15 --> 00:06:23
This removes the red warning and the association to any existing presets and materials. Now you are ready to edit the graph.

00:06:24 --> 00:06:33
Between the left and right input and output nodes are a series of branches that define channels such as Normal, Color and Roughness; among others.

00:06:33 --> 00:06:41
The second branch from the bottom is the one that defines emissive properties and is the only one you need in this case.

00:06:43 --> 00:06:52
Delete all the mid-nodes except the ones belonging to that emissive branch. Also make sure you don't delete the input and output nodes.

00:06:53 --> 00:07:00
Select the Emissive Intensity node. Its minimum and maximum value range from 0 to 1.

00:07:00 --> 00:07:05
Set the Maximum value to 10 to give yourself a little more wiggle room.

00:07:06 --> 00:07:11
You can choose to export the graph if you think you might use it in another project.

00:07:11 --> 00:07:21
From the File menu choose Export Graph. Give it a name and location. The DirectX Shader extention in 3ds Max is .sfx

00:07:22 --> 00:07:26
A similar file is already part of the archive you downloaded for this tutorial.

00:07:27 --> 00:07:35
Close the Shader dialog and note that this shader's UI is simpler than the old one, as it only caters for Emissive properties.

00:07:35 --> 00:07:42
Set the color to White and the intensity to about 2. You can always modify these in Stingray later.

00:07:43 --> 00:07:50
Apply this shader to the globe in the scene and dismiss the Material Editor.

00:07:50 --> 00:07:55
Before we send this project to Stingray, let's make that pier a bit longer.

00:07:55 --> 00:08:02
Simply select all the components and use the Array tool to duplicate the pier on the Y axis.

00:08:03 --> 00:08:12
Make it 3 or 4 duplicates at a distance of -10m in Y. You can use the Preview button to test the results.

00:08:12 --> 00:08:20
Okay, we're ready for Stingray. Start Stingray and create a new project taken from the Basic template.

00:08:21 --> 00:08:28
Choose a Directory for it and give it a name, such as Pier or Pier_Test if you haven't used that already.

00:08:29 --> 00:08:37
Once it's created and Stingray is ready, go back to 3ds Max and selects all the docks but not the lampposts or the lights.

00:08:38 --> 00:08:41
We'll deal with two distinct selection exports.

00:08:42 --> 00:08:46
With the Docks selected, choose Stingray > Send Selection.

00:08:47 --> 00:08:54
When prompted for a location and a file name, go to the content subfolder and name the file: "Pier".

00:08:55 --> 00:09:05
For the FBX options, make sure that Materials, Textures and Lights are enabled. I also personally like to organize materials and textures in sub-folders.

00:09:06 --> 00:09:13
Click Import when done. The FBX file is now saved to disk, within your Stingray working directory.

00:09:13 --> 00:09:23
Repeat the procedure to send the lampposts and their lights into Stingray. Name the file: Lampposts.

00:09:27 --> 00:09:29
Let's take a look at how the scene looks in Stingray.

00:09:30 --> 00:09:39
Go into the content subfolder to find your imported files. Drag the Pier file into the scene and zero out its Transform values.

00:09:40 --> 00:09:48
Orbit around and pan for a better view. Orbit with the Alt key + LMB and pan by holding down the mouse wheel.

00:09:49 --> 00:09:52
Repeat the procedure to add the lampposts.

00:09:53 --> 00:09:59
The imported lights are a bit strong, so reduce their intensity to about 10.

00:10:05 --> 00:10:11
In fact, you may want to consider dimming the Sunlight from an intensity of 4 to 1.

00:10:15 --> 00:10:24
This is starting to look nice and more importantly, all the material information you set in 3ds Max came through flawlessly.

00:10:26 --> 00:10:31
To verify this, go to the materials sub-folder where you will find the two custom shaders.

00:10:31 --> 00:10:39
Select the Pier_Shader and note its properties. Every single map you defined in 3ds Max came through as expected.

00:10:40 --> 00:10:47
Select the Emissive_Shader, and sure enough, it came as defined in 3ds Max, with just the Emissive properties visible.

00:10:48 --> 00:10:57
You can edit them of course to your liking, perhaps by boosting the Intensity from 2 to 5, or perhaps by also changing the color.

00:11:01 --> 00:11:07
Save the changes to the Stingray material, and also your level and your project.

00:11:08 --> 00:11:17
Now that you've learned of the 100% compatibility of the DirectX shader between 3ds Max and Stingray, you will learn how to build a shader tree from scratch.

00:11:18 --> 00:11:23
In the next and final movie in this series, you will create a new custom shader to simulate animated water.
Posted By
  • 3ds Max
  • Stingray
  • Modeling
  • Rendering
  • Shaders
  • Lighting
  • Lighting and Rendering
  • Workflow
To post a comment please login or register