Two directX 11 questions.

Started by
1 comment, last by SteveHatcher 10 years, 3 months ago

Hi Guys,

When creating primitives for instance a quad, is it better to define the vertices a scaled size eg -0.2, 0.2 etc and draw them as is, or is it better to keep them all as 1.0f and apply a scaling transformation later on.

Secondly, once we are in world space my object appears with its (model space) center at 0,0 (staying with 2D). Is there a preferred way to organize objects so teh top left pixel of my object start at the top left of the screen (eg, top left pixel is 0,0)?

Thank you for your time

Advertisement

When creating primitives for instance a quad, is it better to define the vertices a scaled size eg -0.2, 0.2 etc and draw them as is, or is it better to keep them all as 1.0f and apply a scaling transformation later on.

If the quad comes from some resource, load it as it is and modify it in the shader.
If it is something you are creating at run-time, it is your choice. If it is a static 2D object such as those used for post-processing it is best to put them in normalized coordinates and do nothing in the shader, but otherwise it is case-by-case your decision.

Secondly, once we are in world space my object appears with its (model space) center at 0,0 (staying with 2D). Is there a preferred way to organize objects so teh top left pixel of my object start at the top left of the screen (eg, top left pixel is 0,0)?

Do what I mentioned for post-processing.
Make the coordinates:

[-1,-1]——[ 1,-1]
| |
| |
[-1, 1]——[ 1, 1]


And then do not transform them in the vertex shader.


L. Spiro

PS: Neither question was related to Direct3D 11.

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Thanks for the reply.

I don't fully understand what you mean abot rending from top left.

So what you are saying is draw it in model space so when it goes into world space it does not need any transforming? How do I know what vertices to choose so it will appear in that location? The area I am confused is how directX uses 'units' as its measurement system. Is there a section where I can change this to 'pixels'? So I can define the vertices as something like

5,5;

-5,5;

-5,-5;

5,-5

And then say 'draw this 10 by 10 pixel quad at (0,0), the very top left corner.

Thanks. It is just a bit confusion cause right now all the guides and tutorials talk about units.

This topic is closed to new replies.

Advertisement