Page 1 of 1

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

PostPosted: Tue Sep 04, 2018 12:36 pm
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?

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

PostPosted: Tue Sep 04, 2018 2:58 pm
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!

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

PostPosted: Wed Sep 05, 2018 4:34 pm
by eXiin
Thanks.

I'm doing heavy calculations that are used per pixels, but I precompute then per vertex.

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

PostPosted: Wed Sep 05, 2018 5:07 pm
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?

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

PostPosted: Sun Oct 14, 2018 1:56 pm
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?!

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

PostPosted: Mon Oct 15, 2018 1:52 pm
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.

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

PostPosted: Tue Oct 16, 2018 2:49 pm
by eXiin
Can you give me a vague estimate?
One week, One month. One year.

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

PostPosted: Wed Oct 17, 2018 8:38 am
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.