Viewportshader

This is a webpage dedicated to my realtime viewportshader for 3DS Max & Maya.

General

Download:

Compatible with:

  • 3DS Max 2008, 2009, 2010 and 2011.
  • Maya 2008 and up.
  • ATi x1000 and up / GeForce 6 and up.

Links:

Go To Post Shaders Page

Shader features

The following list goes over the main shader features and settings, in order of their appearance. Settings are explained and some tips are given regarding their usage. An animated GIF is provided to illustrate the effect. Italic words signify that the name of an actual setting in the shader is mentioned.

Read this if you are trying out the shader for the first time!

Lighting

3 Light support

The shader can toggle between the use of up to 3 Omni Lights using the Active Lights spinner. Using light types other than Omni can be unpredictable and is not supported.

Each light is selected using the respective Light # Position dropdown list.

Light settings such as color and intensity are taken from the light in Max and can’t be adjusted in the shader.

Realtime Shadows

Realtime Shadows from Max 2008 and onwards are supported in the shader. In Max 2010 and onwards, only Hard Shadows are supported yet, Soft Shadows will not work. Read the FAQ on how to enable these.

Select the light to cast shadows with shadowTerm1. The specular for Light 1 will be masked by the shadows, so try to only use Light 1 for shadows.

The shadows can be blurred with the Shadow 1 Blur spinner.

These options are not available in the Maya version of the shader.

Half Lambert Shading

Users have the option to enable Half Lambert-type shading, as seen in Valve’s Team Fortress 2. This type of lighting calculation allows the user more control over the blend between light and dark, allowing for more illustrative rendering.

Works great with smooth, solid surfaces and brighter colors. Don’t expect this to do much on a realistic, grey/brown scifi prop with heavy normalmapping.

Control the smoothness with the Half Lambert Power spinner.

Take note that shadows don’t behave entirely predictable with this shading mode.

Shaded Hue Adjustment

A special feature, unique to this shader, is the adjustment of Hue in more shaded areas. What this means is that Hue, Saturation and Brightness are slightly tweaked in areas that receive less light, making for more vibrant, illustrative colors.

It is highly recommended to use this in combination with Half Lambert and an ambient color other than black, the effect will not be as visible without.

The Shaded Hue Adjustment spinner controls how much of the effect to apply. turn it off by setting this to 0.

Ambient IBL

Apart from standard, solid color ambient lighting, the shader also supports Image Based Lighting for ambient conditions. Using a cubemap that is heavily blurred by the shader, more interesting, colorful ambient conditions can be achieved. Recommended for increased realism!

The Ambient Cube Blur spinner controls how much the source cubemap needs to be blurred. There is no sure value here; it depends on the resolution of the cubemap. My cubemaps need a value between 7.0 and 8.0.

With Ambient Cube Strength you control how strong the ambient light is.

Share Reflection Cubemap for IBL allows the use of one cubemap for both reflections as ambient. The IBL Cubemap slot is ignored in favor of the Reflection Cubemap slot.

Baked Lightmap

Static, baked lighting is supported by the shader. The lightmap texture can use a different map channel than all other maps, allowing for multiple UV sets to be used.

With the Lightmap Multiplier you control how strong the effect of the lightmap is applied.

You can use baked lighting together with 3 dynamic lights. This isn’t really a viable option since there is no light attenuation/decay. For that reason, it’s best to set the Active Lights spinner to 0 when using a lightmap.

Maps

Diffuse Map

Standard Difusemap is supported by the shader, with the addition that a diffusemap can be multiplied with a solid color by ticking Color Diffuse map.

This is useful for changing the entire tint of a model with just AO or lighting baked into the texture. The example to the left shows that a grayscale car body texture  can be changed to any color tint using this option.

Opacity Map

Opacitymaps are supported as the alpha channel of the diffuse texture. That means you will have to use a format such as .TGA to get this to work. Tick Enable Alpha Channel to use the opacitymap.

With Global Opacity you have control over the overal opacityof your material. Useful if you want to create a glass material but don’t want to create an opacitymap (yet).

In Max 2010 onward, you might have to change the viewports’ Transparency quality to get decent results.

Specular map

Colored or greyscale specularmaps are fully supported by the shader. If no specularmap is used, a solid Specular Color can be defined.

Specular Global Level defines the total specular strength and can be usefull to change the look of your specular highlights without having to adjust the texture.

Gloss Map

A Glossiness map is supported to control the sharpness of specular highlights. This map should be in grayscale format.

Using Glossiness Level (which doubles as global gloss control if no map is used) and Gloss Offset, you have precise control over how the black to white range of the glossmap is used by the shader.

In the example, a noisy glossmap combined with a Level of 75 and Offset of 52, is used to fake metallic paint flakes.

Normal Map

Normalmaps are fully supported, both Tangent- and Object-Space normalmaps. Switch between them with the Object Space checkbox.

The map’s green channel can be flipped with Flip Green, Red and Green Channels can be switched with Switch RG Channels.

Self Illumination Map

For all SciFi glowy bit needs there is support for a Self Illumination or Glow map. With the SI Map Multiply spinner you can control the map’s global strength

Using the Global SI Level spinner you have control over the total self illumination. This can be used to disable all lighting and see your diffuse texture without any other effects. Good for judging how well your painted lighting or AO works.

Fresnel Functions

Outline

Outline is an experimental feature that adds an colored outline around your model, based on the viewing angle. It is not a refined feature and might be completely changed or omitted in the future.

Change the outline thickness using Edge Step. Change the outline color using Edge Color.

Can be used for a stylized effect as seen in Borderlands.

Fresnel Reflection Power

Fresnel Relfections are one of the most extensive features of the shader. It is a view-dependant effect that is used mainly to simulate reflections and can really help to bring out details in a model.

The Fresnel Power spinner controls how strong the fresnel effect will be at the edges of the model.

Fresnel Reflection Bias

Fresnel effects normaly only work on pixels that face away more from the camera. For realistic effects, you might want to have some slight reflection on those pixels facing towards the camera.

The Fresnel Bias is an offset value that allows you this sort of control. Works best for Hard-Type and Cubemap relfections, on materials such as metal or glossy paint.

Fresnel Reflection Multiplier

The Fresnel Multiplier spinner controls the total strength of the fresnel effect. It is simply a multiplier for the final fresnel value.

Use this if you want really faint reflections, or if you really want to boost your fresnel effect.

Take note, the default value is 2,0, this works great for Hard-Type and Rimlight reflections, but needs to be turned down to 1,0 if you use a Cubemap.

Fresnel Reflection Type

There are 3 types of Fresnel Reflections. Two of them are “procedural” and don’t require any external files; they are completely defined by code in the shader.

  • The first type is on by default, by having the Use Hard-Type World Masking checkbox ticked. It’s comparable with a simple studio-gradient environment and makes for crisp, defined reflections.
  • The second type can be toggled by turning off the Hard-Type checkbox. It’s not a true reflection, but rather a Rimlight effect that is masked depending on how much normals point towards the ground. Inspired by Valve’s rimlighting in Team Fortress 2, it is more suited for characters and illustrative rendering.
  • The third type of reflections depends upon a Cubemap texture file. If you check Reflect Cubemap and load a DDS cubemap in the Cubemap slot, the shader wil override the previous reflection types and use the cubemap only. For realism, this option is best.

Fresnel Mask Hardness

The exact top-to-bottom blend of both procedural reflection types, Hard-Type and Rimlight, can be controlled with the Fresnel Mask Hardness spinner. This spinner has no effect on cubemaps.

For Rimlight, a value of about 3,0 to 6,0 works best. For Hard-Type, a value between 2,0 and 20,0 works well.

Reflect Mask texture

Reflections might need to be masked, just like specular. By default, fresnel reflections are masked with the specular texture, but this can be overriden to use a specific texture that masks just reflection, allowing even more control.

For example, you might have a car tire and rim mapped to one texture. You want the rubber tire and metal rim to both have specular, but only the rim should have shiny reflections. In this case creating a custom Reflection Map is a better solution than creating a second shader material.

Cubemap Blurring

Cubemap type reflections can be blurred by the shader using the Cubemap Blur spinner. This is similar to a glossiness control on the specular highlights. Instead of just sharp, paintlike reflections, you can also achieve glossy, soft metal-like reflections with this setting. It can even serve as a complete replacement for specular.

The Cubemap Blur setting is limited to 10, but the value needed for your cubemap depends on the resolution of your cubemap. If you go too high, everything will be blurred out and the cubemap will not be visible anymore. For the cubemaps I provide, a value of 7,0 is the maximum, while 5 to 6 work nicely for glossy reflections.

You can even set the Glossiness map to control the Cubemap Blur, by checking Use Glossmap for blur.

Gallery

Click here to go to the viewport shader gallery to see some examples of the shader in action!

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply