Shadder and Effect - 1.0 Introduction Advanced Coloring Language

zhaozj2021-02-16  46

The first chapter introduces advanced coloring languages

Read this article shows that you have agreed to the statement

Overview

In this chapter, we will describe the high-level shading language, referred to as HLSL, we write the vertices and pixel shaders in the following three chapters. Simply put, the vertex and pixel shader are we write and perform small custom programs on a GPHICS Processing Unit, which replaces a portion of the fixed function line. By replacing a component of the fixed function pipeline with our custom shader program, we have achieved the maximum freedom of graphics. We no longer be limited to predefined "fixed" operations.

In order to write a shader program, we need a language to write them. In DirectX 8.x, the shader is written in a low-level shader assembly language. Fortunately, we no longer need to write shaders with assembly language, because DirectX 9 has supported advanced shader languages, we can use it to write shaders. Writing a shader program above the assembly language can benefit from advanced languages, just like C , it is written in a way surpassed the assembly language, which means:

N Added productivity - with advanced language programming is more easier than using low-level languages. We can focus more time in algorithms, not on coding.

n Improve readability - Advanced language programs easier to read, which means that the advanced language written is more easily debugged and maintained.

n Compiler, often, generate assembly code more efficient than handwritten assembly.

n Using the HLSL compiler, we can compile the code into any available shader version; use assembly language, we may need to transplant the code for the specified version.

HLSL is also similar to C or C syntax, which shortens the curve of learning.

Finally, if the graphics card does not support the vertex shader and the pixel shader, you have to switch to the REF device for the shader example.

Note: The pixel shader can use software to simulate Software Vertex Processing - D3DCREATE_SOFTWARE_VERTEX-Processing.

the goal

n Learn how to write and compile HLSL shader programs

n Learn how to exchange data between applications and shader programs

n gradually familiar with HLSL grammar, type and built-in function

[Declaration]: Introduction to 3D Game Programming With DirectX 9.0 "in this article, it is limited to the translator level, and it is inevitable that there is a mistake in the text. Welcome all netizen criticism; this article is only used for learning exchange and reference usage, not to use In any form of commercial use; if you need to reprint the author's own and translator's consent, maintain the integrity of the article, indicate the author, translator and source, for the consequences of violating the above terms, the translator Do not bear any responsibility. My email address is raymond_king123@hotmade.com, welcome 3D graphics and games, and friends with a certain graphical programming experience to communicate.

转载请注明原文地址:https://www.9cbs.com/read-23186.html

New Post(0)