Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualNightCreature83

Posted 16 January 2013 - 12:39 PM

For a 2D game with Direct3D you need an orthogonal projection matrix, so z-axis is disabled in projection.
To draw a sprite you can either draw a quad with a texture or create the quad within a geometryshader.
For rotation, scaling,... you can modify your modelmatrices.

An alternative is Direct2D, where you can "draw like in MSPaint". You can also draw rectangles with bitmaps to use it as sprites. The API also provides opacity and mask so you can stencil out e.g. the character-sprites. And you can rotate, zoom etc with easier matrix-manipulations.

Maybe Direct2D is a better start to get into the world of 2D and advance to D3D afterwards.
The Z axis isn't disabled by the projection the just map to the same location on the screen is all. and Z values still affect if an object is in front of another one. And you can still render full 3D models with an orthographic projection the projected image however doesn't have any depth queues embedded in the image.

Effectively all a projection does is take how something looks in a certain space(1D, 2D, 3D, 4D, ...) and transform this into an other space(1D, 2D, 3D, 4D, ...) and show what it looks like in that. During the projection you can lose some information but this doesn't mean that the information in the original space doesn't affect the result of the projection.

For a long time using 3D to do 2D stuff was the only way to go with DirectX as the hardware was faster doing the 3D transformations than doing the 2D ones.

#2NightCreature83

Posted 16 January 2013 - 12:37 PM

For a 2D game with Direct3D you need an orthogonal projection matrix, so z-axis is disabled in projection.
To draw a sprite you can either draw a quad with a texture or create the quad within a geometryshader.
For rotation, scaling,... you can modify your modelmatrices.

An alternative is Direct2D, where you can "draw like in MSPaint". You can also draw rectangles with bitmaps to use it as sprites. The API also provides opacity and mask so you can stencil out e.g. the character-sprites. And you can rotate, zoom etc with easier matrix-manipulations.

Maybe Direct2D is a better start to get into the world of 2D and advance to D3D afterwards.
The Z axis isn't disabled by the projection the just map to the same location on the screen is all. and Z values still affect if an object is in front of another one. And you can still render full 3D models with an orthographic projection the projected image however doesn't have any depth queues embedded in the image.

Effectively all a projection does is take how something looks in a certain space(1D, 2D, 3D, 4D, ...) and transform this into an other space(1D, 2D, 3D, 4D, ...).

For a long time using 3D to do 2D stuff was the only way to go with DirectX as the hardware was faster doing the 3D transformations than doing the 2D ones.

#1NightCreature83

Posted 16 January 2013 - 12:35 PM

For a 2D game with Direct3D you need an orthogonal projection matrix, so z-axis is disabled in projection.
To draw a sprite you can either draw a quad with a texture or create the quad within a geometryshader.
For rotation, scaling,... you can modify your modelmatrices.
 
An alternative is Direct2D, where you can "draw like in MSPaint". You can also draw rectangles with bitmaps to use it as sprites. The API also provides opacity and mask so you can stencil out e.g. the character-sprites. And you can rotate, zoom etc with easier matrix-manipulations.
 
Maybe Direct2D is a better start to get into the world of 2D and advance to D3D afterwards.
The Z axis isn't disabled by the projection the just map to the same location on the screen is all. and Z values still affect if an object is in front of another one. And you can still render full 3D models with an orthographic projection the projected image however doesn't have any depth queues embedded in the image.

For a long time using 3D to do 2D stuff was the only way to go with DirectX as the hardware was faster doing the 3D transformations than doing the 2D ones.

PARTNERS