Jump to content

  • Log In with Google      Sign In   
  • Create Account

Jason Z

Member Since 04 Feb 2004
Offline Last Active Sep 03 2016 05:28 AM

#5214606 NVIDIA NSight vs Visual Studio 2013 Graphics Debugger?

Posted by on 04 March 2015 - 07:48 PM

Why don't you just give it a try?  Even if we tell you it is faster / better, wouldn't you want to try it out for yourself???

#5211773 Converting between coordinate systems

Posted by on 19 February 2015 - 05:08 PM


Hummm... turns out the documentation I had was wrong, and both coordinate systems were already left-handed, with same axes and everything. My problems was with the aspect ratio. If you ever do viewPort.Width/viewPort.Height to get the aspect ratio, you're doing it wrong! Int/Int gives an int.

Better to do:



Even better is to use C++ style casts:

static_cast<float>(viewport.Width) / static_cast<float>(viewport.Height)

#5211772 Graphics Programming book?

Posted by on 19 February 2015 - 05:05 PM

I won't give my opinion (since it is obviously biased toward Practical Rendering & Computation), but if you are interested in checking out the source code that goes along with it, then go here!

#5211077 compute shader resource slot allocation across multiple files

Posted by on 16 February 2015 - 05:50 PM

The slots that you consume in a shader are independent of one another.  What matters more is what you have bound to the pipeline at those slots.  So you can change the ordering from one shader to the next, but then you have to rebind the SRVs to match the desired inputs.


In general, if you don't have to change the location it is better to make as few changes between dispatch calls as possible.

#5210689 Weird behavior when getting data from structured buffer

Posted by on 14 February 2015 - 10:53 AM

Just as a first hunch, have you initialized your entire buffer with a known value at creation time?  Sometimes if your structure count gets out of whack you can easily index uninitialized parts of the buffer...

#5207952 Sending World, View and Projection Matrices To D3D9 Vertex Shader

Posted by on 31 January 2015 - 04:14 PM

If you're looking for the function call SetMatrixWithEitherD3D9OrD3D11(...) there ain't no such thing. They are different APIs and they have different methods to accomplish things.

If you choose D3D9, use D3D9 methods. If you choose D3D11, use D3D11 methods.

This, in particular, is the answer to your question.  The point is that you would need to build a small wrapper layer to abstract this particular feature away in order to communize the two APIs. 

#5207887 Ways to render a massive amount of sprites.

Posted by on 31 January 2015 - 12:09 PM

Another potential method is to store the sprite info in a buffer resources, and then use an SRV in the vertex shader to grab the data out of it.  The interesting thing that you can do, is to create the vertices completely in the vertex shader, with no vertex buffers required at all!  The general idea is to use your draw call to specify how many vertices are generated, and then use the SV_VertexID semantic value to grab the appropriate data from the SRV.  You would use 4 vertex shader invocations for each of the quads, and the method is relatively efficient.  If you check out the particle storm demo from Hieroglyph 3, there is an example of creating vertices without vertex buffers (although I expand the vertices in the GS as mentioned above).


Regarding the use of instancing, you are probably not going to see an improvement for the use of 4 vertices as your instanced geometry.  In general, unless you are using geometry with 100 or more vertices you won't see much improvement (at least that is general advice, but your particular situation may or may not reflect the general rule of thumb...).

#5207883 Sending World, View and Projection Matrices To D3D9 Vertex Shader

Posted by on 31 January 2015 - 11:58 AM

There is no such thing as a constant buffer in D3D9 - instead you set individual registers.  Have you taken a look at some starter D3D9 tutorials yet?

#5207881 "bind slots vs. registers" concern

Posted by on 31 January 2015 - 11:55 AM

I have always found that compiling the shader with FXC.exe is a useful learning tool.  This command line tool requires you to tell it the file and the function you are compiling, along with the shader type and target model.  You can create an html output file, which gives you lots of information about the shader, its input resources, and the shader's input and output signatures.


That will tell you about the shader, but you can also programmatically access the same data through the reflection interfaces.  There is examples in my engine (linked in my signature below) about how to use the reflection interface, so feel free to take a look and borrow code as needed.

#5206287 Question about local axes conventions

Posted by on 23 January 2015 - 05:57 PM

I would recommend just mimicking whatever you use for the graphics system.  In general, I think the method that you described is common for OpenGL based rendering, while the z-axis is flipped typically for DirectX based rendering.


However, the only important thing is that the sound systems match with the graphical systems.

#5204921 Help, rolling my own D3DX11CreateShaderResourceViewFromFile/Memory

Posted by on 17 January 2015 - 08:49 AM

Just another helpful link to understand gamma / linear light spaces: The Importance of Being Linear, from GPU Gems 3.  It helped me quite a bit, so hopefully it can do the same for you!

#5203268 Programming a Level Editor

Posted by on 10 January 2015 - 08:21 AM

You could also adapt an existing open source solution, such as Sony's ATF and editor.  Unless you want to learn about GUI programming, it is often better just to reuse an existing solution...

#5202273 Placing Vertices With Mouse Input In DirectX

Posted by on 06 January 2015 - 10:42 AM

Do you want the vertices to be in object space, or in world space?  Whichever one you want, you need to provide a homogenous coordinate (3D point with 1 as the w value) and transform it by the inverse of the appropriate matrix.  Your proposed transform above would likely give you world space coordinates.  If you want object space, you need to also include the world transform inside your inverse call.

#5200875 Starting my own game engine - please don't laugh.

Posted by on 30 December 2014 - 03:10 PM


Sorry for not to answer earlier, I decided to use visual studio 2012 for an IDE

Just FYI, 2013 is free (in fact, more free than any previous version of VS) as has fairly significant updates and changes over 2012.



That's true, assuming he isn't working for a company that is larger than the allowed size...

#5200874 Starting my own game engine - please don't laugh.

Posted by on 30 December 2014 - 03:09 PM

Eric's comments are really spot on - if you accept any of the advice in this thread, re-read his post!  While not as extensive as C4, I have a similar feeling and background with Hieroglyph 3.  It started out as a learning project, and has over time been upgraded, piece by piece, into what it is today.  The only additional caveat that I would add is that instead of throwing away an entire component, be sure to take away whatever you can from it.  Even if it is learning what not to do, there is always information available from a given implementation!


Good luck, and gamedev.net is your friend :)