Adding material properties to shaders
Introduction to material propertiesIn your ShaderLabUnityâs language for defining the structure of Shader objects. More info
See in Glossary code, you can define material properties. A material property is a property that Unity stores as part of the material asset. This allows artists to create, edit, and share materials with different configurations.
If you use material properties:
If you do not use material properties:
The only times that you would normally not create a material property is if you want to set shader property values entirely using scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary (for example, if you are making procedural content), if the properties cannot be made into material properties, or if you donât want them to be edited in the Inspector.
Shader property values are found and provided to shaders from these places:
The order of precedence is like above: per-instance data overrides everything; then Material data is used; and finally if shader property does not exist in these two places then global property value is used. Finally, if thereâs no shader property value defined anywhere, then âdefaultâ (zero for floats, black for colors, empty white texture for textures) value will be provided.
Serialized and Runtime Material propertiesMaterials can contain both serialized and runtime-set property values.
Serialized data is all the properties defined in shaderâs Properties block. Typically these are values that need to be stored in the material, and are tweakable by the user in Material Inspector.
A material can also have some properties that are used by the shader, but not declared in shaderâs Properties block. Typically this is for properties that are set from script code at runtime, e.g. via Material.SetColor. Note that matrices and arrays can only exist as non-serialized runtime properties (since thereâs no way to define them in Properties block).
Adding material properties to shaders
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4