You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2D can use built-in default textures: “white”, “black”, “gray” or “bump”
_Name ("display name", 2D) = "" {}
_Name ("display name", Cube) = "" {}
_Name ("display name", 3D) = "" {}
// Property attribute drawers
// [HideInInspector] - does not show the property value in the material inspector.
// [NoScaleOffset] - material inspector will not show texture tiling/offset fields for texture properties with this attribute.
// [Normal] - indicates that a texture property expects a normal-map.
// [HDR] - indicates that a texture property expects a high-dynamic range (HDR) texture.
// [Gamma] - indicates that a float/vector property is specified as sRGB value in the UI (just like colors are), and possibly needs conversion according to color space used. See Properties in Shader Programs.
// [PerRendererData] - indicates that a texture property will be coming from per-renderer data in the form of a MaterialPropertyBlock. Material inspector changes the texture slot UI for these properties.
// Later on in the shader’s fixed function parts, property values can be accessed using property name in square brackets: [name] e.g. Blend [_SrcBlend] [_DstBlend].
// Background - this render queue is rendered before any others. You’d typically use this for things that really need to be in the background.
// Geometry (default) - this is used for most objects. Opaque geometry uses this queue.
// AlphaTest - alpha tested geometry uses this queue. It’s a separate queue from Geometry one since it’s more efficient to render alpha-tested objects after all solid ones are drawn.
// Transparent - this render queue is rendered after Geometry and AlphaTest, in back-to-front order. Anything alpha-blended (i.e. shaders that don’t write to depth buffer) should go here (glass, particle effects).
// Overlay - this render queue is meant for overlay effects. Anything rendered last should go here (e.g. lens flares).
// RenderType tag: (Can you custom values and use Camera.RenderWithShader or Camera.SetReplacementShader to render camera with selected subshader e.g. replacementTag="RenderType=Transparent"
// Opaque: most of the shaders (Normal, Self Illuminated, Reflective, terrain shaders).
// SoftVegetation: Render this pass only if Soft Vegetation is on in Quality Settings.
// DisableBatching tag
// True, False, LODFading
// ForceNoShadowCasting tag
// IgnoreProjector tag
// CanUseSpriteAtlas tag
// PreviewType tag
// Sphere, Plane, Skybox
GrabPass { }
// Just GrabPass { } will grab current screen contents into a texture. The texture can be accessed in further passes by _GrabTexture name.
// Note: this form of grab pass will do the expensive screen grabbing operation for each object that uses it!
// GrabPass { "TextureName" } will grab screen contents into a texture, but will only do that once per frame for the first object that uses the given texture name.
// The texture can be accessed in further passes by the given texture name. This is a more performant way when you have multiple objects using grab pass in the scene.
// Additionally, GrabPass can use Name and Tags commands.
UsePass"Shader/Name"
// Inserts all passes with a given name from a given shader. Shader/Name contains the name of the shader and the name of the pass, separated by a slash character.
// Note that only first supported subshader is taken into account.
// ColorMask RGB | A | 0 | any combination of R, G, B, A
// Offset OffsetFactor, OffsetUnits
CGPROGRAM
#pragma vertex name // compile function name as the vertex shader.
#pragma fragment name // compile function name as the fragment shader.
#pragma geometry name // compile function name as DX10 geometry shader. Having this option automatically turns on #pragma target 4.0, described below.
#pragma hull name // compile function name as DX11 hull shader. Having this option automatically turns on #pragma target 5.0, described below.
#pragma domain name // compile function name as DX11 domain shader. Having this option automatically turns on #pragma target 5.0, described below.
// Other compilation directives:
// #pragma target name - which shader target to compile to. See Shader Compilation Targets page for details.
// #pragma only_renderers space separated names - compile shader only for given renderers. By default shaders are compiled for all renderers. See Renderers below for details.
// #pragma exclude_renderers space separated names - do not compile shader for given renderers. By default shaders are compiled for all renderers. See Renderers below for details.
// #pragma multi_compile - for working with multiple shader variants.
// #pragma shader_feature - for working with multiple shader variants. (unused variants of shader_feature shaders will not be included into game build)
// #pragma enable_d3d11_debug_symbols - generate debug information for shaders compiled for DirectX 11, this will allow you to debug shaders via Visual Studio 2012 (or higher) Graphics debugger.
// #pragma multi_compile_instancing
// VARIABLES
// Color and Vector properties map to float4, half4 or fixed4 variables.
// Range and Float properties map to float, half or fixed variables.
// Texture properties map to sampler2D variables for regular (2D) textures; Cubemaps map to samplerCUBE; and 3D textures map to sampler3D.
// Shader property values are found and provided to shaders from these places:
// Per-Renderer values set in MaterialPropertyBlock. This is typically “per-instance” data (e.g. customized tint color for a lot of objects that all share the same material).
// Values set in the Material that’s used on the rendered object.
// Global shader properties, set either by Unity rendering code itself (see built-in shader variables), or from your own scripts (e.g. Shader.SetGlobalTexture).