Fourth Chapter Hello,shaders
This chapter will write the first shaders. Introduces HLSL syntax, FX file format, data structure, and so on. By the end of this chapter, you will have the basics of studying graphic programming in depth.
Your-Shader
The Classic programming example is used when writing the first program in a new programming language hello,world! ", the program output is a line of text" hello,world! ”。 We abide by this time-honored tradition and write the first shader program "hello,shaders! , but this time the output is a fixed color rendering onto an object.
First, start the Nvidia FX composer and create a new project. Open the Assets Panel, right-click on the Materials icon, and select Add Material from New effect menu item. Then select HLSL FX in the Add Effect dialog box and click Next to go to the next step.
Figure 4.1 NVIDIA FX Composer Add Effect dialog box
In a dialog box, select the empty template and name it helloshader.fx (Figure 4.2).
Figure 4.2 NVIDIA FX Composer Select HLSL FX Template dialog box.