Search Unity

Default RenderPipeline - Reflection Probes > biquadratic instead of bilinear sampling

Discussion in 'Shaders' started by Quatum1000, Jan 27, 2021.

  1. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Hi everyone,

    I'd like to have a real-time reflection prob attached to a cam. I need a small 64/128pix cube reflection only.
    But this caused some wired artifacts on moving because the reflection probe is sampled bi-linear (I think..)

    Some time ago I created another approach on biquadratic sampling. Inigo Quilez cretaed a demo at shadertoys from it. https://www.shadertoy.com/view/WtyXRy. I like to use my approach for a reflection probe,

    Code (CSharp):
    1.  
    2. //Roger/iq style
    3.    p = p*texSize;
    4.    vec2 i = floor(p);
    5.    vec2 f = fract(p);
    6.    p = i + f*0.5;
    7.    p = p/texSize;
    8.     //f = f*f*(3.0-2.0*f); // optional for extra sweet
    9.    float w = 0.5/texSize;
    10.    return mix(mix(texture2(sam,p+vec2(0,0)),
    11.                    texture2(sam,p+vec2(w,0)),f.x),
    12.                mix(texture2(sam,p+vec2(0,w)),
    13.                    texture2(sam,p+vec2(w,w)),f.x), f.y);
    14.  
    I tried to find the shader part it's rendering the reflection probes. But didn't find anything related to reflection probes using texCube or texCubeBias, texCubegrade or similar.

    Looked also at unity_SpecCube0_HDR, unity_SpecCube1_HDR, unity_SpecCube0_ProbePosition, but these variables are never filled with any texCube_xxx sampler pixels.

    Does anyone know where to find the code to access a reflection probe cube by tex sampler?
    Thanks a lot..
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
  3. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    889
    Thank you very much bgolus and being a part of the unity forum and your great acknowledge.
     
    UnityMaru likes this.