Page 1 of 1

CustomExpression: Fragment Input

PostPosted: Fri Nov 24, 2017 10:40 am
by sunrice
Hi :D
I use amplify shader editor with Template.

If ShaderType is Template, It can't access to Surface Data(WorldNormal, WorldPosition, etc.) Nodes.
I need to access "ase_frag_input" in CustomExpressionNode.
I write an example because I am not good English.
template:
struct v2f
{
float4 pos : SV_POSITION;
float4 tex : TEXCOORD0;
float3 posWorld : TEXCOORD1;
}

half4 frag (v2f i /*ase_frag_input*/) : SV_Target
{
// ase common template code
/*ase_frag_code:i=v2f*/

node:
float3 MyCustomExpression(v2f i)
{
return i.posWorld;
}

generated:
half4 frag (_v2f i ) : SV_Target
{
float3 lcoalMyCustomExpression = MyCustomExpression(i);

Re: CustomExpression: Fragment Input

PostPosted: Fri Nov 24, 2017 4:50 pm
by Amplify_Borba
Hello, thank you for getting in touch!

Are you using one of our available shader templates or building one of your own?

Looking forward to your reply!

Re: CustomExpression: Fragment Input

PostPosted: Sun Nov 26, 2017 8:29 am
by sunrice
I make full custom shader template for my project.
It use world position, tangent space transform for normal mapping in template.
It's no more TEXCOORD for interpolater.

template:
struct v2f
{
float4 pos : SV_POSITION;
float4 tex : TEXCOORD0;
float3 posWorld : TEXCOORD1;
half3 normalDir : TEXCOORD2;
half3 tangentDir : TEXCOORD3;
half3 bitangentDir : TEXCOORD4;
half3 eyeVec : TEXCOORD5;
UNITY_FOG_COORDS(6)
UNITY_SHADOW_COORDS(7) //LIGHTING_COORDS(7, 8)
half3 ambient : COLOR0;
/*ase_interp(8,9):sp=sp.xyzw;uv0=tc0.xy;uv1=tc0.zw*/
};

Re: CustomExpression: Fragment Input

PostPosted: Mon Nov 27, 2017 4:07 pm
by Amplify_Borba
Hello sunrice,

Apologies for the situation, but we're going to need you to send us both the shader and the template you've created so we can test them both on our side, would you mind sharing them with us?

You may upload them as a .zip file attachment to your forum post, or use https://wetransfer.com/ to share the files with us, thank you for your comprehension!

Looking forward to your reply.