Skip to content

This is a C# repository based off the Rastertek Tutorial Series posted on www.Rastertek.com, is a literal conversion of the C++ implementations posted on the WebSite, to a .NET C# based implementation using SharpDX 3.0.2, DirectX 11 & WinForms. This is intended for C# developers to use as a reference when trying to learn DirectX 11 3D programmin…

ssshammi/SharpDX-Rastertek-Tutorials

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SharpDX Rastertek Tutorials Series I

Install Link: Install WinForms (x86) Edition Executable of This Repo (Published Updates)

This is a C# repository based off the Rastertek Tutorial Series posted on www.Rastertek.com, is a literal conversion of the C++ implementations posted on the WebSite, to a .NET C# based implementation using SharpDX 3.0.2, DirectX 11 & WinForms. This is intended for C# developers to use as a reference when trying to learn DirectX 11 3D programming, especially when most examples using DirectX are written in C++, so this repo is mimiking ALOT of common C++ DirectX style code writing but in your favorite language C#! So please unless you find an error its not intended for new contributions, its easy to run these tutorials as I have included a Winforms UI for executing every Tutorial example found on www.Rastertek.com. Enjoy!.

** Notes: All Screenshots were taken from this codes execution in C# so what you see is what you will get!. As well as All Performance Test Results in Frames Per Second, were run off my Desktop HP System., that only has DirectX 10.1, and all screen sizes were recorded in 800x600 for both the C++ and C# implementations.

<image src="SharpDXWinForm/Resources/Series%201%20--%20Tutorial%202%20%20-%20%20Creating%20A%20Framework%20And%20Window%20Sm.png?raw="true" width="100%">

Tutorial 2: Creating a Framework and Window

- 278 lines - (C++: 0 FPS C#: 0 FPS)

This Tutorial just displays a blank Black screen for only 1 second, since its only a borderless Windows Form.

Tutorial 3: Initializing DirectX 11.

- 563 lines - (C++: 2255 FPS C#: 2290 FPS)

This Tutorial just displays a blank Gray screen using a Windows Form utilizing DirectX 11 in SharpDX.

Tutorial 4: Buffers, Shaders, and HLSL

- 997 lines - (C++: 1482 FPS C#: 1488 FPS)

This Tutorial loads a green trangle using Vertex Buffers Shaders nad HLSL in SharpDX.

Tutorial 5: Texturing

- 1081 lines - (C++: 1436 FPS C#: 1457 FPS)

This tutorial loads a triangle and applied a Texture on top of it using SharpDX.

Tutorial 6: Diffuse Lighting

- 1203 lines - (C++: 1445 FPS C#: 1493 FPS)

This Tutorial loads a rotating purple trangle that diffuses lighting as it rotates using SharpDX.

Tutorial 7: 3D Model Rendering

- 1241 lines - (C++: 1386 FPS C#: 1400 FPS)

This Tutorial renders a cube and rotates it on the screen using SharpDX.

Tutorial 8: Loading Maya 2011 Models

This Tutorial Loads a Windows Form that allows you to Open an .Obj file nad it saves it out as a .txt file formatted for 3D model importing in SharpDX.

Tutorial 9: Ambient Lighting

- 1248 lines - (C++: 1387 FPS C#: 1400 FPS)

This Tutorial renders a cube and rotates it on the screen with ambiant lighting using SharpDX.

Tutorial 10: Specular Lighting

1281 lines - (C++: 1380 FPS C#: 1394 FPS)

This Tutorial renders a cube and rotates it on the screen with specular lighting using SharpDX.

Tutorial 11: 2D Rendering

- 1208 lines - (C++: 1375 FPS C#: 1395 FPS)

This Tutorial renders simple 2D Texture on the screen using SharpDX.

Tutorial 12: Font Engine

- 1523 lines - (C++: 1480 FPS C#: 1488 FPS)

This Tutorial renders a Font object that really is an amage placed on a square vector facing the screen to display as Text using SharpDX.

Tutorial 13: Direct Input

- 1763 lines - (C++: 1443 FPS C#: 1492 FPS)

This Tutorial shows you how to utilize DirectInput, now depricated, however examples use it, so this is what we are implementing here accepting input from both the keyboard and the mouse using SharpDX. This functionality allows us to use the Arrow Keys and A for UP and Z for down & PagUp for Looking up nad PagDown for looking down, and we use this in most of the Tutorials to follow.

Tutorial 14: Direct Sound

- 1111 lines - (C++: 2267 FPS C#: 2288 FPS)

This Tutorial shows you how to utilize DirectSound, also now depricated, however examples use it, so this is what we are implementing here playing a WAVE file using SharpDX.

Tutorial 15: FPS, CPU Usage, and Timers

- 1875 lines - (C++: 1466 FPS C#: 1466 FPS)

This Tutorial implementation uses the FPS Counter that is present for displaying the Frames Per Second on screen in the Rastertek tutorials, as well as the CPU Usage and the timer class using SharpDX.

Tutorial 16: Frustum Culling

- 2608 lines - (C++: 340 FPS C#: 343 FPS) - Render Count 21

This Tutorial shows how you can keep track of the number of 3D object within your current cameras' view using SharpDX. The above FPS statisics was rendered with 21 objects showing on screen.

Tutorial 17: Multitexturing and Texture Arrays

- 1409 lines - (C++: 975 FPS C#: 962 FPS)

This Tutorial shows how to layer multiple textures on top of each other on a 3D Object using SharpDX.

Tutorial 18: Light Maps

- 1357 lines - (C++: 953 FPS C#: 960 FPS)

This Tutorial uses a Blended Image that looks like a circle with light blending towards the center or the circel, and with that texture, applies the lighting effect through HLSL against a flat square giving the effect of a Sphere using SharpDX.

Tutorial 19: Alpha Mapping

- 1444 lines - (C++: 828 FPS C#: 838 FPS)

This Tutorial uses Alpha blending meaning that two Textures are blended together along a 3D objects verticies using SharpDX.

Tutorial 20: Bump Mapping

- 1691 lines - (C++: 962 FPS C#: 975 FPS)

This Tutorial uses a Texture for placing an edge effect and how lighting reflects against those edges on a 3D rotating cube using SharpDX.

Tutorial 21: Specular Mapping

- 1785 lines - (C++: 840 FPS C#: 852 FPS)

This Tutorial uses a Texture map that following the edges of the cubes smaller squares and the bulging for each small square on a rotating 3D Cube using SharpDX.

Tutorial 22: Render to Texture

- 2391 lines - (C++: 480 FPS C#: 485 FPS)

This Tutorial introduces an important but expensive concept of drawing a rendered 3D object in a small window on the scree using SharpDX.

Tutorial 23: Fog

- 2391 lines - (C++: 480 FPS C#: 485 FPS)

This Tutorial uses an old technique that used to be used to make distant objects dissapear, in this case we have a rotating cube amist a fog cloud and disappearing in the back sides using SharpDX.

Tutorial 24: Clipping Planes

- 1450 lines - (C++: 1424 FPS C#: 1440 FPS)

This Tutorial demonstrates how you omit a certain section of a 3D object from within the cameras view using SharpDX.

Tutorial 25: Texture Translation

- 1488 lines - (C++: 1448 FPS C#: 1455 FPS)

This Tutorial shows how a texture can me moved or translated across an existing 3D object's surface using SharpDX.

Tutorial 26: Transparency

- 1804 lines - (C++: 878 FPS C#: 888 FPS)

This Tutorial shows how a texture can me set to a level of transparency using SharpDX.

Tutorial 27: Reflection (Projective Texturing)

- 1933 lines - (C++: 514 FPS C#: 520 FPS)

This Tutorial shows a 3D Cube is projected and rendered as a reflection against another 3D Object using SharpDX.

Tutorial 28: Screen Fades

- 2219 lines - (C++: 1410 FPS C#: 1410 FPS)

This Tutorial blends a 3D Cube for 4 seconds until its full intensity on the screen using SharpDX.

Tutorial 29: Water

- 2667 lines - (C++: 277 FPS C#: 275 FPS)

This Tutorial creates a small ripple effect of water in a concrete bath also displaying the relflections of nearby objects and the refracting of those reflections in the rippling water using SharpDX.

Tutorial 30: Multiple Point Lights

- 1628 lines - (C++: 1210 FPS C#: 1220 FPS)

This Tutorial shows how multiple different coloured lights are displayed up against a 3D Floor object using SharpDX.

Tutorial 31: 3D Sound

- 1026 lines - (C++: 2256 FPS C#: 2290 FPS)

This Tutorial demonstrates a looping WAV file that is rotated around the listener and this works on Surround sound speakers that is connected to your PC as well using SharpDX and DirectSound.

Tutorial 32: Glass and Ice

- 1888 lines - (C++: 381 FPS C#: 377 FPS)

This Tutorial uses a multitude of techniques to ahcieve this effect where a rotating 3D Cube is placed behind a Green glass pane that perturbs the shape and colour of the Cube with a level of transparency using SharpDX.

Tutorial 33: Fire

- 1511 lines - (C++: 895 FPS C#: 892 FPS)

This Tutorial uses multiple Textures that are translated along a flat rectangle with alpha blending which gives us the effect of moving Fire using SharpDX.

Tutorial 34: Billboarding

- 1567 lines - (C++: 1220 FPS C#: 1220 FPS)

This Tutorial uses an old technique of re positioning a flat rectangle to always face the camera as the camera moves or turns using SharpDX.

Tutorial 35: Depth Buffers

- 1213 lines - (C++: 1350 FPS C#: 1350 FPS)

This Tutorial uses a common technique of slipping up the distance from the camera into sections of depth, of which you can implement different rendering settings for each depth section using SharpDX.

Tutorial 36: Blur

- 2646 lines - (C++: 126 FPS C#: 126 FPS)

This Tutorial creates a Blur effect on a rotating 3D Cube. As you can See with the FramesPerSecond reported above, this is an expensive process that downsamples, or depixelates Textures and redraws them to create a Bluring effect using SharpDX.

Tutorial 37: Instancing

- 1307 lines - (C++: 1316 FPS C#: 1312 FPS)

This Tutorial creates 4 triangles using only the verticies to create one in the vertex buffers using SharpDX.

Tutorial 38: Hardware Tessellation

- 1256 lines - (C++: 745 FPS C#: 715 FPS)

This Tutorial creates one griant trangle that is further broken down into smaller triangles, creating more surface vectors from the one trangle object using SharpDX. This is the only Tutorial that utilizes Software WARP rendering because the machine I am developeing on only supports DirectX feature level 10.1, and Hardware rendered tesselations are only supported with graphics cards supporting DirectX feature level 11.0 for processing to be done on the GPU instead of the CPU.

Tutorial 39: Particle Systems

- 1565 lines - (C++: 335 FPS C#: 435 FPS)

This Tutorial creates particles using alpha blending, textures and ablended colour on square vector objects that are billboarded, created in a rondom position and drop from the top of the screen to the bottom, and then removed from the vertex buffers when below the screen all using SharpDX.

Tutorial 40: Shadow Mapping

- 2205 lines - (C++: 270 FPS C#: 270 FPS)

This Tutorial projects a shodow from a 3D Sphere and a 3D Cube against a square floor object with a directional light setting over the scene like the sun using SharpDX.

Tutorial 41: Multiple Light Shadow Mapping

- 2584 lines - (C++: 124 FPS C#: 124 FPS)

This Tutorial uses multiple directional light sources shining up against a 3D Sphere and 3D Cube using SharpDX.

Tutorial 42: Soft Shadows

- 3994 lines - (C++: 55 FPS C#: 56 FPS)

This Tutorial issistrates how the shadows being cast against a 3D Floor from the Sphere and Cube are sampled at a high resulotion in order to make the shodow shape appear smooth on the floor using SharpDX.

Tutorial 43: Projective Texturing

- 1467 lines - (C++: 1045 FPS C#: 1058 FPS)

This Tutorial projects a texture along a 3D Floor and up against a 3D Cube from a given point and the perspective is also translated in this projection using SharpDX.

Tutorial 44: Projected Light Maps

- 1384 lines - (C++: 960 FPS C#: 964 FPS)

This Tutorial projects light along a 3D Floor and up against a 3D Cube, using the shape of light being projected defined in a black and white texture using SharpDX.

Tutorial 45: Managing Multiple Shaders

- 2518 lines - (C++: 1155 FPS C#: 1155 FPS)

This Tutorial shows how you how to use more then one shader during a single execution using SharpDX.

Tutorial 46: Glow

- 3203 lines - (C++: 104 FPS C#: 105 FPS)

This Tutorial uses a complex set of HLSL Shader operations in order to create the effect of a glowing Border around a string named 'Text' using SharpDX.

Tutorial 47: Picking

- 2883 lines - (C++: 1290 FPS C#: 1293 FPS)

This Tutorial uses DirectInput for allowing you control of the mouse by moving a small bitmap representing the mouse pointer, and when clicked its tested whether or not the mouse pointer was over a 3D Sphere object or not and reports it on screen using SharpDX.

Tutorial 48: Directional Shadow Maps

- 2300 lines - (C++: 300 FPS C#: 300 FPS)

This Tutorial uses two directional lights against a 3D Cube and Sphere against a 3D Floor and projects the shodows against the repective Cube or sphere beside it as the light sets like the sun using SharpDX.

Tutorial 49: Shadow Mapping and Transparency

- 2845 lines - (C++: 110 FPS C#: 130 FPS)

This Tutorial renders a beautiful tree using an array of textures and while the light sets over the tree like the sun, it projects the shodow of the tree against the 3D Fllor that is textured as well, and all leaves are individually projected as part of the trees shadow as well, and very impressive too using SharpDX.

Tutorial 50: Deferred Shading

- 2147 lines - (C++: 240 FPS C#: 240 FPS)

This Tutorial demonstrated a technique that is used when you want more then 8 light sources rendered on any given scene. Eight lights is a DirectX11 limitation that when using the GPU for shading, only 8 light positions can be processed realtime, so this is rendering the lighting and then as an additional step placing that rendering on a texture and placing that texture on a 3D Cube using SharpDX.

Terrain Tutorial 1: Grid and Camera Movement

- 2673 lines - (C++: 687 FPS C#: 692 FPS)

This Tutorial using lines, creates a large flat grid with a camera placed in front of it looking along a perspective view of the flat landscape using SharpDX. This and all following Tutorials all have movement capabilities with arrow keys and az for up/down movement.

Terrain Tutorial 2: Height Maps

- 2796 lines - (C++: 148 FPS C#: 148 FPS)

This Tutorial uses a grayscale texture with white being represented as the peeks of mountains and black as the ground and it lifts the grid based upon its position in that texture creating a wireframe landscape using SharpDX.

Terrain Tutorial 3: Terrain Lighting

- 2907 lines - (C++: 294 FPS C#: 292 FPS)

This Tutorial uses the previously created height based grid nad uses HLSL Shading to calculate the lighting effect against these rased grid vectors on the landscape creating a grayscale landscape using SharpDX.

Terrain Tutorial 4: Terrain Texturing

- 2945 lines - (C++: 293 FPS C#: 291 FPS)

This Tutorial uses a texture for assigned heights like in previous terrain tutorials, and another texture to map up against the raised vectors in the Landscapes grid floor creating a colour landscape using SharpDX.

Terrain Tutorial 5: Quad Tree

- 3684 lines - (C++: 371 FPS C#: 380 FPS)

This Tutorial introduces a conceot of dividing out the entore scene of 3D Objects into subsections in order to do or not do processing on those objects in that quad tree subsection, this subsectioniing is done by spliting the entire landscape into equal smaller parts using SharpDX.

Terrain Tutorial 6: Height Based Movement

- 3831 lines - (C++: 371 FPS C#: 390 FPS)

This Tutorial allows you to freely move around the landscapaae and the height is calculated as you move in order to reposition the camera on that new height in the landscape using SharpDX.

Terrain Tutorial 7: Color Mapped Terrain

- 3268 lines - (C++: 287 FPS C#: 297 FPS)

This Tutorial layers more then one Texture across the 3D Landscape using SharpDX.

Terrain Tutorial 8: Terrain Mini-Maps

- 3894 lines - (C++ 281 FPS C#: 291 FPS)

This Tutorial keeps track of the number of vectors that the camera sees while moving around the 3D Landscape and trims out any objects that are not in the camera view using SharpDX.

Terrain Tutorial 9: Terrain Blending

- 3380 lines - (C++: 796 FPS C#: 860 FPS)

This Tutorial spreads multiple textures across the 3D Landscape in a blended means using SharpDX.

Terrain Tutorial 10: Sky Domes

- 3888 lines - (C++: 270 FPS C#: 280 FPS)

This Tutorial creates an umbrella like dome that hovers in the sky and follows the camera as you move along the 3D landscape, also the background is statically blended from blue on the top to pink at the landscapes level in the horizon using SharpDX.

Terrain Tutorial 11: Bitmap Clouds

- 4400 lines - (C++: 250 FPS C#: 259 FPS)

This Tutorial uses the previous layout and skkydomw and background blending as well as placing and translating bitmap clouds and blending them up against the background using SharpDX.

Terrain Tutorial 12: Perturbed Clouds

- 4373 lines - (C++: 246 FPS C#: 255 FPS)

This Tutorial adds the effect of the bitmap clouds being translated across the sky in a three dimeniosnal manner also makes those coulds "look" three dimentional using SharpDX.

Terrain Tutorial 13: Terrain Detail Mapping

- 4141 lines - (C++: 115 FPS C#: 115 FPS)

This Tutorial creates a small window in the upper left corner of the screen and from calculating differences in distances that you are currently viewing, seperates sections based on that distance for you to render each section differently using SharpDX.

Terrain Tutorial 14: Slope Based Texturing

- 3257 lines - (C++: 267 FPS C#: 270 FPS)

This Tutorial caluclates the slope angle of each vector in the 3D landscape, and based on the angle of that slope, places a certain texture over those verticies that pertain to that particular slope using SharpDX.

Terrain Tutorial 15: Terrain Bump Mapping

- 3367 lines - (C++: 265 FPS C#: 269 FPS)

This Tutorial uses bumpmapping with SharpDX.

Terrain Tutorial 16: Small Body Water

- 5732 lines - (C++: 19 FPS C#: 19 FPS)

This Tutorial is a complex example of using multiple techniques in shading with HLSL. Reflections, Refractions and texture translations are performsed against the waters surface to create the effect of a shiny semi-translucent rippling effect against the shoreline of the water, as well as a specular light representing the suns position against the water using SharpDX.

Terrain Tutorial 17: Terrain Texture Layers

- 2191 lines - (C++: 370 FPS C#: 355 FPS)

This Tutorial uses multiple textures for layering different levels of detail at different distances across the landscape using SharpDX.

Terrain Tutorial 19: Foliage

- 3458 lines - (C++: 119 FPS C#: 120 FPS)

This Tutorial applies bush clusters across the landscape in random places, nillboards these clusters to always face the camera as well as a slight swaying effect representing a slight wind blowing for a realistic random movement effect using SharpDX.

About

This is a C# repository based off the Rastertek Tutorial Series posted on www.Rastertek.com, is a literal conversion of the C++ implementations posted on the WebSite, to a .NET C# based implementation using SharpDX 3.0.2, DirectX 11 & WinForms. This is intended for C# developers to use as a reference when trying to learn DirectX 11 3D programmin…

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 97.2%
  • PostScript 2.8%