본문 바로가기
유니티

[쉐이더노트] input structure

by Raypop 2014. 11. 19.

Surface Shader input structure

The input structure Input generally has any texture coordinates needed by the shader. Texture coordinates must be named “uv” followed by texture name (or start it with “uv2” to use second texture coordinate set).

Additional values that can be put into Input structure:

  • float3 viewDir - will contain view direction, for computing Parallax effects, rim lighting etc.
  • float4 with COLOR semantic - will contain interpolated per-vertex color.
  • float4 screenPos - will contain screen space position for reflection effects. Used by WetStreet shader in Dark Unity for example.
  • float3 worldPos - will contain world space position.
  • float3 worldRefl - will contain world reflection vector if surface shader does not write to o.Normal. See Reflect-Diffuse shader for example.
  • float3 worldNormal - will contain world normal vector if surface shader does not write to o.Normal.
  • float3 worldRefl; INTERNAL_DATA - will contain world reflection vector if surface shader writes to o.Normal. To get the reflection vector based on per-pixel normal map, use WorldReflectionVector (IN, o.Normal). See Reflect-Bumped shader for example.
  • float3 worldNormal; INTERNAL_DATA - will contain world normal vector if surface shader writes to o.Normal. To get the normal vector based on per-pixel normal map, use WorldNormalVector (IN, o.Normal).

'유니티' 카테고리의 다른 글

[쉐이더노트] Built-in matrices  (0) 2015.01.06
[노트] uv 위치값 변경  (0) 2015.01.06
[쉐이더노트] Surface Shader compile directives  (0) 2014.12.22
[쉐이더노트] SurfaceOutput  (0) 2014.11.19
[쉐이더노트] appdata_full  (0) 2014.11.14