Shaderlab Documentation Requests

Post any documentation requests here. Please keep this thread just to requests and not discussions. Any not request posts will be removed (this is just to make it easier for us for when we look through the thread).

Some random ideas… (from someone who hasnt done any shader stuff before unity…)

  • Easy to find list of all the possible keywords, functions etc. that are supported in unity, as in: http://http.developer.nvidia.com/Cg/index_stdlib.html
  • Also some reference grid (or color code on the page) would indicate if it works on indie or pro… (color code would be useful in other documents also… now the text “requires pro” is just somewhere inside the page/text…)
  • Search box for the documentation (something that actually works… with autocomplete etc. or just add google site search form…)
  • Info how to convert shaders from other languages/engines (you want people to come to unity…make it easy for them)
  • And this kind of info: http://forum.unity3d.com/threads/66271-Nvidia-ShaderFx-standart-matrices-equavelant-in-unity
  • Update shader FAQ (with real top 30 questions that are always coming up…)
  • More example sources… (maybe you could even pick your shader language/target(?) to view the code, just like in scripting docs you pick js/c#/boo…)
  • Images on the documentation, what is world reflection vector etc.? (draw the line how it works / what it means, or put a link to wikipedia or other sites…)
  • CHM help file would be perfect… (see example: MaxScript .chm documentation from 3ds max 2010 vs 2012 online help version… the new (search) system is horrible)
  • Error code database with atleast some short human readable explanations…

Cloned and updated post from the documenation wish list topic:

-A Shader Command Reference (incl. predefined macros, variables and compiler pragmas) would be really helpful. (incl. remarks if a specific command is not available on certain devices). This should also include working CG commands - even if those commands can be found elsewhere a compilated documentation is by far better then searching the internet.
-For each type of shader (fragment, vertex, surface) there should be a description in table form which in- and output values are possible / obligatory
-A differentiation between the possible techniques( fixed function, fragment, vertex, surface ) and when to use what and how interaction with Unity lights, Beast lightmaps and light probes work.
-Better and more detailed description for Surface Shaders. How does multi-pass rendering work? Which of the regular shader commands like Blend, ZWrite, Lighting work? Is it possible to write a depth value? How to combine surface shader with regular ones?

In depth explanation of light probes and shaders and lots and lots of mobile friendly tips and snippets for cg. I feel quite strongly I’d like to stay in cg as it is cross platform.

A list of fast and slow common shader issues in unity. Making our own shaders is the aim of documentation so I want to make them faster and higher performing. Documentation important for speed because trial and error will get you a slow but working shader hacking unity stuff. We don’t want that.

1 Like

i wonder since unity started doing curves for the shuriken particle system they started to implement it into other systems such as the mechanim and so on,
so one question would be what if they made something similar to strumpy implementing the curves and the behavior tree from mechanim? i wonder if they would do that for their AI and new gui? lol then again this probably be out of context lol.

A list of all the keywords/defines that Unity uses - and descriptions of where/when - would be really handy.

I want a clear full step of how lights is picked and setted to such as _WorldSpaceLightPos0 and unity_LightPosition before one object is going to be rendered

I thought that already was…

It is,but not clear enough. I wanna to see the ‘if else’ code which we dont know,it should be some of unity’s source code, i guess

More document for UnityCG.cginc,AutoLight.cginc,Lighting.cginc and etc.
I can guess it from function name and its description,but I can’t guess the parameters mean.

Documentation about DirectX 11 hair shader would be great :slight_smile: I read Nvidia was involved in the solution, not sure if it can be public thought.

Can you please post the surface shader examples page included in the docs for 3.5? Thanks.

--------More documentation on grabpass, and its uses. What can you all do with the texture that is grabbed, and how to use this in a cg program, besides just shaderlab and setTexture.

-------Common shader functions and how do do them/ set them up.
-------How to get pixel data from grab pass, texture, or manipulating pixel data

It is not for a document,but i think it is the most proper place.
how long should we wait to use Nvidia’s NSight to debug shader in unity,any way can we do that
or any genius makes a tool like that

Document how to modify/use replacement shaders for the built-in CameraDepth-Texture shaders.

complete! documentation of all built-in graphics related functionality

  • the include files
  • precompiled macros
  • shader variables set by unity
  • exact form of the projection matrices used by standard cameras and shadowmap cameras

Even if it will change often. I’d rather adapt code to documented changes than having big holes in the documentation.

Right now our best hope for an answer is a direct question to aras or someone else in the know. They are doing a great job, but obviously can’t answer any single request. Having a complete documentation would reduce the number of questions to answer and open up space for customization by the community…

Documentation for

float clamped = max(o.pos.z, o.pos.w*UNITY_NEAR_CLIP_VALUE);
o.pos.z = lerp(o.pos.z, clamped, unity_LightShadowBias.y);

in #define TRANSFER_SHADOW_CASTER(o) in UnityCG.cginc

Without knowing the exact setup of the projection matrix I have to guess what the value of o.pos.w is.
unity_LightShadowBias seems to be an undocumented variable. The x-component apparently is the light.bias, but what is in the y-component?

I’d like the documentation on the custom Z values mentioned in the 4.2 release notes.

看不懂

Documentation doesn’t mention you can add [HideInInspector] before property in a shader.
Are there other options, like property drawers?