SRP HD, precompute data on vertex and use it in surface.
Posted: Tue Sep 04, 2018 12:36 pm
I'm trying to do some calculation in the vertex, and then send it to the surface
the shader code is the following:
Ofc, when I do a node with a surface shader, I do as follow :
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?
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?