Search Unity

cannot resolve function call unambiguously

Discussion in 'Shaders' started by Frostbite23, Jun 18, 2014.

  1. Frostbite23

    Frostbite23

    Joined:
    Mar 8, 2013
    Posts:
    458
    Hi guys, I'm creating a radial blur effect for unity and it looks like unity is not behaving correctly with me, I've ported this radial blur effect
    http://www.gamerendering.com/2008/12/20/radial-blur-filter/
    but unity then spits this out
    "GLSL vertex shader: 370: ERROR: 'tex2Dlod' : cannot resolve function call unambiguously (check parameter types) at line 86"
    heres my function and variables
    Code (JavaScript):
    1. float4 RadialBlur(v2f_img i) : COLOR
    2.         {
    3.             float2 dir = 0.5 - i.uv;
    4.             float dist = sqrt(dir.x*dir.x + dir.y*dir.y);
    5.             dir = dir/dist;
    6.             float4 tex = tex2D(_Depth, i.uv);
    7.             float4 sum = float4(0.0, 0.0, 0.0, 0.0);
    8.             float2 uv = i.uv + dir;
    9.             for (int j = 0; j < 10; j++)
    10.             {
    11.                 sum += tex2Dlod(tex, float4(uv * samples[j] * sampleDist, 0 , 0));
    12.             }
    13.          
    14.             sum *= 1.0/11.0;
    15.             float t = dist * sampleStrength;
    16.             t = saturate ( t );
    17.             return sum;
    18.         }
    varibles
    Code (JavaScript):
    1. static const float samples[10] = {-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08};
    2.         const float sampleDist = 1.0;
    3.         const float sampleStrength = 2.2;
    im not sending the entire code because the rest of the code is fine without the function, but specifically the error is in this line
    Code (JavaScript):
    1. sum += tex2Dlod(tex, float4(uv * samples[j] * sampleDist, 0 , 0));
     
  2. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
  3. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    go check your PM, i pasted the radial blur code in.