Difference between revisions of "Shaders"

From polycount
Jump to: navigation, search
(Advanced Tutorials: Jason Booth file)
 
(32 intermediate revisions by 5 users not shown)
Line 2: Line 2:
 
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.  
 
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).
+
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).  
  
<!-- ## * '''[[|]]''' by [[|]].<<BR>>  More info in the Polycount thread ''[[|]]''. -->
+
This page is all about these "real-time" shaders, which are optimized to render efficiently, trading better performance for less accuracy.  
 +
 
 +
Conversely, "offline" shaders are used with non-real-time renderers, like V-Ray or 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 ==
 
== Example Shaders ==
<span id="Popular_A3ds_Max_Shaders"></span>
 
 
=== 3ds Max Shaders ===
 
=== 3ds Max Shaders ===
 
(in alphabetical order)
 
(in alphabetical order)
  
* '''[http://www.laurenscorijn.com/viewportshader 3ds Max viewport shader]''' by [http://www.laurenscorijn.com/ Laurens "Xoliul" Corijn].<<BR>>  More info in the Polycount thread ''[http://boards.polycount.net/showthread.php?t=62006 Xoliul's 3DS Max Viewport Shader]''.
+
*[https://web.archive.org/web/20121010065742/http://www.laurenscorijn.com/viewportshader 3ds Max viewport shader] by [https://web.archive.org/web/20160329153258/http://www.laurenscorijn.com/ Laurens "Xoliul" Corijn].
* '''[http://www.3pointstudios.com/3pointshader_about.shtml 3Point Shader]''' by [http://www.3pointstudios.com 3 Point Studios]<<BR>> Shader with many options, including near-perfect results for 3ds Max generated normal maps. See the Polycount thread [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].
+
More info in the Polycount thread ''[http://boards.polycount.net/showthread.php?t=62006 Xoliul's 3DS Max Viewport Shader]''.
* '''[http://rtshaders.deviantart.com/art/Agusturinn-Shader-Demo-100883093 Agusturinn Shader Demo]''' by [http://rtshaders.deviantart.com Wang "RTshaders" Jing].<<BR>> 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."''
+
*[https://web.archive.org/web/20150627021943/http://www.3pointstudios.com:80/3pointshader_about.shtml 3Point Shader] by [http://www.3pointstudios.com 3 Point Studios]
* '''[http://www.bencloward.com/resources_shaders.shtml Ben Cloward Shaders]''' by [http://www.bencloward.com Ben Cloward].<<BR>> He has a bunch of HLSL shaders available for normal mapping, ambient occlusion, car paint, skin, etc.
+
Shader with many options, including near-perfect results for 3ds Max generated normal maps. See the Polycount thread [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].
* '''[http://www.luxinia.de/index.php/ArtTools/3dsmaxFX#genbrdf BRDF shader]''' (3ds Max version) ported by [http://crazybutcher.cottages.polycount.com/ Christoph "CrazyButcher" Kubisch]. <<BR>> Original [http://www.mentalwarp.com/~brice/brdf.php BRDF shader for Maya] by [http://www.mentalwarp.com/~brice Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud]. More info in the Polycount thread ''[http://boards.polycount.net/showthread.php?t=49920 Free Maya/max cgfx/fx Shader]''. '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc.
+
* '''[http://rtshaders.deviantart.com/art/Agusturinn-Shader-Demo-100883093 Agusturinn Shader Demo]''' by [http://rtshaders.deviantart.com Wang "RTshaders" Jing].
* '''[http://www.polycount.com/forum/showthread.php?t=110022 DOTA2 Hero Shader - 3DS & Maya Shader Material]''' by [http://www.polycount.com/forum/member.php?u=43116 Luigi 'Ace-Angel' Kavijian] and [http://drewwatts.net/ Drew 'Drew++' Watts].<<BR>> Half-Lambert diffuse term with controllable falloff, additive rimlighting, Phong specular, mask support (Dota2 style), all them fancy effects Valve uses!
+
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."''
* '''[http://www.aurelm.com/envo/ ENVO realtime environment shader]''' by [http://www.aurelm.com/ Aurel Manea]<<BR>> From the Polycount thread [http://www.polycount.com/forum/showthread.php?t=100187 ENVO realtime environment shader for 3d studio max].
+
* '''[http://www.bencloward.com/resources_shaders.shtml Ben Cloward Shaders]''' by [http://www.bencloward.com Ben Cloward].
* '''[http://www.polycount.com/forum/showpost.php?p=1610563&postcount=2 MoP Texture Blender]''' by [http://www.greveson.co.uk Paul "MoP" Greveson]<<BR>> This shader uses blendmodulate for vertex blending with per-pixel detail. From the Polycount thread [http://boards.polycount.net/showthread.php?p=1024948#post1024948 The Snow and Ice of Uncharted2?].
+
He has a bunch of HLSL shaders available for normal mapping, ambient occlusion, car paint, skin, etc.
* '''[http://rtshaders.deviantart.com/art/Paragalis-Shader-Demo-110994545 Paragalis Shader Demo]''' by [http://rtshaders.deviantart.com Wang "RTshaders" Jing].<<BR>> 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."''
+
*[http://www.luxinia.de/index.php/ArtTools/3dsmaxFX#genbrdf BRDF shader] (3ds Max version) ported by [http://crazybutcher.cottages.polycount.com/ Christoph "CrazyButcher" Kubisch].
* '''[http://www.jistyles.com/main.php?id=doc&page=hlsl SSS Skin Shader]''' by [http://www.jistyles.com/ J.I. Styles].<<BR>> ''"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."''
+
Original [http://www.mentalwarp.com/~brice/brdf.php BRDF shader for Maya] by [http://www.mentalwarp.com/~brice Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud]. More info in the Polycount thread ''[https://polycount.com/discussion/49920/free-maya-max-cgfx-fx-shader Free Maya/max cgfx/fx Shader]''. '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc.
* '''[http://blog.maginot.eu/index.php?seite=people&people=till&page=mhn2048106717 TF2 Shader for 3ds Max]''' and '''[http://blog.maginot.eu/index.php?p=till.1__scriptnstuff_shader_toon Toon/Comic Shader for 3ds Max]''' by [http://www.till.maginot.eu/ Till "Rollin" Maginot].<<BR>> More info in the Polycount thread ''[http://boards.polycount.net/showthread.php?t=64453 TF2 and TOON realtime viewport shader (3ds max)]''.
+
* '''[http://www.polycount.com/forum/showthread.php?t=110022 DOTA2 Hero Shader - 3DS & Maya Shader Material]''' by [http://www.polycount.com/forum/member.php?u=43116 Luigi 'Ace-Angel' Kavijian] and [http://drewwatts.net/ Drew 'Drew++' Watts].
 +
Half-Lambert diffuse term with controllable falloff, additive rimlighting, Phong specular, mask support (Dota2 style), all them fancy effects Valve uses!
 +
* '''[http://www.aurelm.com/envo/ ENVO realtime environment shader]''' by [http://www.aurelm.com/ Aurel Manea]
 +
From the Polycount thread [http://www.polycount.com/forum/showthread.php?t=100187 ENVO realtime environment shader for 3d studio max].
 +
* '''[http://www.polycount.com/forum/showpost.php?p=1610563&postcount=2 MoP Texture Blender]''' by [http://www.greveson.co.uk Paul "MoP" Greveson]
 +
This shader uses blendmodulate for vertex blending with per-pixel detail. From the Polycount thread [https://polycount.com/discussion/66952/the-snow-and-ice-of-uncharted2 The Snow and Ice of Uncharted2?].
 +
* '''[http://rtshaders.deviantart.com/art/Paragalis-Shader-Demo-110994545 Paragalis Shader Demo]''' by [http://rtshaders.deviantart.com Wang "RTshaders" Jing].
 +
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."''
 +
* '''[https://web.archive.org/web/20110216152431/http://www.jistyles.com/main.php?id=doc&page=hlsl SSS Skin Shader]''' by [https://web.archive.org/web/20110216134007/http://www.jistyles.com/ J.I. Styles].
 +
''"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."''
 +
* '''[http://blog.maginot.eu/index.php?seite=people&people=till&page=mhn2048106717 TF2 Shader for 3ds Max]''' and '''[http://blog.maginot.eu/index.php?p=till.1__scriptnstuff_shader_toon Toon/Comic Shader for 3ds Max]''' by [http://www.till.maginot.eu/ Till "Rollin" Maginot].
 +
More info in the Polycount thread ''[https://polycount.com/discussion/64453/tf2-and-toon-realtime-viewport-shader-3ds-max TF2 and TOON realtime viewport shader (3ds max)]''.
  
<span id="Popular_Maya_Shaders"></span>
 
 
=== Maya Shaders ===
 
=== Maya Shaders ===
 
(in alphabetical order)
 
(in alphabetical order)
  
* '''[http://www.mentalwarp.com/~brice/brdf.php BRDF shader for Maya]''' by [http://www.mentalwarp.com/~brice Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud]<<BR>> More info in the Polycount thread ''[http://boards.polycount.net/showthread.php?t=49920 Free Maya/max cgfx/fx Shader]''. '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc.
+
* '''[http://www.mentalwarp.com/~brice/brdf.php BRDF shader for Maya]''' by [http://www.mentalwarp.com/~brice Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud]
* '''[http://www.polycount.com/forum/showthread.php?t=110022 DOTA2 Hero Shader - 3DS & Maya Shader Material]''' by [http://www.polycount.com/forum/member.php?u=43116 Luigi 'Ace-Angel' Kavijian] and [http://drewwatts.net/ Drew 'Drew++' Watts].<<BR>> Half-Lambert diffuse term with controllable falloff, additive rimlighting, Phong specular, mask support (Dota2 style), all them fancy effects Valve uses!
+
More info in the Polycount thread ''[https://polycount.com/discussion/49920/free-maya-max-cgfx-fx-shader Free Maya/max cgfx/fx Shader]''. '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc.
* '''[http://www.kostas.se/?p=142 KoddeShader]''' by [http://www.kostas.se Kostas "Kodde" Gialitakis]<<BR>> Has several features such as normal mapping, specular, gloss, reflections, ambient cube, parallax, etc. More info in the Polycount thread ''[http://boards.polycount.net/showthread.php?t=69161 "KoddeShader", a Maya CGFX shader]''. '''Update:''' [http://www.kostas.se/?p=17 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.
+
* '''[http://www.polycount.com/forum/showthread.php?t=110022 DOTA2 Hero Shader - 3DS & Maya Shader Material]''' by [http://www.polycount.com/forum/member.php?u=43116 Luigi 'Ace-Angel' Kavijian] and [http://drewwatts.net/ Drew 'Drew++' Watts].
 +
Half-Lambert diffuse term with controllable falloff, additive rimlighting, Phong specular, mask support (Dota2 style), all them fancy effects Valve uses!
 +
* '''[http://www.kostas.se/?p=142 KoddeShader]''' by [http://www.kostas.se Kostas "Kodde" Gialitakis]
 +
Has several features such as normal mapping, specular, gloss, reflections, ambient cube, parallax, etc. More info in the Polycount thread ''[https://polycount.com/discussion/69161/koddeshader-a-maya-cgfx-shader "KoddeShader", a Maya CGFX shader]''. '''Update:''' [http://www.kostas.se/?p=17 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.
 
* '''[http://www.kostas.se/?p=30 TGA Physically Based Lighting shader]''' by [http://www.kostas.se Kostas "Kodde" Gialitakis] and [http://www.defrostgames.com Niklas Hansson]. Is based around a Physically Based Lighting method of shading where you define materials with albedo, substance and roughness texture rather than diffuse, specular, gloss. Has other features such as cube map based reflections and ambient lighting, normal maps, ambient occlusion, substance based fresnel term which alters reflections and specular, blurred reflections, fully linear shading, energy conserving ambient/reflections, blended normals, etc.
 
* '''[http://www.kostas.se/?p=30 TGA Physically Based Lighting shader]''' by [http://www.kostas.se Kostas "Kodde" Gialitakis] and [http://www.defrostgames.com Niklas Hansson]. Is based around a Physically Based Lighting method of shading where you define materials with albedo, substance and roughness texture rather than diffuse, specular, gloss. Has other features such as cube map based reflections and ambient lighting, normal maps, ambient occlusion, substance based fresnel term which alters reflections and specular, blurred reflections, fully linear shading, energy conserving ambient/reflections, blended normals, etc.
* '''[http://blog.leocov.com/p/downloads.html lcUberShader, lcSkinShader, lcHairShader, lcLitSphere, lcReproject]''' by [http://www.leocov.com/ Leonardo "chronic" Covarrubias]<<BR>> Many techniques and parameters, including normal mapping, specular, ambient env cube, SSS, litspheres, etc.
+
* '''[http://blog.leocov.com/p/downloads.html lcUberShader, lcSkinShader, lcHairShader, lcLitSphere, lcReproject]''' by [http://www.leocov.com/ Leonardo "chronic" Covarrubias]
* '''[https://dl.dropbox.com/u/53969153/Shaders/Cryengine3_VertexBlend_Maya1Light.zip Vertex Color BlendMasked CgFX Maya Shader]''' by [http://klass87.blogspot.fr/ Amir "choco" Abdaoui] and [http://cruxic.com/ Drew "Drew++" Watts].<<BR>>  More info in the Polycount thread ''[http://www.polycount.com/forum/showthread.php?t=105291 Vertex color BlendMasked cgfx maya shader]''.
+
Many techniques and parameters, including normal mapping, specular, ambient env cube, SSS, litspheres, etc.
 +
* '''[https://dl.dropbox.com/u/53969153/Shaders/Cryengine3_VertexBlend_Maya1Light.zip Vertex Color BlendMasked CgFX Maya Shader]''' by [http://klass87.blogspot.fr/ Amir "choco" Abdaoui] and [http://cruxic.com/ Drew "Drew++" Watts].
 +
More info in the Polycount thread ''[http://www.polycount.com/forum/showthread.php?t=105291 Vertex color BlendMasked cgfx maya shader]''.
  
 
=== UDK Shaders ===
 
=== UDK Shaders ===
* '''[http://www.polycount.com/forum/showthread.php?t=103068 WL-Shader]''' by [http://unreal.rgr.jp/ "TA20"]<<BR>> UDK shaders for cloth, skin, water, glass, foliage, bricks, etc.
+
* '''[http://www.polycount.com/forum/showthread.php?t=103068 WL-Shader]''' by [http://unreal.rgr.jp/ "TA20"]
 +
UDK shaders for cloth, skin, water, glass, foliage, bricks, etc.
  
 
== Creating Shaders ==
 
== Creating Shaders ==
Line 42: Line 59:
  
 
=== Beginner Tutorials ===
 
=== Beginner Tutorials ===
* [https://www.cg-academy.net/es_catalog/product_info.php?products_id=64&osCsid=5jn41nk4i5uii38d3t0sg4tn53c430a3 CG Academy HLSL Shader Creation series] by [http://www.bencloward.com/ Ben Cloward] ($) is an excellent 3-part series on making HLSL shaders for 3ds Max (can easily be transferred to Maya too).
+
 
 +
* [https://m.youtube.com/playlist?list=PL78XDi0TS4lEDHfahG4ddRwZ3AUrOIYcq HLSL Shader Creation 1 - HLSL Shader Fundamentals (14 videos)] by [http://www.bencloward.com/ Ben Cloward] is part 1 of an excellent series on making HLSL shaders for 3ds Max (can easily be transferred to Maya too).
 +
 
 +
* [https://m.youtube.com/playlist?list=PL78XDi0TS4lE772rZflLkFe-WdhYEV4WE HLSL Shader Creation 2 - Light and Shading Models (15 videos)] by [http://www.bencloward.com/ Ben Cloward] is part 2 of an excellent series on making HLSL shaders for 3ds Max (can easily be transferred to Maya too).
 +
 
 +
* [https://m.youtube.com/playlist?list=PL78XDi0TS4lE6UnUO9OTC5M1Wo3bJLDe9 HLSL Shader Creation 3 - Surface Shading & Transmission (11 videos)] by [http://www.bencloward.com/ Ben Cloward] is part 3 of an excellent series on making HLSL shaders for 3ds Max (can easily be transferred to Maya too).
 +
 
 
* [http://cgcookie.com/unity/series/introduction-to-surface-shader-scripting CGCookie - Introduction to surface shader scripting in Unity by Alex Telford] Step by step tutorial with basics of writing for Unity 3.x.
 
* [http://cgcookie.com/unity/series/introduction-to-surface-shader-scripting CGCookie - Introduction to surface shader scripting in Unity by Alex Telford] Step by step tutorial with basics of writing for Unity 3.x.
 
* [http://cgcookie.com/unity/cgc-series/noob-to-pro-shader-writing-for-unity-4-beginner/ CGCookie - Noob to pro shader writing for Unity for beginners by Alex Telford] Another tutorial by Alex Telford designed for Unity 4.
 
* [http://cgcookie.com/unity/cgc-series/noob-to-pro-shader-writing-for-unity-4-beginner/ CGCookie - Noob to pro shader writing for Unity for beginners by Alex Telford] Another tutorial by Alex Telford designed for Unity 4.
* [http://eat3d.com/blog/eat-3d/new-dvd-release-shader-production-writing-custom-shaders-cgfx Eat3D's "Shader Production - Writing Custom Shaders with CGFX"] by [http://www.linkedin.com/pub/luiz-kruel/3/127/463 Luiz Kruel] ($) is anotehr excellent video tutorial that guides you through writing your own shaders, primarily with the CGFX shader language in Maya. DVD release was September 14, 2011.
+
* [https://trinity3d.com/udk-shader-production.html Eat3D's "Shader Production - Writing Custom Shaders with CGFX"] by [http://www.linkedin.com/pub/luiz-kruel/3/127/463 Luiz Kruel] ($) is anotehr excellent video tutorial that guides you through writing your own shaders, primarily with the CGFX shader language in Maya. DVD release was September 14, 2011.
 
* [http://bencloward.com/resources_shaders.shtml Shaders by Ben Cloward] These shaders are a bit outdated and there are more up-to-date shaders to learn from, but Ben's shaders are what got many artists started on the path and are still a solid learning resource.
 
* [http://bencloward.com/resources_shaders.shtml Shaders by Ben Cloward] These shaders are a bit outdated and there are more up-to-date shaders to learn from, but Ben's shaders are what got many artists started on the path and are still a solid learning resource.
 
* [http://www.robg3d.com/?page_id=13 Shaders by Rob Galanakis (right side of page)] Some well-commented shaders that cover a variety of intermediate to advanced topics.
 
* [http://www.robg3d.com/?page_id=13 Shaders by Rob Galanakis (right side of page)] Some well-commented shaders that cover a variety of intermediate to advanced topics.
Line 52: Line 75:
  
 
=== Intermediate Tutorials ===
 
=== Intermediate Tutorials ===
* [http://www.moddb.com/games/unreal-tournament-3/tutorials/tf2-shading-in-ut3 TF2 Shading in UT3] by [http://polyphobia.de Steffen "Neox" "polyphobia" Unger]<<BR>> Shows how the Team Fortress 2 look can be emulated using a shader network in Unreal Engine 3.
+
* [http://www.polycount.com/forum/showthread.php?t=144863 The Photoshop color curve in HLSL?]
 +
* [http://www.moddb.com/games/unreal-tournament-3/tutorials/tf2-shading-in-ut3 TF2 Shading in UT3] by [http://polyphobia.de Steffen "Neox" "polyphobia" Unger]
 +
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.
 
* [[ParallaxMap]]: different techniques for parallax mapping (offset, parallax occlusion, relief, etc.), with links to the papers detailing them and other related resources.
 
* [http://www.ericchadwick.com/examples/provost/byf1.html 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.
 
* [http://www.ericchadwick.com/examples/provost/byf1.html 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 ===
 
=== Advanced Tutorials ===
 +
*[[File:Boston Game Dev Group 2020 Shaders.pdf|Boston Game Dev Group 2020 Shaders]] (7mb PDF) by Jason Booth, presented at Boston Post Mortem on January 14, 2020.
  
 
== Tools ==
 
== Tools ==
Line 66: Line 93:
 
* [http://www.mentalimages.com/products/mental-mill/standard-edition.html 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 [http://www.mentalimages.com/products/mental-mill/artist-edition.html Artist Edition] is free for personal use, and came bundled with 3ds Max 2010.
 
* [http://www.mentalimages.com/products/mental-mill/standard-edition.html 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 [http://www.mentalimages.com/products/mental-mill/artist-edition.html Artist Edition] is free for personal use, and came bundled with 3ds Max 2010.
 
* [http://www.imgtec.com/powervr/insider/sdkdownloads/ 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.
 
* [http://www.imgtec.com/powervr/insider/sdkdownloads/ 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.
* [http://developer.amd.com/gpu/rendermonkey/ RenderMonkey] is AMD's shader authoring toolset.
+
* [https://web.archive.org/web/20160322035140/http://developer.amd.com/tools-and-sdks/archive/legacy-cpu-gpu-tools/rendermonkey-toolsuite/ RenderMonkey] is AMD's shader authoring toolset.
  
 
=== Shader Tools for 3ds Max ===
 
=== Shader Tools for 3ds Max ===
Line 77: Line 104:
 
=== Shader Tools for Unity ===
 
=== Shader Tools for Unity ===
 
* [http://www.polycount.com/forum/showthread.php?t=123439 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."''
 
* [http://www.polycount.com/forum/showthread.php?t=123439 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."''
* [http://www.shaderfusionblog.com/?cat=6 ShaderFusion] is a node-based shader editor for [http://unity3d.com/ Unity].
+
* [https://web.archive.org/web/20131021112505/http://www.shaderfusionblog.com/?cat=6 ShaderFusion] is a node-based shader editor for [http://unity3d.com/ Unity].
 
* [http://forum.unity3d.com/threads/56180-Strumpy-Shader-Editor-Now-Open-Source Strumpy Shader Editor] another node-based shader editor for [http://unity3d.com/ Unity].
 
* [http://forum.unity3d.com/threads/56180-Strumpy-Shader-Editor-Now-Open-Source Strumpy Shader Editor] another node-based shader editor for [http://unity3d.com/ Unity].
  
Line 84: Line 111:
  
 
== Tech_Artists.Org Wiki ==
 
== Tech_Artists.Org Wiki ==
For more info see [http://tech-artists.org/wiki/Portal:Shaders Portal:Shaders] on the Tech Artists Wiki.
+
For more info see [https://web.archive.org/web/20161220010245/http://tech-artists.org/wiki/Portal:Shaders Portal:Shaders] on the Tech Artists Wiki.
  
These pages need to be ported, see [[Category:TechnicalArt#Tech-Artists.Org_Wiki_Conversion]].
+
These pages need to be ported, see [[Technical_Art#Tech-Artists.Org_Wiki_Conversion|Technical Art:Tech-Artists.Org_Wiki_Conversion]].
 
{| border="1" cellpadding="2" cellspacing="0"
 
{| border="1" cellpadding="2" cellspacing="0"
|<class="red">| [[Shaders for Artists]]  
+
|<class="red">| [[Shaders for Artists]]
 +
| What are shaders and what do they do?
 
|-
 
|-
|<class="red">| [[Blending functions]]  
+
|<class="red">| [[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.
 
|-
 
|-
|<class="red">| [[NormalVector]], [[BinormalVector]], and [[TangentVector]]  
+
|<class="red">| [[NormalVector]], [[BinormalVector]], and [[TangentVector]]
 +
| are the three vectors that make up surface vector information, and a basic understanding is essential to understand lighting.
 
|-
 
|-
 
|<class="red">| [[Glossary (Shaders)]]  
 
|<class="red">| [[Glossary (Shaders)]]  
 +
| A listing of terms used in shaders, such as half angle, glossiness, etc.
 
|-
 
|-
|<class="red">| [[UnitVector]]  
+
|<class="red">| [[UnitVector]]
 +
| What is a unit vector (also known as a normalized vector), and why is it important to us?
 
|-
 
|-
|<class="red">| [[Shading models]]  
+
|<class="red">| [[Shading models]]
 +
| Describe the different models, such as [[Blinn]], [[Phong]], etc.
 
|-
 
|-
|<class="red">| [[DDS]] and [[Normal map compression]]  
+
|<class="red">| [[DDS]] and [[Normal map compression]]
 +
| Explain the best ways to save and compress normal maps and other textures.
 
|-
 
|-
|<class="red">| [[Vertex skinning]]:  
+
|<class="red">| [[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.
 
|-
 
|-
|<class="red">| [[[MaxScript|DirectX Scripted Material Plugin]]]:  
+
|<class="red">| [[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.
 
|}
 
|}
  
[[Category:Texturing]] [[Category:Portfolio]] [[Category:Technology]] [[Category:Shaders]]
+
----
 +
[[Category:Technical_Art]] [[Category:Texturing]] [[Category:Portfolio]] [[Category:Technology]] [[Category:Shaders]] [[Category:Code]]

Latest revision as of 10:45, 15 January 2020

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 better performance for less accuracy.

Conversely, "offline" shaders are used with non-real-time renderers, like V-Ray or 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 Technical Art:Tech-Artists.Org_Wiki_Conversion.

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