User Tools

Site Tools


tutorial_204_20-_203d_20spaces

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial_204_20-_203d_20spaces [2018/04/13 22:36]
richardrussell Added syntax highlighting
tutorial_204_20-_203d_20spaces [2018/04/17 19:11] (current)
tbest3112 Added syntax highlighting to for HLSL (using glsl as close enough)
Line 85: Line 85:
 ===== Modifying the Vertex Shader ===== ===== Modifying the Vertex Shader =====
 \\  In our vertex shader from the previous tutorial, we take the input vertex position and output the same position without any modification. We can do this because the input vertex position is already defined in projection space. Now, because the input vertex position is defined in object space, we must transform it before outputting from the vertex shader. We do this with three steps: transform from object to world space, transform from world to view space, and transform from view to projection space. A vector is transformed by multiplying the vector by a matrix. In HLSL, this is done using the mul() intrinsic function. Our variable declaration and new vertex shader are shown below:\\ \\  \\  In our vertex shader from the previous tutorial, we take the input vertex position and output the same position without any modification. We can do this because the input vertex position is already defined in projection space. Now, because the input vertex position is defined in object space, we must transform it before outputting from the vertex shader. We do this with three steps: transform from object to world space, transform from world to view space, and transform from view to projection space. A vector is transformed by multiplying the vector by a matrix. In HLSL, this is done using the mul() intrinsic function. Our variable declaration and new vertex shader are shown below:\\ \\ 
 +<code glsl>
       //       //
       // Vertex Shader       // Vertex Shader
Line 97: Line 98:
           return output;           return output;
       }       }
 +</​code>​
 \\  \\ 
 ===== Setting up the Matrices ===== ===== Setting up the Matrices =====
tutorial_204_20-_203d_20spaces.txt ยท Last modified: 2018/04/17 19:11 by tbest3112