Skip to main content
added 1002 characters in body
Source Link
wcw
  • 11
  • 2

you can useI'm working on make custom shader working on lwrp 4.10.0, and my way is custom node, here is sample code:

[Title("Custom", "TerNode")]
public class TerNode : CodeFunctionNode
{
    public TerNode()
    {
        name = "TerNode";
    }

    protected override MethodInfo GetFunctionToConvert()
    {
        return GetType().GetMethod("MyCustomFunction", BindingFlags.Static | BindingFlags.NonPublic);
    }

    static string MyCustomFunction(
         [Slot(0, Binding.MeshUV0)] Vector2 uv,
         [Slot(1, Binding.None)] Texture2DArray _SplatTexArray,
         [Slot(2, Binding.None)] SamplerState _SplatIdSampler,
         [Slot(3, Binding.None)] out ColorRGB Out)
    {
        Out = new ColorRGB();
        return "{ ... }"; // Shader code here
    }
}

`

Also i tried to write a lwrp-compatiable shader directly, i used

Texture2DArray _SplatTexArray; SamplerState _SamplerState_Linear_Repeat_sampler_splat;

to replace UNITY_SAMPLE_TEX2DARRAY(_SplatTexArray), but finally i gave up this method because i can not make it lighting.

you can use

Texture2DArray _SplatTexArray; SamplerState _SamplerState_Linear_Repeat_sampler_splat;

to replace UNITY_SAMPLE_TEX2DARRAY(_SplatTexArray)

I'm working on make custom shader working on lwrp 4.10.0, and my way is custom node, here is sample code:

[Title("Custom", "TerNode")]
public class TerNode : CodeFunctionNode
{
    public TerNode()
    {
        name = "TerNode";
    }

    protected override MethodInfo GetFunctionToConvert()
    {
        return GetType().GetMethod("MyCustomFunction", BindingFlags.Static | BindingFlags.NonPublic);
    }

    static string MyCustomFunction(
         [Slot(0, Binding.MeshUV0)] Vector2 uv,
         [Slot(1, Binding.None)] Texture2DArray _SplatTexArray,
         [Slot(2, Binding.None)] SamplerState _SplatIdSampler,
         [Slot(3, Binding.None)] out ColorRGB Out)
    {
        Out = new ColorRGB();
        return "{ ... }"; // Shader code here
    }
}

`

Also i tried to write a lwrp-compatiable shader directly, i used

Texture2DArray _SplatTexArray; SamplerState _SamplerState_Linear_Repeat_sampler_splat;

to replace UNITY_SAMPLE_TEX2DARRAY(_SplatTexArray), but finally i gave up this method because i can not make it lighting.

Source Link
wcw
  • 11
  • 2

you can use

Texture2DArray _SplatTexArray; SamplerState _SamplerState_Linear_Repeat_sampler_splat;

to replace UNITY_SAMPLE_TEX2DARRAY(_SplatTexArray)