温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Shader Reference 着色器参考文献

发布时间:2020-07-20 00:36:59 来源:网络 阅读:477 作者:慕婧 栏目:开发技术

本文为个人从Unity文档翻译所得,如要转载请注明源博客地址:http://ymdzz.blog.51cto.com/


Shader Reference 着色器参考文献


Unity中的Shader可以被写成以下三种方式:

1 surface shaders

2 vertex and fragment shaders

3 fixed function shaders


Shader指南(Shader tutorial)可以指引你选择你所需的Shader类型

不管你选择的是哪一种Shader,Shader的代码的核心部分都是被一种叫做ShaderLab的语言来编写。


ShaderLab语言用于组织Shader的结构,就像这样:

Shader "MyShader" {

    Properties {

        _MyTexture ("My Texture", 2D) = "white" { }

        // other properties like colors or vectors go here as well

    }

    SubShader {

        // here goes the 'meat' of your

        // - surface shader or

        // - vertex and program shader or

        // - fixed function shader

    }

    SubShader {

        // here goes a simpler version of the SubShader

        // above than can run on older graphics cards

    }

}


推荐从阅读基本的ShaderLab语法开始来学习Shader,接着阅读关于surface shader或者vertex and fragment shaders的相关资料。而fixed function shaders是仅仅用ShaderLab来编写的,可以在ShaderLab的参考文献中查阅更多的相关信息。


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI