Search Unity

Question Using custom node with shader graph node code

Discussion in 'Shader Graph' started by APLETA, May 8, 2020.

  1. APLETA

    APLETA

    Joined:
    Mar 27, 2020
    Posts:
    1
    hey, there! any one to try to use the shader graph node code within custom function node ( hlsl ). No error I got but somehow, using SHADERGRAPH_SAMPLE_SCENE_COLOR does not seem to be return scene color on 2019.3. Just using scene color node is working fine. Is there anything missing?

        
    float3 sum = float3(0,0,0);
    float4 UV = float4(0,0,0,0);
    float val = 1;

    for (int i = 0; i < sampleCount; i++) {
    if ( i < sampleCount/2 ) {
    val = -1;
    }
    UV = float4(screenPosUV + float4(offsets*val, 0, 0));
    float3 sampleColor = SHADERGRAPH_SAMPLE_SCENE_COLOR(UV);
    sum = sampleColor;
    };

    sum = sum/sampleCount;
    result.rgb = sum;
    result.a = 1;
     
    URocks likes this.
  2. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    120
    I'd like this too. Perhaps something needs to be included to give a custom function access to the opaque texture (in URP) besides making it a transparent graph?