I have Direct X SDK.So, I must link it to visual studio and start learning ,right?
Yes. And if you start with the tutorial in that web page it starts with a tutorial to how to link it properly. Also I forgot to mention but Frank Luna's books are great for Direct X reference, it tells you most of the stuff that you need to know with detail. http://www.d3dcoder.net/ this is his web page and you can buy the book depending on the version of Direct X you want to learn. I am assuming you are going for Direct X 11.
1- I haven't tried Code::Blocks so I can't say anything about that but I am using Visual Studio and I am pretty happy with it. Also you might need Windows SDK or Direct X sdk. Windows SDK is newer but you need Windows 7 or 8.
2- If you really want to learn what is going on with Direct X I recommend you to create your own small applications. Since most of the game engines hide the complexities from the user it is hard to learn really what is going on by learning a game engine.
Now you can use it for all the vertex shaders that include that header. Only thing you need to be careful about is you have to make sure that you don't change register 0 between shaders that need those global variables.
So if you are trying to create a global buffer you can use that trick. But if those variables are shader specific I think it is better idea to have different constant buffers for different shaders. It is much more manageable that way. So every material can know which buffers they are responsible from.
One side not though as I wrote in the comment above constant buffers are automatically become multiple of 16 bytes. So lets say you put 1 float2 and 1 float it occupies float4 space. So when you are setting your bytewidth it needs to be multiple of 16 bytes otherwise you will get an error.
Your vector should be like [ 1.0 ] [ 2.0 ] [ 0.0 ] [ 1.0 ] since you are using row major and your vector should be on the left side of your matrix when you are multiplying. (V x M).
- if I want to extract a vector from the matrix, that gives my either X, Y or Z orientation (without translation), I could use the 1st three components of row 1, 2 or 3
Yes but you should take scaling into consideration so you need to normalize each axis.
=> the X component of the vector is only affected by the 1st row of the matrix
=> the Y component of the vector is only affected by the 2nd row of the matrix
=> the Z component of the vector is only affected by the 3rd row of the matrix
Your result vector's x component is effected by first column of the matrix, y is effected by second column and so on. And as a result you get another row vector. I suggest you to read some tutorials about matrices if you are having trouble with multiplication before starting to get deeper since you will need a good understanding for the basics.
@ekba89 Do I need to reset the render states every draw cycle?
You might have different render states for different models. So you have to change them depending on what you are trying to do. But for the normal 3D rendering default settings should suffice. If all your models are using default render states you just need to set them once in the beginning of your application. But as I said SpriteBatch changes it before it does its 2D rendering. So if you are using SpriteBatch and some 3D models you need to reset your render states every time before you render your 3D models.
It looks like you have problem with your depth stencil state. If you are using SpriteFonts they might change your render states so you need to reset them before 3D rendering. Try to put the code below just before your rendering.
According to MSDN lastX and lastY value are relative to the last position. So they are not screen coordinates and they become 0 if you dont move the mouse. Also as I said as soon as I stop take of my finger from the left mouse button values become 0 again. My problem is they are not getting updated when mouse button is clicked.
I created a simple input system and it works mostly. Right now I have a camera that is moved with the mouse when left button is clicked. The problem I am having is when mouse button is clicked even when I stop moving the mouse lastX or lastY doesnt become 0 and camera keeps moving until I stop clicking the button. Here is my code
It is most likely because of your texture size is small for the skybox you are using.You can resize your skybox to lets say half of its current size with scale matrix and see if it looks good. And if it looks good that means you need double of the size of your current texture. By using different scale matrices you can find how big texture you need.
I have managed to solve that issue and make it work but it is not as good as I hoped there are artifacts when I try to move camera around the cloud . And now I'm trying to render real volumetric clouds so I can rotate around it and it look better. So I started this tutorial series. But he uses a loop with 512 iterations in his shader for sampling volume and when I try to do the same thing with directx 11 it shows a white screen for a while and i get error. Then I tried his code with my laptop (because xna is installed in it) which has a lot worse specs than my pc and it worked with 3 fps. So obviously I'm doing something wrong but before trying to solve what is wrong with my code I want to know if it is possible to get good framerates in games using volumetric rendering techniques since I get 3 fps with just rendering the volume with decent computer. If not are there any techniques that you can suggest for me for rendering clouds.
Hi I'm trying to create volumetric clouds using this tutorial. (And here is the original slides). I don't have any problems to the part where I need to distort the cloud map.Currently I'm using only one sphere just to test it. Here is the code where I do distortion.
As you can see in the first screenshot billboard and sphere is fine (It was the easy part anyways ). And other two screenshots are the results with different camera positions.
And lastly are there any other good looking volumetric cloud tutorials you can suggest. I searched a little but most of the tutorials are very old so I am curious if there are any newer techniques for volumetric clouds. Thanks.