Search Unity

How to use dFdx() in SM3.0 GLSL?

Discussion in 'Shaders' started by dreamerflyer, Apr 4, 2012.

  1. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    Hi,i test the cg shader,below is some code ,but get error:


    float2 duv = (sUV.x * dFdx (IN.uv.xy)) + (sUV.y * dFdy(IN.uv.xy));


    Shader error in 'Custom/godRay': GLSL vertex shader: ERROR: 0:341: 'dFdx' : no matching overloaded function found at line 20

    how to resolved it?
     
  2. Martin-Kraus

    Martin-Kraus

    Joined:
    Feb 18, 2011
    Posts:
    617
  3. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927

    this is my code ,translate it from nvidia/s godRay.but not match the effect with the source code.
     
  4. Martin-Kraus

    Martin-Kraus

    Joined:
    Feb 18, 2011
    Posts:
    617
    Did you solve the problem with ddx and ddy?

    Maybe you should start another thread about the problem of porting Nvidias god ray effect to unity?
     
  5. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    :(
     

    Attached Files:

  6. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    EDIT: Nevermind :)
     
    Last edited: Apr 7, 2012
  7. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    Hi ,Aubergine,what's wrong with my codes?
     
  8. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,880
    I posted this effect somewhere in the forums but now i decided to pull it off and put in a commercial pack instead.
    Sorry.
     
  9. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    then ,will other people help me?I want to port the NDIVIA 'S SHADERs to u3d,.
     
  10. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    ;) $GODRAY.png the codes almost as the NVIDIA'S .go on port other shader~