Advertisement Jump to content
Sign in to follow this  

Screen Space Error

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello All.I am looking for some algorithm to computer the screen space error of an arbitrary vector in world coordinate. Is there any tutorial or source code? Please help me. thanks

Share this post

Link to post
Share on other sites
I assume the vector you mean is some vector telling you the difference e.g. of some point on a grid to the same point on some coarser/finer grid. That is, the vector is some error measure.

Lets call the vector d, the first point on the grid P1 and the second point P2. That is, d=P2-P1.

First of all, the screen-space error is dependent on P1 and P2. The closer P1 is to the camera, the larger will be the screen-space error in general.

In order to compute the screen-space error, project the two points P1 and P1+d to the screen. To do this, you have to apply the modelview matrix and then the projection matrix to P1 and P1+d. I assume that the modelview matrix maps world coordinates to eye (i.e. camera) coordinates. Note that both modelview and projection matrix are 4x4, but your points are 3-vectors. You'll need to add a 1 in the fourth component.

So if M is the modelview matrix and P is the projection matrix, you compute
c1 = P*(M*(P1,1))
c2 = P*(M*(P1+d,1))
((P1,1) is the vector (P1[0], P1[1], P1[2], 1).)

The screen-space error is now given by
error = sqrt( (c1[0]/c1[3] - c2[0]/c2[3])^2 + (c1[1]/c1[3] - c2[1]/c2[3])^2 )
(if I didn't mix up the indices).


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!