-
Notifications
You must be signed in to change notification settings - Fork 9
Materials
3DS materials are handled by a fixed pipeline (similar to Wii/Gamecube) instead of using fragment shaders.
The materials are built using combiners and stages which determine how to display the material.
This is the example of a very simple material. PixelL is shading/lighting. It multiplies by the texture to get a shaded output with texture.
You can save the material as a preset (gets saved to tool directory) for easy reuse.
The top of the material editor includes material name and option to use fragment lighting.
Fragment lighting must be enabled for combiners that use pixel/specular lighting!
You can copy/paste individual materials to clipboard from the right click menu.
Materials can be exported/replaced as .json from the right click menu.
These can be edited in a text editor.
Face Culling - Controls what face to hide. Hides the back face by default. Set to Never to show both faces.
Enable Fog - Uses fog if the game supports loading them for the model. Light Set - Determines what light ID to use. The lights are handled game specific. MK7 for example has a seperate light file for tracks.
Texture maps configure what texture to display on the material (when used in the combiner section).
To select or change the texture, you can click this button. It will give you a list of all current textures loaded.
Or you can type in the name manually.
Configures how the texture will wrap in the border of the UV box. Mirror will mirror the texture, clamp will clamp the last pixels used.
Mapping Type - Controls how to display the texture onto the model. UV Coordinates is default. Projection map and other types can do more fancy effects but may not display in the 3D view currently.
UV Layer - Determines what UV layer to use. Some games use the second one for shadow maps so you can have one UV for base texture, second for shadows.
Simply controls the scale, rotation and translation of the UVs. The transform method is based on different 3D programs.
This mode is how the image should be displayed from a distance.
- Linear : Blurry but looks more natural, less pixelated
- Nearest : Pixel perfect. Ideal for sprites.
Make sure to use the mipmap option for min filter to use mipmaps.
- Min LOD : The mip to display. This should be 0.
- LOD Bias : Adjusts the level of detail changing from a distance. Negative can be sharper, positive can be more blurry.
Simply configures what set of texture coordinates to use. 0 1 2 0 uses the first 3 texture coordinates. Other types will share the second and third coordinate set to help save on performance. This shouldn't be requried to edit unless a texture doesn't use the normal 0 1 2 0 type and you need a unique third UV.
To see the image better, you can resize the window from the bottom.
-
Diffuse Color - The color of diffuse lighting Pixel Lighting in combiner must be used
-
Emission Color - The color of emissive lighting Pixel Lighting in combiner must be used
-
Ambient Color - The color of ambient lighting Pixel Lighting in combiner must be used
-
Specular Color 0 - The color of specular 0 lighting Specular Lighting in combiner must be used
-
Specular Color 1 - The color of specular 1 lighting Specular Lighting in combiner must be used
-
Constant Colors - Colors configured with the combiner. These can be adjusted inside the combiner UI.
-
Blend Color - Color optionally used based on render state blend settings.
Configures how to render effects like blending and depth.
You shouldn't need to edit most of this data as you can use the presets.
- Opaque - Non transparent.
- Transparent - Supports transparency but not see through.
- Translucent - Can be seen through.
These are look up tables used for configuring lighting.
Many games will load the LUTs outside the file so if you are trying to preview them in MK7 or SM3DL, those are in seperate files. You can load external LUTs from other bcres/bch by putting them in the LUTs folder of the program.
- MK7 LUTs - RaceCommon.szs\DFD3F577.bcres in STB or RaceCommon.szs\LUT\common_lut.bclts in EFE.
- SM3DL LUTs - ObjectData\Shader.szs\Shader.bcsdr
To get a good view of how these look, you can switch to Specular debug shading mode to view the specular directly.
Here we can see the lighting being used all around this model aside from that darkened spot. The light is represented up to 180 degrees.
This is the primary way specular effects are handled. Specular 1 being like an optional layer of specular to add on.
Extra layer of specular with 3 optional channels.
Gives fresnel lighting.
You need to checkmark the LUT you want to use.
If the option is grayed out, configure the layer config.
Switch to different presets until the options enabled are what you want. Keep in mind the bottom most are performance intensive
Next select the LUT you want to use. If you want to add them, refer to this guide.
Next select your LUT. Configure the other options if wanted.
Determines the lighting model to use on the LUT. Phong or blinn phong is best used. Use fixed lighting for certain effects like cell shading or fresnel if desired.
The LUT intensity.
This setting determines to use the normals from the model to affect the specular 0/1 light.
These combine everything together, similar to shader nodes or tev stages used on Wii/Gamecube. There is up to 6 stages. Each stage has a function to multiply/add/subtract/mix different inputs. Inputs include lighting, shading, textures, and previous stages.
A stage stores a set of inputs A, B and C which get used in a function. These inputs range from textures, shading, lighting and colors. This example I multiply texture times the model shading.
A stage combines multiple functions together.
Here I added a stage. Put the last stage (one above it) as an input, then multipled by constant color 5.
You can add stages with Add Stage at the bottom.
Icon | Type | Info | Preview |
---|---|---|---|
SpecL | Controls specular lighting configured by LUTs and specular colors. | ||
PixelL | Controls shading along with using diffuse, ambient and emissive colors. | ||
VertexL | Controls vertex color/alpha. Games with custom vertex shaders may use this for custom effects. | ||
PrevStage | Uses the last stage on top of the current one. | ||
PrevBuffer | Uses the previous stage of the stage with Update Buffer checked. Else it uses a fixed color. | ||
Tex0 - Tex2 | Select the first, second or third texture maps. | ||
Constant | Selects a specified color. |
Here you can use various functions to compute your material. A/B/C being the input values you can configure.
This is a feature that allows you to save the previous stage to use later.
Color is made up of red, green and alpha channels. You can switch between red, green, blue and alpha (transparent) channels.
If you want glow around your model like this, first go to the LUT tab.
Make sure the layer config includes fresnel. If it does not, keep changing until one does with desired effects.
Then select the LUT to use. Also make sure fresnel primary is selected. Fresnel secondary can be toggled for specular if needed.
Lastly use the PixelL alpha channel in the stage tab which will display fresnel
You want it to add to the previous stage to show the glow above.
If desired, you can multiply a color to PixelL alpha to control the fresnel color.