Sorry, the Forum is closed :(

Unfortunately, the forum is now closed.

Please read the following post for further details.

We apologize for the inconvenience.
The SharpDX team.
Welcome, Guest
Username: Password: Remember me

TOPIC: Rastertek Tutorials in SharpDX

Rastertek Tutorials in SharpDX 1 year 10 months ago #52


  • Posts:39
  • PavelB's Avatar
  • PavelB
  • Junior Boarder
  • OFFLINE
For sometime already, mostly for self-education for DirectX and SharpDX, I implement tutorials are written on Rastertek site. I will add those tutorials here. I will do it when I have time. If someone else want to help me, it would be nice.
Last Edit: 1 year 10 months ago by xoofx.
The administrator has disabled public write access.

Re: Rastertek Tutorials in SharpDX 1 year 10 months ago #59


  • Posts:39
  • PavelB's Avatar
  • PavelB
  • Junior Boarder
  • OFFLINE
Tutorial 2: Creating a Framework and Window
Before starting to code with DirectX 11 I recommend building a simple code framework. This framework will handle the basic windows functionality and provide an easy way to expand the code in an organized and readable manner. As the intention of these tutorials is just to try different features of DirectX 11 we will purposely keep the framework as thin as possible....

Tutorial 3: Initializing DirectX 11
This tutorial will be the first introduction to working with DirectX 11. We will address how to initialize and shut down Direct3D as well as how to render to a window.

Tutorial 4: Buffers, Shaders, and HLSL
This tutorial will be the introduction to writing vertex and pixel shaders in DirectX 11. It will also be the introduction to using vertex and index buffers in DirectX 11. These are the most fundamental concepts that you need to understand and utilize to render 3D graphics.

Tutorial 5: Texturing
This tutorial will explain how to use texturing in DirectX 11. Texturing allows us to add photorealism to our scenes by applying photographs and other images onto polygon faces.

Tutorial 6: Diffuse Lighting
In this tutorial I will cover how to light 3D objects using diffuse lighting and DirectX 11. We will start with the code from the previous tutorial and modify it.

The type of diffuse lighting we will be implementing is called directional lighting. Directional lighting is similar to how the Sun illuminates the Earth. It is a light source that is a great distance away and based on the direction it is sending light you can determine the amount of light on any object. However unlike ambient lighting (another lighting model we will cover soon) it will not light up surfaces it does not directly touch.

I picked directional lighting to start with because it is very easy to debug visually. Also since it only requires a direction the formula is simpler than the other types of diffuse lighting such as spot lights and point lights.

The implementation of diffuse lighting in DirectX 11 is done with both vertex and pixel shaders. Diffuse lighting requires just the direction and a normal vector for any polygons that we want to light. The direction is a single vector that you define, and you can calculate the normal for any polygon by using the three vertices that compose the polygon. In this tutorial we will also implement the color of the diffuse light in the lighting equation.

Tutorial 7: 3D Model Rendering
This tutorial will cover how to render 3D models in DirectX 11 using HLSL. The code in this tutorial is based on the code from the diffuse lighting tutorial.

We have already been rendering 3D models in the previous tutorials, however they were composed of a single triangle and were fairly uninteresting. Now that the basics have been covered we'll move forward to render a more complex object. In this case the object will be a cube. Before we get into how to render more complex models we will first talk about model formats.

There are many tools available that allow users to create 3D models. Maya and 3D Studio Max are two of the more popular 3D modeling programs. There are also many other tools with less features but still can do the basics for what we need.

Tutorial 8: Loading Maya 2011 Models
This tutorial will cover how to import static 3D models from Maya 2011. Note that this tutorial will be focused on Maya but it also applies to pretty much any other 3D modeling software package with some slight changes.

In the previous tutorials we have already created our own model format and rendered 3D models using that format. The goal now is to convert Maya 2011 models into our format and render them. I won't go into how to model 3D objects in Maya as there are hundreds of tutorials on the net already dedicated to that, we will instead start at the point where you have a textured and triangulated 3D model ready for export.

For the Maya export format we will use the .OBJ format as it is easily readable and good for beginners to start with.

Tutorial 9: Ambient Lighting
This tutorial will be an introduction to using ambient lighting in DirectX 11 with HLSL.

I will explain ambient lighting using an example. Imagine you are in a room and the only light source is sunlight which is coming in from a window. The sunlight doesn't directly point at all the surfaces in the room but everything in the room is illuminated to a certain extent due to bouncing light particles. This lighting effect on the surfaces that the sun isn't directly pointing at is called ambient lighting.

Now to simulate ambient lighting we use a very simple equation. We just set each pixel to be the value of the ambient light at the start of the pixel shader. From that point forward all other operations just add their value to the ambient color. This way we ensure everything is at a minimum using the ambient color value.

Ambient lighting also adds far more realism to a 3D scene.

Tutorial 10: Specular Lighting
This tutorial will be an introduction to using specular lighting in DirectX 11 with HLSL. The code in this tutorial builds on the code from the previous tutorial.

Specular lighting is the use of bright spot highlights to give visual clues for light source locations.

Tutorial 11: 2D Rendering
Being able to render 2D images to the screen is very useful. For example most user interfaces, sprite systems, and text engines are made up of 2D images. DirectX 11 allows you to render 2D images by mapping them to polygons and then rendering using an orthographic projection matrix.

Tutorial 12: Font Engine
Writing text onto the screen is a pretty important function of any application. Rendering text in DirectX 11 requires that you first know how to render 2D images. As we covered that topic in the previous tutorial this tutorial will just build on that knowledge.
The first thing you are going to need is your own font image.

Tutorial 2-12

File Attachment:

File Name: Tutorial2-12.7z
File Size: 798 KB
Last Edit: 1 year 10 months ago by PavelB.
The administrator has disabled public write access.

Re: Rastertek Tutorials in SharpDX 1 year 10 months ago #60


  • Posts:39
  • PavelB's Avatar
  • PavelB
  • Junior Boarder
  • OFFLINE
Tutorial 13: Direct Input
This tutorial will cover using Direct Input in DirectX 11. The code in this tutorial will be based on the previous font tutorial code.

File Attachment:

File Name: Tutorial13.7z
File Size: 782 KB


It is another Tutorial for DirectInput. I have some problems with the implementation of this tutorial, which I cannot resolve:
1. In Input class I have function called ReadKeyboard. When I am in debug mode and hit breakpoint, after I loose keyboard and I cannot require it back, unless I restart application again. However, debugging is working OK in C++ original tutorial.
2. When I move fast the mouse around sometime I can see that previous coordinates are not deleted completly and new coordinates overlap old ones.

Does anyone know how to resolve those problems?
Last Edit: 1 year 10 months ago by xoofx.
The administrator has disabled public write access.

Re: Rastertek Tutorials in SharpDX 1 year 10 months ago #63


  • Posts:39
  • PavelB's Avatar
  • PavelB
  • Junior Boarder
  • OFFLINE
Tutorial 14: Direct Sound
This tutorial will cover the basics of using Direct Sound in DirectX 11 as well as how to load and play .wav audio files. This tutorial is based on the code in the previous DirectX 11 tutorials.

File Attachment:

File Name: Tutorial14.7z
File Size: 1,010 KB
Last Edit: 1 year 10 months ago by xoofx.
The administrator has disabled public write access.

Re: Rastertek Tutorials in SharpDX 1 year 10 months ago #66


  • Posts:39
  • PavelB's Avatar
  • PavelB
  • Junior Boarder
  • OFFLINE
Tutorial 15: FPS, CPU Usage, and Timers
This tutorial will introduce three new classes that will encapsulate the functionality of a frames per second counter, a cpu usage counter, and a high precision timer. The code in this tutorial is based on the code from the Font Engine tutorial.

File Attachment:

File Name: Tutorial15.7z
File Size: 1,010 KB
Last Edit: 1 year 10 months ago by xoofx.
The administrator has disabled public write access.

Tutorials running on Feature level 10 graphic card? 1 year 10 months ago #73


  • Posts:6
  • Mathieu's Avatar
  • Mathieu
  • Fresh Boarder
  • OFFLINE
Dear PavelB,
Thank you for porting Rastertek samples!
I have tried sample4 and some others, and I have the same issue : Window is black, nothing is drawn.
I have checked the output window, and it does not report anything bad. No exception is thrown, and the shaders seem to be compiled with success.
I am running your samples on a "old" NVIDIA Quadro FX 2700M and Windows 7. This graphic card in only Feature level 10.0. I think it is the reason, I'm not sure.
I have tried to change Device initialization by passing Device.GetSupportedFeatureLevel() without success.
Any idea?
Mathieu
The administrator has disabled public write access.

Re: Rastertek Tutorials in SharpDX 1 year 10 months ago #74


  • Posts:26
  • s33m3's Avatar
  • s33m3
  • Junior Boarder
  • OFFLINE
I think I found the problem with the "It draw nothing".

Its link to the parsing of the Model files.
By default english computer use . as decimal separator, but a lof of latin language use the , as coma separator and . as thousand.

It makes the parsing of the file outputting wrong result. That's a common mistake not forcing the layout culture when reading file.

To resolve the problem simply add :

Thread.CurrentThread.CurrentCulture = new CultureInfo("en");

Inside program.cs, in the Main function.

Regards.
Last Edit: 1 year 10 months ago by s33m3.
The administrator has disabled public write access.

Re: Rastertek Tutorials in SharpDX 1 year 10 months ago #75


  • Posts:6
  • Mathieu's Avatar
  • Mathieu
  • Fresh Boarder
  • OFFLINE
I was already in "US" regional settings (indeed, as you say, it is a very common problem)
It does not solve the problem, sorry to say that!
In case of, I tried to force the culture as you proposed. Not better.
Very strange!
As I said, there is no warning or error in debug output window, which is even more strange. And this even if I set DeviceCreationFlags.Debug to the device creation. Also there is no exception thrown.
Please tell me if I can check anything else!
Mathieu
The administrator has disabled public write access.

Re: Rastertek Tutorials in SharpDX 1 year 10 months ago #76


  • Posts:26
  • s33m3's Avatar
  • s33m3
  • Junior Boarder
  • OFFLINE
Other possibilities :
- Set the Device creation falg to DeviceCreationFlags.Debug, and "Enable unmanaged code debugging" fro project Debug properties. Check again in output windows of you don't have any DX error/Warning.

- Start PIX, do a frame capture of the application, and check what's going on.

Can't help more, did test on various computers, except from the Region settings problems, other things are working perfectly.
The administrator has disabled public write access.

Re: Rastertek Tutorials in SharpDX 1 year 10 months ago #77


  • Posts:5
  • Sylvain's Avatar
  • Sylvain
  • Fresh Boarder
  • OFFLINE
hi,

I can't find your code/tutorial.

When I click on your link I go on the official rastertek C++ tut for the number 2 to 11.

thanks
The administrator has disabled public write access.
Time to create page: 0.513 seconds