pouët.net

Question on 3d perspective proyection

category: general [glöplog]
 
From Wikipedia:

BB Image

BB Image

Well, suppose I'm doing wireframe. Suppose a triangle vertex is not in front of the eye, but in the back of the eye, but I want to paint it too. So, is this correct?

Bx=Ax*(abs(Bz)/abs(Az));

Note that what I want is a boundary to do the rasterization with triangle-raytracing, and I don't want to cut the triangle with the screen


added on the 2009-04-27 01:58:41 by texel texel
I'm thinking and I should use a near plane cut...
added on the 2009-04-27 02:08:00 by texel texel
Yep.

If you are using a planar projection, then there is no sensible 2D interpretation of vertex positions which are "behind" the eye. You need to clip your primitives in 3D against your viewing frustum before going to 2D. Or, at the very least, clip the primitives against the near-plane.

So: set up a near plane very close to the eye, and clip your lines against the near plane. After clipping, the resulting vertex positions can be projected 3D->2D safely.
added on the 2009-04-27 09:22:05 by Kalms Kalms
I'm not sure I understand. If you're doing raytracing, what's the perspective projection for?
added on the 2009-04-27 10:45:17 by doomdoom doomdoom
Oh right, a boundary. Silly me. :) Then you need to cut the triangle with a near plane, or ignore any triangle that has one or more points behind the near plane. There's no sensible way to project lines across z = 0.
added on the 2009-04-27 10:54:22 by doomdoom doomdoom
if you're raytracing, you just spawn your rays on the near plane instead of using the eye point as origin. if you're doing rasterization, you need to clip triangles. i'm not sure which you're using from the description.
added on the 2009-04-27 11:23:34 by ryg ryg
To "see" triangles behind your head, you can use a fisheye, easy with raytracing.
added on the 2009-04-27 14:06:41 by baah baah
Well, I explain:

I'm doing a mixed rasterization/raytracing. Why? Because I want a clean/easy solution for perspective corrected textures, and I've already done it with RT. It is only for the first pass. So, What I'm doing is using a z-buffer for the raytracer and raytracing only 1 triangle at a time. Then, If I do it only for the boundaries of the triangles, it is faster.

With the boundaries I mean the square in the screen where I'm sure the triangle will fit.

This is why I'm proyecting the triangle edges.

The problem is when I have very very big triangles that are in part behind and in part in front of the eye. In a concrete case, a very big ground created with 2 very big triangles.

So, what to do in that case?
added on the 2009-04-27 16:52:20 by texel texel
Uhm. Clipping?!
added on the 2009-04-27 17:14:51 by raer raer
So, ok, I will clip the triangles.

I have to learn how to do it :)

Thanks :)
added on the 2009-04-27 17:19:40 by texel texel
You don't need to clip the triangle to generate some conservative screen-space bounds. Just assume that the edges that goes through the z=0 plane extends to infinity in negative z-case. Or even easier - if a triangle intersects the z-plane, just make the bounding rectangle the entire screen. In general, triangles intersecting the z-plane are quite big, but there's only a few of them.
added on the 2009-04-27 17:40:58 by kusma kusma

login