Search

'HLSL'에 해당되는 글 1건

  1. 2006/07/21 Shader Semantics

Shader Semantics

Game Dev./General 2006/07/21 17:32 Posted by sonee

The semantics can be used to access easily a variable that want to use, but some semantics can't be used because they are already defined. Next semantics are the list of semantics already defined.
(source: http://msdn.microsoft.com/en-us/library/bb509650(VS.85).aspx )

<Development shader system using semantics - 4.June, 06 by sonee>

Vertex Shader Semantics

These semantics have meaning when attached to a vertex-shader parameters. These semantics are supported in both Direct3D 9 and Direct3D 10.

Input Description Type
BINORMAL[n] Binormal float4
BLENDINDICES[n] Blend indices uint
BLENDWEIGHT[n] Blend weights float
COLOR[n] Diffuse and specular color float4
NORMAL[n] Normal vector float4
POSITION[n] Vertex position in object space. float4
POSITIONT Transformed vertex position. float4
PSIZE[n] Point size float
TANGENT[n] Tangent float4
TEXCOORD[n] Texture coordinates float4
Output Description Type
COLOR[n] Diffuse or specular color float4
FOG Vertex fog float
POSITION[n] Position of a vertex in homogenous space. Compute position in screen-space by dividing (x,y,z) by w. Every vertex shader must write out a parameter with this semantic. float4
PSIZE Point size float
TESSFACTOR[n] Tessellation factor float
TEXCOORD[n] Texture coordinates float4

n is an optional integer between 0 and the number of resources supported. For example, POSITION0, TEXCOOR1, etc.

Generally, the most programmers are using TEXCOORD[n] semantics to give pixel shader any parameters to present their special materials in Vertex Shader.

Pixel Shader Semantics

These semantics have meaning when attached to a pixel-shader input parameter. These semantics are supported in both Direct3D 9 and Direct3D 10.

Input Description Type
COLOR[n] Diffuse or specular color. float4
TEXCOORD[n] Texture coordinates float4
VFACE Floating-point scalar that indicates a back-facing primitive. A negative value faces backwards, while a positive value faces the camera. float
VPOS Contains the current pixel (x,y) location. float2
Output Description Type
COLOR[n] Output color float4
DEPTH[n] Output depth float

n is an optional integer between 0 and the number of resources supported. For example, PSIZE0, COLOR1, etc.

The COLOR semantic is only valid in shader compatibility mode (that is, when the shader is created using D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY).

TAG ,