Public Group

# view matrix

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

## 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 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 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 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 on other sites

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 on other sites
Quote:
 Original post by jagguythanks, 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 on other sites
Quote:
Original post by Nik02
Quote:
 Original post by jagguythanks, 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 on other sites
You do need to list each UV pair...

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

##### Share on other sites
Quote:
 Original post by ItsDohYou 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 ).

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 9
• 33
• 41
• 23
• 13
• ### Forum Statistics

• Total Topics
631745
• Total Posts
3002004
×