SRP HD, precompute data on vertex and use it in surface.

Node-based Shader Editor
Post Reply
eXiin
Posts: 20
Joined: Sun Sep 02, 2018 4:34 pm

SRP HD, precompute data on vertex and use it in surface.

Post by eXiin »

I'm trying to do some calculation in the vertex, and then send it to the surface

the shader code is the following:

Code: Select all

struct Input
{
	float data; 
};

void vertexDataFunc( inout appdata_full v, out Input o )
{
	UNITY_INITIALIZE_OUTPUT( Input, o );
        o.data = value
}

void surf( Input i , inout SurfaceOutputStandard o )
{
      i.data
}
Ofc, when I do a node with a surface shader, I do as follow :

Code: Select all


public override string BuildResults(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar)
{
            dataCollector.AddToInput(UniqueId, "float data", true);
            dataCollector.AddVertexInstruction("o.data = value;", UniqueId, false);
            dataCollector.AddInstructions("i.data", true, false);

	    [...]
}

But when I try to do it for HD SRP, it doesn't work, because I don't know how to access to "o.data"

Can someone help me with it?
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: SRP HD, precompute data on vertex and use it in surface.

Post by Ricardo Teixeira »

eXiin wrote:I'm trying to do some calculation in the vertex, and then send it to the surface

the shader code is the following:

Code: Select all

struct Input
{
	float data; 
};

void vertexDataFunc( inout appdata_full v, out Input o )
{
	UNITY_INITIALIZE_OUTPUT( Input, o );
        o.data = value
}

void surf( Input i , inout SurfaceOutputStandard o )
{
      i.data
}
Ofc, when I do a node with a surface shader, I do as follow :

Code: Select all


public override string BuildResults(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar)
{
            dataCollector.AddToInput(UniqueId, "float data", true);
            dataCollector.AddVertexInstruction("o.data = value;", UniqueId, false);
            dataCollector.AddInstructions("i.data", true, false);

	    [...]
}

But when I try to do it for HD SRP, it doesn't work, because I don't know how to access to "o.data"

Can someone help me with it?
Hello,

We would be happy to help but unfortunately the developer responsible for the HD implementation is currently away. We'll register your request and contact you as soon as he returns.

Are you trying to build a node or a template as well?

Any additional information you can share would be most welcome.

Thanks!
Sales & 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!
eXiin
Posts: 20
Joined: Sun Sep 02, 2018 4:34 pm

Re: SRP HD, precompute data on vertex and use it in surface.

Post by eXiin »

Thanks.

I'm doing heavy calculations that are used per pixels, but I precompute then per vertex.
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: SRP HD, precompute data on vertex and use it in surface.

Post by Ricardo Teixeira »

eXiin wrote:Thanks.

I'm doing heavy calculations that are used per pixels, but I precompute then per vertex.
But do you intend to build a node or a template?

Regarding the "global function"questions, how do you want to apply it to your shader?
Sales & 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!
eXiin
Posts: 20
Joined: Sun Sep 02, 2018 4:34 pm

Re: SRP HD, precompute data on vertex and use it in surface.

Post by eXiin »

I've tried to build a template, but my original shaders are done with surface shader, but I can't find how to make a Surface shader template.

Maybe i'm missing something?!
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: SRP HD, precompute data on vertex and use it in surface.

Post by Amplify_Borba »

Hello!

Unfortunately, our templates do not support Surface Shaders at this time, only Vertex/Frag Shaders, so you won't be able to perform those operations just yet.

Do rest assured that it's in our plans to add this in the near future, we apologize for any inconvenience caused.
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!
eXiin
Posts: 20
Joined: Sun Sep 02, 2018 4:34 pm

Re: SRP HD, precompute data on vertex and use it in surface.

Post by eXiin »

Can you give me a vague estimate?
One week, One month. One year.
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: SRP HD, precompute data on vertex and use it in surface.

Post by Amplify_Borba »

We apologize for the inconvenience but we can't provide any official ETA as the Template system was developed specifically for Vertex/Frag shaders, so it will likely take a considerable effort to provide support for Surface Shaders.
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!
Post Reply