3ds Max Shaders for Stingray - Part 2 - PBR Textures
In this tutorial, we take a look at Physically Based Rendering (PBR) textures. PBR textures are vital when exporting or viewing your 3ds Max project in a real-time game engine like Stingray.
- 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:13
In the last movie, you learned about the limitations of converting regular 3ds Max materials into Stingray Shaders.
00:00:14 --> 00:00:22
Before you move to creating actual Stingray Shaders in 3ds Max so that you don't rely on conversions, let's take a moment to discuss PBR textures.
00:00:23 --> 00:00:28
Long gone are the days when a material was simply made out of a Diffuse map and a Bump map.
00:00:28 --> 00:00:37
Today, you want to define a material that is physically accurate, in how it deals with reflections, surface roughness and metallic properties as well.
00:00:37 --> 00:00:42
At the very least, as far as Stingray is concerned, you want to account for the following channels:
00:00:43 --> 00:00:49
Color, Normal, Metallic, Roughness and Ambient Occlusion
00:00:49 --> 00:00:55
So you need a set of bitmaps to define a material that is suited for Physically-Based Rendering, or PBR.
00:00:55 --> 00:01:02
You can view such a set in the files you have downloaded for this tutorial. A download link is available in the movie description.
00:01:03 --> 00:01:11
There are many ways to create these textures. You can create them manually, one by one, but this could be a tedious endeavor.
00:01:11 --> 00:01:20
You can also use various 3D techniques such as Render to Elements to create some of those, although you would still need to retouch them in a paint program.
00:01:21 --> 00:01:29
Usually, you want to use third-party software to do this kind of job, and there are many available products on the market that work rather well.
00:01:30 --> 00:01:40
The most common commercial products that regularly receive high praise include NDO2, Crazybump and Bitmap2Material (B2M)
00:01:41 --> 00:01:50
However, if you are not ready to invest in those, you can still create PBR textures using Open Source software such as Awesome Bump.
00:01:50 --> 00:01:54
You can google it to find and download the latest release.
00:01:56 --> 00:02:05
What I like about this app is that it's self-contained and doesn't need to be installed. You simply start it by double-clicking the executable.
00:02:06 --> 00:02:15
I admit I'm still using version 4 as I prefer to read tab labels rather than deciphering icons, which is what the latest version displays.
00:02:15 --> 00:02:20
Awesome Bump's interface is somewhat unique, but helpful when you get used to it.
00:02:20 --> 00:02:25
Aside from the control panel, you have a 3D scene to view your sample result.
00:02:26 --> 00:02:34
You can orbit with the left mouse button, zoom in and out with the wheel, and pan with the right mouse button.
00:02:36 --> 00:02:40
Holding down the wheel relocates the light source.
00:02:44 --> 00:02:48
The 3D settings enable you to change the mesh type,
00:02:51 --> 00:02:54
and also switch the Environment map.
00:02:58 --> 00:03:02
You can also increase the light intensity if you need to.
00:03:06 --> 00:03:12
The right window shows you the current 2D image used in the scene, the default being the Awesome Bump logo.
00:03:13 --> 00:03:17
The idea is to use this app to create PBR textures from a color image.
00:03:18 --> 00:03:20
The general workflow goes like this:
00:03:20 --> 00:03:26
First you need to load a color image, such as this brick texture you downloaded for the tutorial.
00:03:27 --> 00:03:31
You can load the image simply by dropping it in the Diffuse panel.
00:03:35 --> 00:03:40
If the image is already open in a paint program, you can also use Copy & Paste functionality.
00:03:41 --> 00:03:48
When the image is opened, it shows in 2D in the right pane and also in the left pane as it affects the 3D sample.
00:03:49 --> 00:03:54
The color information is there but the rest of the channels are still influenced by the company logo.
00:03:55 --> 00:04:02
What you want to do next is enable Preview mode. This lets you make preliminary and global adjustments before fine-tuning them.
00:04:02 --> 00:04:10
Once that is done, you want to click on the Convert to Normal/Height button to replace the logo by the generated new images.
00:04:11 --> 00:04:16
You can exit preview mode after that to see the end results including the color information.
00:04:17 --> 00:04:23
From that point on, you can go into the individual tabs and tune the results for each map.
00:04:32 --> 00:04:38
Once you are done, you have the choice of outputting all resulting images at once, or individually.
00:04:41 --> 00:04:45
I personally like to copy the individual maps to the clipboard,
00:04:47 --> 00:04:52
and paste them as separate layers in Photoshop for more adjustments if need be.
00:04:56 --> 00:05:02
There is another aspect of Awesome Bump that I really like and that is how it deals with Normal Directions.
00:05:02 --> 00:05:08
Depending on the software you're using, the directions of Normals in the resulting image can be inverted.
00:05:09 --> 00:05:15
There are endless articles and discussions on the internet about normal flipped axes, so one needs to be wary of that.
00:05:16 --> 00:05:22
If you do a search for Normal Mapping, you'll come across this Wikipedia page that I found quite useful.
00:05:22 --> 00:05:30
In it, it suggests that the normal colors for left/right/up/down when a normal is protruding should be as follows:
00:05:30 --> 00:05:34
Left is dark cyan: [0,128,128]
00:05:35 --> 00:05:39
Right is light red, [255,128,128]
00:05:39 --> 00:05:43
Up is light green: [128,255,128]
00:05:44 --> 00:05:48
And down is dark magenta: [128,0,128]
00:05:49 --> 00:05:55
When a normal is embossed, the combination of left/right colors the up/down colors are switched.
00:05:56 --> 00:06:03
If only one axis is switched, left/right OR up/down, then this could lead to trouble.
00:06:03 --> 00:06:08
Armed with this information, let's take a look at a couple of distinct Normal conversions.
00:06:08 --> 00:06:14
In Photoshop, I'll create a white square over a medium gray background.
00:06:27 --> 00:06:32
I'll duplicate this layer so I can see the conversion effect using two different methods.
00:06:32 --> 00:06:39
In Photoshop, I will run the free NVidia Normal Map Filter. You can google it and download your own free version.
00:06:39 --> 00:06:44
It's very easy to use but certainly not as powerful as other Normals tools out there.
00:06:45 --> 00:06:51
Once I run it and convert my square image into a normal map, compare it with the standard image we found on Wikipedia.
00:06:52 --> 00:06:57
The left and right side seem to be properly set but the up and down colors are inverted.
00:06:58 --> 00:07:06
If you are not careful, this can give you problems when you use that normal map in a 3D scene as its interaction with light can be troublesome.
00:07:06 --> 00:07:16
Notice the rivets on these two doors and how they are consistent on the right, whereas the light seems to affect them differently on the left.
00:07:16 --> 00:07:26
When that happens, you will need to flip the offending axis on the normal channel in order to use it, in this case the vertical or Y channel.
00:07:26 --> 00:07:31
If you know of the problem first hand, you can fix it before generating the Normal map.
00:07:31 --> 00:07:38
In the case of the NVidia filter, you can enable the Invert Y option before you generate the map.
00:07:44 --> 00:07:51
If you've already generated the map and cannot undo the work, then here's how you fix the problem.
00:07:51 --> 00:07:59
With the Normals layer selected, you need to go to the Channels tab and select the Green channel representing the vertical axis.
00:07:59 --> 00:08:03
You can now invert that channel using Ctrl+I.
00:08:03 --> 00:08:11
If you select the RGB channel again and go back to the Layers tab, your normal map should now show consistent colors.
00:08:12 --> 00:08:15
Let's take a look at how Awesome Bump behaves.
00:08:15 --> 00:08:26
In Photoshop, pick the grayscale layer and select all its data by pressing Ctrl+A. Next copy that data to the clipboard using Ctrl+C.
00:08:26 --> 00:08:28
Start Awesome Bump,
00:08:30 --> 00:08:37
and go to the Diffuse tab. Use the Paste button to paste the image.
00:08:40 --> 00:08:46
Enable preview but set the Small, Big and Huge Weight sliders to 0.
00:08:46 --> 00:08:51
Use the Medium Weight only to achieve a similar look to the one you had a moment earlier in Photoshop.
00:08:52 --> 00:08:56
Generate a Normal map and exit Preview mode.
00:08:57 --> 00:09:00
Go to the Normal tab and zoom in on the 2D image.
00:09:01 --> 00:09:07
Notice how the colors are consistent with the standard we discussed a moment ago, there is no need for axis conversion here.
00:09:08 --> 00:09:13
Mind you, if you did need it, you can flip the axes using the appropriate check boxes,
00:09:14 --> 00:09:20
but the fact that Normals creation is consistent with established standards makes this tool score higher points in my book.
00:09:21 --> 00:09:30
Okay, now that this is out of the way, let's see how you can build PBR shaders in 3ds Max that are 100% compatible with Stingray.
00:09:30 --> 00:09:32
This is what you do in the next movie.