Welcome to this 3rd installment of my DirectX Tutorials for C#. This Series has as its main objective to introduce HLSL to you, what it is, what you can do with it and, of course, how to use it. This 3rd Series is written to be a complete hands-on HLSL Tutorial.
DirectX using C# and HLSL Season 3 – Overview
Once again, we’ll start very small, by drawing a simple triangle, and move on to more advanced topics and integrate them into our project. As main goal of this Series, we will be rendering a scene, that is being lit from 3 light sources.
So what’s so difficult about this? You already should have an idea about how to set up 3 lights for a scene, using regular DirectX code. In that case, however, all triangles in your scene would be lit by an amount of light that depends of how the triangle is facing your light sources (the sum of the 3 dot products between the normal of the triangle and the direction between the triangle and the light source).
But you will not see any shadows! This is because DirectX doesn’t know if there are any objects between the triangle and the light sources. So I thought having 3 lights with all of them casting their shadows would be nice goal for an introductionary Series on HLSL. Have a quick look at the screenshots at the bottom of this page and see if you can find the 3 light sources, together with their corresponding shadows.
Don’t be mistaken – this is already quite an advanced topic, and we’ll move quickly through the first sets of pages of this Series, as you already know how to draw triangles. This Series will put its main focus on HLSL.
So, what do I expect you to know already? You can click on each item to be taken to the page where the concept was introduced.
Required (concepts that will be expanded on):
Drawing triangles from a vertex buffer (only vertex buffers, no index buffers)
Using a custom-made vertexformat
Adding textures to triangles
A basic understanding of lighting (dot product)
Optional (code simply copied from previous chapters):
Loading a Mesh from file
Checking device capabilities
Handling device resets
So what are you waiting for? Let’s move on to the first chapter!
- Website design & XNA + DirectX code : Riemer Grootjans -
©2003 - 2011 Riemer Grootjans