Template and World Position

Node-based Shader Editor

Template and World Position

Postby eXiin » Wed Nov 28, 2018 10:13 pm

Hello,

I'm making a new template, Within the VertexOutput I'm embedding the "worldPos" by default.
However, when I add it, other nodes using the worldPos generate errors, as it's already declared

Code: Select all
   struct VertexOutput
           {
               float4 clipPos      : SV_POSITION;
                float3 worldPos : TEXCOORD0;
                /*ase_interp(0,):sp=sp.xyzw;*/
                UNITY_VERTEX_INPUT_INSTANCE_ID
                UNITY_VERTEX_OUTPUT_STEREO
           };


A cheap solution will be to rename my default variable in worldPosition, but I was wandering if I could use a flag or something similar?
eXiin
 
Posts: 20
Joined: Sun Sep 02, 2018 4:34 pm

Re: Template and World Position

Postby eXiin » Wed Nov 28, 2018 10:26 pm

changing
/*ase_interp(0,):sp=sp.xyzw;*/

to

/*ase_interp(1,):sp=sp.xyzw;*/

fixed the issue, but I'm not sure it was the way to go?
eXiin
 
Posts: 20
Joined: Sun Sep 02, 2018 4:34 pm

Re: Template and World Position

Postby Amplify_Borba » Tue Dec 04, 2018 5:05 pm

Hello!

Since you're using the first interpolator ( TEXCOORD0 ), you'll need to indicate that it can't be used by ASE, hence the ase_interp(1,), but you'll also have to indicate that it contains the World Position, adding wp=tc0, so that the tag looks like the following:

/*ase_interp(1,):sp=sp.xyzw;wp=tc0*/

This way, everytime that ASE uses anything that requires the World Position, it will use the interpolator directly instead of calculating again.

Please let me know if this helps and if you have any further questions.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 8 guests