# BBC BASIC Programmers' Reference

### Site Tools

tutorial_204_20-_203d_20spaces

# Differences

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

 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) Both sides previous revision Previous revision 2018/04/17 19:11 tbest3112 Added syntax highlighting to for HLSL (using glsl as close enough)2018/04/13 22:36 richardrussell Added syntax highlighting2018/03/31 13:19 external edit 2018/04/17 19:11 tbest3112 Added syntax highlighting to for HLSL (using glsl as close enough)2018/04/13 22:36 richardrussell Added syntax highlighting2018/03/31 13:19 external edit 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:\\ \\ + // // // Vertex Shader // Vertex Shader Line 97: Line 98: return output; return output; } } + ​ \\ \\ ===== Setting up the Matrices ===== ===== Setting up the Matrices =====