UnityCG详解回归:unitycg内置详解

     这一篇主要记录一下Nvidia Cg内置的一些数据及函数,方便提前了解和后续查看,从Cg编程书中摘取。最近因为家庭和工作原因实在是精力消耗太大,同时博客写到这个时候已经不需要事无巨细的详细说明了。能坚持学习到这个时候,基本都是一点就通。我后续就主要介绍学习方式,所以能节省一点时间就节省一点时间。如下:

     1.Cg关键字

      C for Graphic:CG内置查询手册

      C for Graphic:CG内置查询手册

       怎么理解这些关键字呢?我来说下我当初学习Cg的方法,首先我们明确知道Cg是nvidia的,所以google一下nvidia cg,出现下面的网页,如下:

       C for Graphic:CG内置查询手册

         打开第一个Cg Toolkit并在右上角点击查询按钮,如下:

          C for Graphic:CG内置查询手册

         以关键字discard为例,因为书中discard写成了dscard,所以特别指出来,搜索会获得如下解释:

         C for Graphic:CG内置查询手册

          using a DISCARD instruction inside your pixels shaders will let the GPU skip any work at the output-merger stage for this pixel

          看得出来就是在frag函数中使用discard跳过像素输出的过程,可以丢弃像素渲染。

         以上就是我们需要了解的学习Cg的方法。

      2.Cg标准函数

      C for Graphic:CG内置查询手册

      C for Graphic:CG内置查询手册 

       C for Graphic:CG内置查询手册

      C for Graphic:CG内置查询手册

        C for Graphic:CG内置查询手册

          C for Graphic:CG内置查询手册

           C for Graphic:CG内置查询手册

            C for Graphic:CG内置查询手册

        C for Graphic:CG内置查询手册

          C for Graphic:CG内置查询手册

             上面的关键字和函数基本涵盖了我们所有能用上的了,以后写Cg shader用的到的修饰关键字和各种计算函数等都能在这里找得到,所以这一篇就是表明了学习手册和方法,看一遍后有个印象。

    

相关文章:

  • 2021-10-04
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-11-06
  • 2021-10-07
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2021-09-18
  • 2021-11-17
  • 2022-12-23
  • 2021-11-17
  • 2021-08-19
  • 2022-03-07
相关资源
相似解决方案