Shaders

From polycount
Revision as of 16:10, 6 August 2014 by Haiddasalami (Talk | contribs)

Jump to: navigation, search

What is a Shader?

A shader is a bit of computer code that is commonly used to describe how a surface will be rendered. It takes some inputs (textures, vertices, view angles, etc.), does some changes to them, then tells the game renderer to render them.

Shaders are typically used for interactive rendering, like in a 3d game, where the view is rendered in real-time at 30 fps (or better). This page is all about these "real-time" shaders, which are optimized to render efficiently, trading performance for less accuracy. "Offline" shaders are used with non-real-time renderers, like mental ray, and have more accurate effects like ray-tracing and sub-pixel filtering, but they are non-interactive (they can take several minutes to render each frame).

Example Shaders

3ds Max Shaders

(in alphabetical order)

More info in the Polycount thread Xoliul's 3DS Max Viewport Shader.

Shader with many options, including near-perfect results for 3ds Max generated normal maps. See the Polycount thread 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max.

Shader features: "One UV texture, Two point lights, Diffuse map(include alpha which control transparency), AO(ambient occlusion) map or Lightmap share the same channel, Normal map,Specular map,Specular level map,Gloss map,Emissive map, Two type of Cubemap---One is diffuse cubemap for generating IBL(image based lighting), the other is enviroment cubemap for reflection."

He has a bunch of HLSL shaders available for normal mapping, ambient occlusion, car paint, skin, etc.

Original BRDF shader for Maya by Brice Vandemoortele and Cedric Caillaud. More info in the Polycount thread Free Maya/max cgfx/fx Shader. Update: New version here with many updates, including object-space normal maps, relief mapping, self-shadowing, etc.

Half-Lambert diffuse term with controllable falloff, additive rimlighting, Phong specular, mask support (Dota2 style), all them fancy effects Valve uses!

From the Polycount thread ENVO realtime environment shader for 3d studio max.

This shader uses blendmodulate for vertex blending with per-pixel detail. From the Polycount thread The Snow and Ice of Uncharted2?.

Shader features: "Post effect, 3dsmax2008/2009 viewport shadowmap, Subsurface scattering, Cubemap Image based lighting, Diffuse(alpha channel control opacity),Normal map,Ao map/Light map,Specular,Specular lever(mask),Gloss etc., Shadermodel 2.x compatible for AMD ATI card."

"The aim of this shader is to emulate all the perceptual qualities of realistic skin like translucency (sss), fresnal specular, gloss, oiliness, etc - kludging what I can to produce fast yet realistic looking results."

More info in the Polycount thread TF2 and TOON realtime viewport shader (3ds max).

Maya Shaders

(in alphabetical order)

More info in the Polycount thread Free Maya/max cgfx/fx Shader. Update: New version here with many updates, including object-space normal maps, relief mapping, self-shadowing, etc.

Half-Lambert diffuse term with controllable falloff, additive rimlighting, Phong specular, mask support (Dota2 style), all them fancy effects Valve uses!

Has several features such as normal mapping, specular, gloss, reflections, ambient cube, parallax, etc. More info in the Polycount thread "KoddeShader", a Maya CGFX shader. Update: Version 2.0 here including updates such as blended normals for skin, cube map mip level parameters for blurring reflections and ambient light, 2-pass transparency support, etc.

Many techniques and parameters, including normal mapping, specular, ambient env cube, SSS, litspheres, etc.

More info in the Polycount thread Vertex color BlendMasked cgfx maya shader.

UDK Shaders

UDK shaders for cloth, skin, water, glass, foliage, bricks, etc.

Creating Shaders

Beginner Tutorials

Intermediate Tutorials

Shows how the Team Fortress 2 look can be emulated using a shader network in Unreal Engine 3.

  • ParallaxMap: different techniques for parallax mapping (offset, parallax occlusion, relief, etc.), with links to the papers detailing them and other related resources.
  • Beautiful, yet Friendly: Article by Guillaume Provost, which explains the behind-the-scenes technical aspect of shaders. A must-read when one starts to think about efficiency, math, and hardware.

Advanced Tutorials

Tools

To create and edit shaders, most people use a text editor (like Notepad ++) to write them and a 3d program (a game engine, 3ds Max, Maya, etc.) to view them. For those who are new to shaders the following tools provide a graphical user interface for easier creation.

  • FX Composer is NVIDIA's shader authoring toolset.
  • GLSL Hacker "is a cross-platform (Windows, Linux and OS X) tool for fast realtime 3D prototyping and coding. It's based on widely used standards such as GLSL (OpenGL Shading Language), Lua or Python. GLSL Hacker has been designed for developers (from newbies to confirmed) and technical 3D artists."
  • GLSL Sandbox is a browser-based code editor that shows the output live, right there behind your code. Also has a gallery of neat tricks to steal (ahem, borrow) from.
  • mental mill Standard Edition "allows the user to write and edit shader code, and visually debug the shader by interactively inspecting variables while stepping through the code." The more limited Artist Edition is free for personal use, and came bundled with 3ds Max 2010.
  • PowerVR SDK lets you live-edit and gives you rough estimates on shader costs. Helps with optimising GL ES2.0 shaders. Works with regular GLSL, too.
  • RenderMonkey is AMD's shader authoring toolset.

Shader Tools for 3ds Max

  • 3Point Shader Pro "is a toolset for creation and presentation of high-quality real- time materials in the Autodesk 3ds Max™ viewport."
  • Shader FX "is a full-featured real-time shader editor for 3ds Max that allows artists with no previous programming experience to build complex HLSL or CG FX shaders, using a graphical schematic interface to wire nodes together." No longer being developed

Shader Tools for Maya

Shader Tools for Unity

  • Shader Forge "The goal with Shader Forge is to provide an intuitive and visual way of creating shaders in the Unity engine, just like the Material Editor in UDK."
  • ShaderFusion is a node-based shader editor for Unity.
  • Strumpy Shader Editor another node-based shader editor for Unity.

Shader Tools for Unreal Engine

Tech_Artists.Org Wiki

For more info see Portal:Shaders on the Tech Artists Wiki.

These pages need to be ported, see.

Shaders for Artists What are shaders and what do they do?
Blending functions Photoshop functions converted into HLSL. Understanding the math behind Photoshop will give greater insight into how pixel shaders work, and the short functions will help teach HLSL syntax.
NormalVector, BinormalVector, and TangentVector are the three vectors that make up surface vector information, and a basic understanding is essential to understand lighting.
Glossary (Shaders) A listing of terms used in shaders, such as half angle, glossiness, etc.
UnitVector What is a unit vector (also known as a normalized vector), and why is it important to us?
Shading models Describe the different models, such as Blinn, Phong, etc.
DDS and Normal map compression Explain the best ways to save and compress normal maps and other textures.
Vertex skinning: An article about using the shader to deform skinned meshes. Ubiquitous in games now-a-days, but knowledge of it can help unlock what else is possible in the vertex shader.
MaxScript DirectX Scripted Material Plugin: A tutorial requiring intermediate to advanced HLSL and MaxScript knowledge. It will allow you to build your own unrestricted interfaces for DirectX 9 Shaders in Max, instead of using the default auto-generated UI.
Personal tools
Namespaces

Variants
Actions
Navigation
Tools