Blog 2.0
Dark Style Medium Style Light Style

Blog Statistics
First Previous Homepage Next Latest
RSS Feed

Oops!

I mentioned previously that I would make a post about screen space error sometime soon, well I have some other things I want to talk about but I'm going to hold them and keep my vague promises.

So, screen space error, what is it? SSE (as I shall refer to it from now on) is quite important to Level of Detail (LoD) algorithms. The SSE of something is the different between the space on screen that it takes up, and the space on screen it should take up (if it was represented at the highest level of detail). Obviously your triangles are better spent if the LoD algorithm takes SSE into account and spends more triangles where there is a higher error (see my previously blog post for more details on LoD algorithms).

Now, I can hear you asking, "but Martin, how do we calculate screen space error?", the obvious way to do it is to draw the perfect representation, then draw the imperfect version (maybe using the stencil buffer to set and unset booleans) - count the number of pixels difference. This, however, is fairly useless - I don't have a perfect version, and if could afford to draw the perfect and imperfect versions, I wouldn't need a LoD system anyway! A better way to do it is to calculate the difference between the perfect and imperfect versions (in world space) and then project that into screen space - this is roughly what I shall do for Myriad.

First, I need to calculate the difference (error) in world space. This presents a bit of a problem; a perfect version would have infinitely many data points. So, I see two techniques here, one is cheap and one is probably slightly better - testing will be needed to determine if the better solution is needed of if I can get away with being cheap.
1) Calculate the next level of detail up, calculate the error, take that difference as your error.
2) Calculate the next several Levels up, calculate an error curve, and project to infinity, take that as your error.
Obviously the second one is better since it makes a guess at what the error is, wheras the first one simply guesses a number which is a "good enough" representation of the error.

Second, I need to project into screen space, there is an established way of doing this useing matrices etc, however once again I want to use a cheap estimate to save some processing time (remember, lots and lots of these errors have to be calculated). My cheap estimate is this:
Screen space error = Error / D
where
D = Dot product(vector to triangle, camera direction vector)
which is quite neat, the dot product gets larger as the object gets further away, and also gets larger as the item gets closer to 180 degrees from the camera view, so the screen space error will get smaller in those two cases - which is what we want!

A word of warning, I haven't tested this guestimate yet, I suspect it may have issues with either angle or distance being taken into account too much and rendering the other almost pointless in the calculations - however an arbitrary constant multiplier for input vectors (to adjust their length) ought to fix that problem.

Screen Space Error = World Space Error / ([constant * vector to object in question] . [camera direction vector])

Next time I'm going to be talking a little about the pathfinding algorithm we'll be using in Myriad, and possibly showing some screen shots of the LoD in action.

I would also like to add that quite a bit of effort went into getting the comments working on this blog, make sure to use them!

Posted on 2009-07-08 00:56:45.557563
This post : 293 views
Permalink: http://martindevans.appspot.com/blog/perma?agxtYXJ0aW5kZXZhbnNyEAsSCEJsb2dQb3N0GLmUAQw

Author:
Post:
Latest Entries:

Triangulation and Blog 2.1
2009-11-09 18:03:49.415016
Neglect
2009-11-05 21:54:34.749240
N
2009-09-13 01:55:27.993530
Virtual Textures
2009-09-02 09:11:37.076017
Hard working Laziness
2009-08-19 14:11:45.639809
Don't go into the long grass
2009-08-03 17:49:34.315912
Oops!
2009-07-08 00:56:45.557563
Landscaping
2009-07-01 12:06:04.994983
Web Development & Game Development
2009-06-18 18:27:18.057752
Furry Rendering
2009-06-10 20:02:15.395323