Home Technical Talk

3DS Max Custom Viewport Shader Template

So, 3DS Max is of course an industry standard tool. Historically it's been difficult to preview what art will look like in the final game, however. Plugins such as Xoliul have helped, but generally don't match the exact parameters and output of the actual game - particularly with the advent of newer PBR workflows.

Therefore, writing custom viewport shaders is a must.
However, I'm used to writing shaders in the Unity game engine, which is a very different beast than HLSL. For those of you who don't know, Unity allows you to optionally write your shaders as a so-called "surface shader", which unlike traditional vertex/fragment shaders allows you to write more high-level shaders that deal with surface information and lighting functions.

To that end, I've written a 3DS Max viewport shader template which gives you a surf and a lighting function. The surf function provides information to the lighting function like Albedo and SpecularColor, which the lighting function then takes and uses to produce a final output color.

Here's a blog writeup with download link: http://www.mophogames.com/improving-your-pipeline-custom-3ds-max-shaders/

I've also written some PBR shaders using these templates, one for specular color and one for metalness, based on the Lux shader pack for Unity, some screenshots of which are included in that blog post. I may release these to the public, depending on the demand for them.

Replies

  • amartinez
    Options
    Offline / Send Message
    amartinez polycounter lvl 8
    This is an awesome idea.
    Not only "let's just use the 3dsmax DirectX shader pipeline", but the whole Unity3D surface shader approach.

    Thanks for the template.
  • PhobicGunner
    Options
    Offline / Send Message
    Thank you :)
    There's some things I haven't been able to replicate from Unity. For example, in Unity you can just leave normal map unassigned and it will just use the model's normals. This isn't the case in my shader template, although there ARE two techniques - one normal mapped, and one that is NOT normal mapped - to deal with this.

    My shader also only works in DirectX 9. It fails to compile under DX10 with a very unhelpful "failed to load file" error (which I didn't work too hard on as I heard that Max's DX10 support is broken). DX11 is untested as my version of 3DS Max does not support it.

    Still, I imagine it would be a very helpful addition to an artist's workflow.
  • PhobicGunner
    Options
    Offline / Send Message
    Fixed a stupid mistake in the shader, should fix the 'specTexture not declared' error.
  • PhobicGunner
    Options
    Offline / Send Message
    So I'll be working on polishing up a PBR shader to release later. Should really help those who are working with PBR game engines.
Sign In or Register to comment.