Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Frustum clipping - depth interpolation

4: Adsense

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   

477
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


#2 SIIYA   Members   

477
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.