05-05 04:54
Notice
Recent Posts
Recent Comments
관리 메뉴

Scientific Computing & Data Science

Display Normal Shader 본문

CG & Video Games/Unity 3D

Display Normal Shader

cinema4dr12 2013. 5. 26. 12:06

Shader "Tutorial/Display Normals" {

SubShader {

    Pass {

 

CGPROGRAM

#pragma vertex vert

#pragma fragment frag

#include "UnityCG.cginc"

 

struct v2f {

    float4 pos : SV_POSITION;

    float3 color : COLOR0;

};

 

v2f vert (appdata_base v)

{

    v2f o;

    o.pos = mul (UNITY_MATRIX_MVP, v.vertex);

    o.color = v.normal * 0.5 + 0.5;

    return o;

}

 

half4 frag (v2f i) : COLOR

{

    return half4 (i.color, 1);

}

ENDCG

 

    }

}

Fallback "VertexLit"

}

'CG & Video Games > Unity 3D' 카테고리의 다른 글

Dynamic Images  (0) 2013.05.26
VertextLit Shader  (0) 2013.05.26
Rendering with Different Cameras  (0) 2013.05.26
Movie Texture Script  (0) 2013.05.26
Random Number Generation in C#  (0) 2013.05.25
Comments