CG Programming/unity (CG programming/unity)

Source: Internet
Author: User

Recently in learning Unity3d in the shader programming, can find less Chinese information, so, try to translate the information on the wiki books, in order to facilitate other people like me to get started learners. Because it is the first time to translate technical information, experience is not enough, inevitably error, please pass by the great God criticize correct, together help me and so novice less detours, thank you.

The following translation begins:

(Original: Https://en.wikibooks.org/wiki/Cg_Programming/Unity)

CG programming in the game engine Unity are considerably easier than Cg programming for an OpenGL or Direct3D application. Import of meshes and images (i.e. textures) are supported by a graphical user interface; Mipmaps and normal maps can be computed automatically; The most common vertex attributes and uniforms is predefined; OpenGL and Direct3D states can is set by the very simple commands; etc.

CG programming in the unity engine is much easier than CG programming in OpenGL or Direct3D applications. Grid and picture import is supported by GUI, mipmaps and normal map can be calculated automatically, the most common vertex attributes and specifications are also predefined, OpenGL and Direct3D statements can be set by very simple instructions, and so on.

Preliminaries(Preparation)

A free version of Unity can is downloaded for Windows and MacOS at Unity ' s download page. All of the included tutorials work with the free version. Three points should be noted:

The Unity download page is available for download to the free version of Unity software for Windows and Mac platforms. All the tutorials below can be run with the free version of unity. Please note that three points:

    • First, this part assumes that readers is somewhat familiar with Unity. If This isn't the case, readers should consult the first three sections of Unity's User Guide [1] (Unity Basics, Building Scenes, Asset Import and Creation).

First, readers need to be familiar with unity, otherwise readers should consider learning the first three parts of Unity's user guidance (Unity Foundation, building scenarios, importing and creating resources).

    • Second, Unity doesn ' t distinguish between Cg (the shading Language by Nvidia) and HLSL (the shading language in Direct3D) Since the languages is very similar; Thus, most of the these tutorials also apply to HLSL.

second, Unity for CG ( nvidia HLSL ( direct3d HLSL.

    • Furthermore, CG is documented by NVIDIA's CG Tutorial and Nvidia ' s CG Language specification. However, these descriptions is missing the details specific to Unity. On the other hand, Unity's shader documentation [2] focuses on shaders written in Unity ' s own "surface shader" format, WHI Le the documentation of shaders in CG/HLSL is very limited [3]. Thus, Learning CG programming in Unity without prior knowledge of CG can rather difficult. This wikibook tries to close this gap by providing a introduction to CG programming in Unity without requiring prior know Ledge of Cg.

In addition, while CGlanguage is written inNvidiaof theCgTutorials andNvidiaof theCglanguage instructions, however, these descriptions are not directed atUnityThe special details of the platform. On the other hand,Unityyour own shader documentation, the main concern isUnityThe wording of their own surface shader, which aboutCG/HLSLthe description is very limited. Therefore, if there is noCgLearn the language in advance .Unityin theCgprogramming, is a certain degree of difficulty. This set of tutorials attempts toCglanguage Pre-learning in the case of theUnityin theCgprogramming Introduction to deal with this difficulty.

Tutorials (tutorial)

Note that the tutorials assume so you read them in the order in which they is presented here, i.e. each tutorial would a Ssume that is familiar with the concepts and techniques introduced by previous tutorials. If you were new to Cg or Unity should at least read through the tutorials in the ' Basics ' section. (now is warned!)

Note: This tutorial recommends that you read in the order below, and each lesson assumes that you are familiar with the concepts and techniques introduced in the previous course. If you're new to CG or unity, be sure to read the Basics section of the tutorial.

Basics (Basic)

  • Minimal Shader (about shaders, materials, and game objects)

    The smallest shader (about shaders, materials, and game objects)

  • RGB Cube (about vertex output parameters)

    Red-green-blue box (about vertex output parameters)

  • Debugging of Shaders (about vertex input parameters)

    Debugging of the shader (about vertex input parameters)

  • Shading in World Space (about uniforms)

    Coloring in the world space (about unification)

Transparent surfaces (transparent surface)

  • Cutaways (about discarding fragments and triangle-face culling)
  • Transparency (about blending)
  • Order-independent Transparency (about order-independent blending)
  • Silhouette Enhancement (about transforming normal vectors)

(not to be continued ...) )

CG Programming/unity (CG programming/unity)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.