Search Unity

CG profile support and intrinsic functions

Discussion in 'Shaders' started by skahlert, Apr 2, 2007.

  1. skahlert

    skahlert

    Joined:
    Apr 2, 2007
    Posts:
    34
    Hi,

    is it possible, that the only supportet CG profile is arbfp1? I'm currently evaluating Unity Pro and I tried to write a simple transparent/reflecting shader. For this, of course, the "reflect()" and "refract()" functions would be very helpful, but they do not work.

    And I guess hdr-fortmats like OpenEXR do not work either?
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Not sure why they don't work; Cg manual says they are supported in all profiles.

    Yes, currently Cg compiles for arbvp1/arbfp1 profiles (that's ARB vertex program and fragment program). The higher profiles are nvidia-hardware specific and would not work on AMD or Intel cards.

    By the way, take a look at water shaders in Pro Standard Assets - they all have the source code.

    Right. Floating point texture formats are not supported at the moment.
     
  3. skahlert

    skahlert

    Joined:
    Apr 2, 2007
    Posts:
    34
    Thanks for your help!

    Well, that problem with the reflect-function was my error. I fiddled to much with the profile property and forgot to set it back to arbfp1.

    It's a pity, though, that there is no support for higher profiles. Most of my nicer shaders really need at least fp20.

    Is there a road-map for shader3.0 support or high-precision textures?
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Well, fp20 is actually lower than arbfp1 (fp20 is like shader model 1.x, while arbfp1 is like shader model 2.0).
     
  5. skahlert

    skahlert

    Joined:
    Apr 2, 2007
    Posts:
    34
    Okay... since I'm coming from the Win/DirectX platform I guessed, that fp20 is the ps_2_0 equivalent. So - if I'm not mistaken (again) - glslf is, what I would need for Pixelshader 3.0, right?
     
  6. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    The profiles in Cg are confusing indeed. Most of NV-specific profile names coincide with NV architecture names (so fp20 is for NV20 hardware, which is GeForce3/4Ti, etc.).

    arbfp1 is a pretty close match to ps_2_0, and arbvp1 is a pretty close match to vs_1_1. Cg's GLSL output (glslf) is currently not supported in Unity, mostly because Cg currently tends to produce buggy GLSL code.

    [rant]GLSL does not exactly correspond to vs_3_0/ps_3_0 in Direct3D; the ideology seems to be "you write GLSL program and then it runs... or it does not... or it kicks into software rendering mode".[/rant]