2016년 6월 30일 목요일

Unity Shader Properties


Accessing shader properties

Properties 정의

_MyColor ("Some Color", Color) = (1,1,1,1)
_MyVector ("Some Vector", Vector) = (0,0,0,0)
_MyFloat ("My float", Float) = 0.5
_MyTexture ("Texture", 2D) = "white" {}
_MyCubemap ("Cubemap", CUBE) = "" {}

Properties 엑세스를 위한 선언

fixed4 _MyColor; // low precision type is usually enough for colors
float4 _MyVector;
float _MyFloat;
sampler2D _MyTexture;
samplerCUBE _MyCubemap;

-> uniform keyword is not necessary:
uniform float4 _MyColor;

Color, Vector -> float4, half4, fixed4
Range, Float -> float, half, fixed
2D textures -> sampler2D
3D textures -> sampler3D
Cubemaps -> samplerCUBE











=====================================================

댓글 없음:

댓글 쓰기