Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Frustum clipping - depth interpolation


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 SIIYA   Members   -  Reputation: 469

Like
0Likes
Like

Posted 12 December 2012 - 01:23 PM

Hi,

I have implemented a software rasterizer for occlusion culling. However, In some cases I get strange depth map results when polygons get clipped by frustum, especially when clipped by near plane. I am clipping points in homogenous coordinates (before w division) using -w <= x,y,z <= w.
Point interpolation along the edge (for near plane) is done like this:

newPoint = p1 + (p2-p1) * t;

where:

t = (-p1.w - p1.z) / (p2.z - p1.z + p2.w - p1.w);

Depth map with wrong depth interpolation is in the attachment.

Does anybody know what is wrong here?

Thanks!

Attached Thumbnails

  • OCMap.jpg


Sponsor:

#2 SIIYA   Members   -  Reputation: 469

Like
0Likes
Like

Posted 23 December 2012 - 08:18 AM

I think I solved it. I haven't used perspective correct depth interpolation, and now I have fixed it.

I did it this way:

I write z/w and 1/w per vertex

In rasterizer I do linear interpolation of both (z/w)' and (1/w)'

PixelDepth = (z/w)'/ (1/w)'


Please, can someone confirm this is OK? Occlusion map looks good but I want to be sure this is how it's done.

Thanks!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS