Search Unity

what is the difference between half and float???

Discussion in 'Scripting' started by JohnSonLi, Sep 5, 2012.

  1. JohnSonLi

    JohnSonLi

    Joined:
    Apr 15, 2012
    Posts:
    586
  2. fano_linux

    fano_linux

    Joined:
    Jan 1, 2012
    Posts:
    909
  3. Marrrk

    Marrrk

    Joined:
    Mar 21, 2011
    Posts:
    1,032
    It might be Unity related, as you can use hald and float inside the shaders.

    From the CG language ref:

    The float type is as close as possible to the IEEE single precision (32-bit) floating point format. Profiles must support the float data type.
    The half type is lower-precision IEEE-like floating point. Profiles must support the half type, but may choose to implement it with the same precision as the float type.
     
  4. JohnSonLi

    JohnSonLi

    Joined:
    Apr 15, 2012
    Posts:
    586
    wow,clear answers ,thanks
     
  5. vagos21

    vagos21

    Joined:
    Sep 3, 2012
    Posts:
    18
    halves (2byte floating point numbers) are famous in the gaming engines world used in shaders like marrrk said, and you can sometimes spot them in 3D game files like NFS Shift, they make the files smaller and are a direct feed to the shader inputs :)