Sign in to follow this  

view matrix

This topic is 4223 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I did a program with a triangle and it renders fine. I am confused as to how it is displayed on the screen as in where is 0,0,0, and how come I see what I see in that way. For a triangle like this {-1.0f, 1.0f, 0.0f, 0.0f,0.0f }, { 1.0f, 1.0f, 0.0f, 1.0f,0.0f }, {-1.0f,-1.0f, 0.0f, 0.0f,1.0f } D3DXVECTOR3 vEyePt( 0.0f, 0.0f, -1.0f ); D3DXVECTOR3 vLookatPt( 0.0f, 0.0f, 0.0f ); The middle of the screen is this i take it 0,0,0 , correct me I am wrong. q)to see the triangle i need to set the view as is. If I leave it out it defaults to something that makes it bigger. D3DXVECTOR3 vEyePt( 0.0f, 0.0f, 0.0f ); why does this show nothing on the screen ? is it because I will be looking at that point meaning my eye is on the points so i can't see. To see i need to step back along the z axis.

Share this post


Link to post
Share on other sites
Your projection matrix, if set to a perspective transform, can (and will) make things look "bigger" and "smaller" than their nominal size.

Again, your projection matrix defines the near and far planes of your view frustrum. In practice, you don't want to use a near plane value of zero, because then your depth buffer doesn't work due to it's accuracy divided by infinity.

Since your near plane probably is greater than zero, if you put your viewpoint to exactly touch the triangle, you see "behind" the triangle - which, I assume - is the clear color.

Do note that the view transformation is effectively undefined anyway if both the lookat point and the eye point are exactly same. In this situation, D3DX may take an arbitrary vector to guess the direction for the camera, but more often than not this is the wrong direction for any practical purpose.

Share this post


Link to post
Share on other sites
Ok i think I have got it

at 0,0,0 in centre of the screen you can put the object and see it, so long as the camera is put back along a z axis or something.

1) why are the u,v coordinated needed since we have xyz points on the screen.

{-1.0f, 1.0f, 0.0f, 0.0f,0.0f },
{ 1.0f, 1.0f, 0.0f, 1.0f,0.0f },
{-1.0f,-1.0f, 0.0f, 0.0f,1.0f }



2)does that mean all objects on the screen are in reference to a 0,0,0 at the centre?

[Edited by - jagguy on May 23, 2006 5:09:06 AM]

Share this post


Link to post
Share on other sites
U and V are generally representing a texture coordinate pair. They have nothing to do with the vertex's position - instead, they are used to specify to which point on a texture a particular vertex corresponds to. The U and V ranges 0...1 represent the whole texture area, regardless of what the texture resolution is, but you can specify values above and below those to achieve tiling effects.

You don't actually need texture coordinates if you don't have a texture (or a pixel shader that functions like one) to begin with. Just change the vertex structure and it's declaration if you don't have any use for the coordinates.

Share this post


Link to post
Share on other sites
thanks, i just read about it before you posted .

The only way you could use this for complicated shapes is if the shape was made up of triangles, so each texture could be a triangle. Better yet use a mesh for 3d shapes as rendered graphics on the fly look too hard to map.

Share this post


Link to post
Share on other sites
Quote:
Original post by jagguy
thanks, i just read about it before you posted .

The only way you could use this for complicated shapes is if the shape was made up of triangles, so each texture could be a triangle. Better yet use a mesh for 3d shapes as rendered graphics on the fly look too hard to map.


A mesh is made up of triangles. I recommend that you try to gain a deeper understanding of the concept of texture coordinates, after that it is simple to map your own geometry.

A texture isn't usually in a triangle domain - the texture coordinates of a particular triangle just specify what part of the active texture to use to rasterize that triangle.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nik02
Quote:
Original post by jagguy
thanks, i just read about it before you posted .

The only way you could use this for complicated shapes is if the shape was made up of triangles, so each texture could be a triangle. Better yet use a mesh for 3d shapes as rendered graphics on the fly look too hard to map.


A mesh is made up of triangles. I recommend that you try to gain a deeper understanding of the concept of texture coordinates, after that it is simple to map your own geometry.

A texture isn't usually in a triangle domain - the texture coordinates of a particular triangle just specify what part of the active texture to use to rasterize that triangle.



I don't think you understood what i meant, or i didn't explain well enough.

You wouldn't map a mesh object with each single vertex point in the FVF. Like a 3d object priobably would contain 100 to 1000s of points and you don't need to list each UV pair to make it work. That's why complex shapes are another issue.


Share this post


Link to post
Share on other sites
Quote:
Original post by ItsDoh
You do need to list each UV pair...

And yes, complex shapes aren't typically made by hand coding your vertex arrays.


thanks for the replies .

you don't have to get out a ruler and measure out each UV pair by hand for every mesh file you come across (what a horrible though to do if you did ).

Share this post


Link to post
Share on other sites

This topic is 4223 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this