- Home /
unity shader custom vertex stream - What does TEXCOORD0.w|x mean?
I understand that if I add Custom Vertex Stream: UV (TEXCOORD0.xy)
then I can access the UV like this
struct appdata_t
{
float4 texcoord : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
v2f vert (appdata_t v)
{
UNITY_SETUP_INSTANCE_ID(v);
//Access UV
v.texcoord.xy
But when I add other Custom Vertex Stream: stableRandom.xy (TEXCOORD0.w|x)
, I know this suppose to be 2 value, but How can I access TEXCOORD0.w|x
?
Answer by ValakhP · Oct 03, 2018 at 10:16 AM
Hello NathanJSmith,
That means that you can get w
from TEXCOORD0
and x
from TEXCOORD1
. Just add it to your appdata_t structure:
struct appdata_t
{
float4 texcoord : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
v2f vert (appdata_t v)
{
UNITY_SETUP_INSTANCE_ID(v);
//Access UV
v.texcoord.w
v.texcoord1.x
Thank ValakhP :) I immediately understood this when I saw the next Vertex S$$anonymous$$m is .yzw
Your answer
Follow this Question
Related Questions
How to manipulate a shader's alpha channel while using a texture? 1 Answer
Mobile performance of splat map shader with distance blending 0 Answers
Shader question: interaction with world objects? 1 Answer
vertex and geometry shader change with distance 0 Answers
Unlit Transparent With Color Support 1 Answer