Page 1 of 1

Template and World Position

PostPosted: Wed Nov 28, 2018 10:13 pm
by eXiin
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?

Re: Template and World Position

PostPosted: Wed Nov 28, 2018 10:26 pm
by eXiin
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?

Re: Template and World Position

PostPosted: Tue Dec 04, 2018 5:05 pm
by Amplify_Borba
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.