Unity Products:Amplify Shader Editor/Template Local Var Data

From Amplify Creations Wiki
Jump to navigation Jump to search

Template Local Var Data Node

The Template Local Var Data node allows access to local variables registered through the /*ase_local_var*/ tag over the currently used Template shader via the Data dropdown option. The node's Outputs type and amount will vary according to which type of data is currently selected.
NOTE: This tag can register local variables both on vertex and fragment data and on all available passes, it's up to the user to know what that variable represents and to which output node it should be used.
Node header color changes according to where the local variable was registered. Red represent vertex local variables and yellow represent fragment variables.


Here's a quick snippet on how to register a local variable over the template:

v2f vert ( appdata v /*ase_vert_input*/)
{
	v2f o;
	UNITY_SETUP_INSTANCE_ID(v);
	UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
	o.texcoord.xy = v.texcoord.xy;

	/*ase_local_var*/float3 MyLocalVar;

	/*ase_vert_code:v=appdata;o=v2f*/
	v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3*/ float3(0,0,0) /*end*/;
	o.vertex = UnityObjectToClipPos(v.vertex);
	return o;
}


Node Parameter Description Default Value
SubShader Select which subshader to get local var data. 0
Pass Select which Pass to get local var data. 0
Data Select which local var data to output. <Template dependent>

Back to Node List