Created
October 10, 2017 07:35
-
-
Save onionmk2/2e7e4f9caddbcb348e3a03bea395ca35 to your computer and use it in GitHub Desktop.
use cginc to write hlsl with VisualStudioHLSLTools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RGBCube.shader | |
Shader "RGBCube" { | |
SubShader{ | |
Pass{ | |
CGPROGRAM | |
#include "Assets\RBGCube\RGBCube_cginc.cginc" | |
#pragma vertex vert | |
#pragma fragment frag | |
ENDCG | |
} | |
} | |
} | |
// RGBCube_cginc.cginc | |
struct vertexOutput | |
{ | |
float4 pos : SV_POSITION; | |
float4 col : TEXCOORD0; //Texture coordinates | |
}; | |
vertexOutput vert(float4 vertexPos : POSITION) | |
{ | |
vertexOutput output; | |
output.pos = UnityObjectToClipPos(vertexPos); | |
output.col = vertexPos + float4(0.5, 0.5, 0.5, 0.0); | |
return output; | |
} | |
float4 frag(vertexOutput input) : COLOR | |
{ | |
return input.col; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In RGBCube_cginc.cginc, If you write
IDE can autocomplete ``UnityObjectToClipPos`.