Jump to content
  • Advertisement

Bunker

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

189 Neutral

About Bunker

  • Rank
    Newbie
  1. Problem Solved! After calling D3DXMatrixPerspectiveOffCenterLH?I simply divide the elements M(0,0) and M(1,1) by zn in the output matrix to make the view plane come back to z=1. Now it looks just fine! Maybe I didn't describe my problem properly since it's my first time to post in English. Anyway,thank you guys here for helping so much :)
  2.     I did something very similar 5 years ago (picture) and all the magic with projection was done very simply by using D3DXMatrixPerspectiveOffCenterLH to create the projection matrix. Try to look at this D3DX function ;)   That's awesome.It could be better if the cup is "outside" the screen.
  3. I thought the concepts of the near clipping plane and the view plane(or projection plane) are unified in DirectX's world before?but they're not actually. The view plane are set to z = 1 while the near clipping plane are adjustable. So it's possible to adjust the near clipping plane while keeping the view plane unmoved.   I searched MSDN for the functions that can be used for generating projection matrix, there are two of them: D3DXMatrixPerspectiveFovLH D3DXMatrixPerspectiveOffCenterLH The first one is commonly used. The second one is which I am using because the point of view is movable in my projection model so the matrix will be offcenter.   Details as follows: D3DXMATRIX* D3DXMatrixPerspectiveFovLH( _Inout_ D3DXMATRIX *pOut, _In_ FLOAT fovy, _In_ FLOAT Aspect, _In_ FLOAT zn, _In_ FLOAT zf ); D3DXMATRIX* D3DXMatrixPerspectiveOffCenterLH( _Inout_ D3DXMATRIX *pOut, _In_ FLOAT l, _In_ FLOAT r, _In_ FLOAT b, _In_ FLOAT t, _In_ FLOAT zn, _In_ FLOAT zf ); These two functions compute the returned matrices as shown:   D3DXMatrixPerspectiveFovLH xScale 0 0 0 0 yScale 0 0 0 0 zf/(zf-zn) 1 0 0 -zn*zf/(zf-zn) 0 where: yScale = cot(fovY/2) xScale = yScale / aspect ratio  Parameter zn represents the position of the near clipping plane,while FOV is determined by fovy.   D3DXMatrixPerspectiveOffCenterLH 2*zn/(r-l) 0 0 0 0 2*zn/(t-b) 0 0 (l+r)/(l-r) (t+b)/(b-t) zf/(zf-zn) 1 0 0 zn*zf/(zn-zf) 0 In this matrix, zn determines both the near clipping plane and FOV. To keep FOV unchanged while zn is changing, I have to adjust the size of the view volume at the same time. Tell me if I am wrong.       Well?I use a Kinect to track the eye.
  4. Demo.jpg   Thanks for telling me.This link should be okay.
  5. http://b236.photo.store.qq.com/psb?/V107xbRs1mVv6O/K1tJMuSembFHoemkDGwPBiPMFTetICWwD*N0HwxmECY!/c/dKUQuoxPBgAA&bo=VQOAAkAGsAQBAAE!&rf=mood_app     This is a picture shows the visual effect of that demo.You can see part of the teapot is seems to be "outside" the screen(view plane).To achieve this,I have to find a way to render the "outside" part instead of clipping .However, the DirectX API will arbitrarily clip any primitive that behind the view plane, which is the major problem.Any one can give some suggestions please.     Hi, groverman! I've read your suggestions?I think your idea about adding a hack w-offset amount might be an executable way.But I get no idea how to push/pull three vertices (the triangle) at the same time in a vertex shader.So would you mind giving further explanation?
  6. I wrote a demo before, it's a software renderer that renders a teapot which partly passes across the screen(view plane).The program tracks my eye's position and then correct the perspective projection in real-time,so it is able to render a stereoscopic scene on an ordinary LCD screen. Now I want to achieve the same thing using Direct3D9 APIs for better performance,but I found the view plane is considered the same plane as the near clip plane acquiescently in its pipeline process,which causes any primitive passes across the view plane will be clipped.So I wonder if it's allowed to toggle the near clipping process off and if there are tricks to render the primitive that passes across the view plane.Thanks!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!