August 23, 2013

Graphics 9-10: 60 shades

Evening, our loyal supporters, and other random passersby who happen to read this blog, if for no other reason that its choice of font is excellent.

While this period's plan was to get wet (insert Snoop Dogg reference here), shadows were deemed more important and pushed water back to next period. Grass, having already been taken care of at a satisfactory level, will drop off the plan, having been replaced by water.


Here you see the importance map with some more functions of importance: distance from the camera, surface normal, and the luminosity of the seen pixel.

Distance is obvious, close shadows need more resolution than far-away ones. The surface normal function boosts the importance if the surface happens to be facing the camera, as shadows on that are more visible than those on a wall at an angle. And finally, darker pixels need less shadow resolution than brighter ones.

Together, we have approximately 16 times better resolution than good-old-shadow maps.


Then, the work progressed towards soft shadows. You might chip your finger on those hard edges if you're not careful, is all.

Having checked the most often used books on your coder's bookshelf, the Necronomicon and the Book of the Law had nothing on soft shadows, which was greatly surprising. Thus we had to dig deeper, finding an antique copy of Gpu Pro 2 buried in a temple close by.

That book details an incantation of screen-space soft shadows, a scalable spell that produces nice-looking soft shadows from any shadow technique. It's far from a uniform blur; shadows are sharper close to the caster as they should be.


Unfortunately we're not immune to a characteristic of warping shadow techniques: the edges swim. What could be done to limit it has been done, but as shadow pixels vary in size and position, fully stable shadows aren't possible with warping techniques.

Luckily, it's not that noticeable with soft shadows and racing at speed. Still, it highlights how this is still an open problem.

The next bit is for artists.



Here we have the screen and shadow views of a fence. There's slight peter panning going on, but otherwise it's looking good. Artists could help the Pan problem by making the fence thicker.




Going forward next to the fence, we see the shadow suddenly disappear. What's that? A fence made of grass decided to rot and disintegrate in place? No, nothing of the sort, sadly. Not even termites.

In the shadow view we see the issue: uneven warping due to huge triangles. Sure enough, checking the wireframe view, the fence tris are rather big. Warping techniques are sensitive to huge triangles: they can cause artifacts like these. Subdividing the appropriate parts gets rid of that.


And finally, water was started on. We have nice glittering summer caustics here, visible at the pool's bottom. Hard to see in a still picture you say? Aye, it be so. Take a sip of your closest bottle of rum, and repeat enough times that the lights in the picture start to move to get a picture of how it looks like.

So, the remaining time shall be spent in all kinds of wetplay; hopefully 0.8.1 will be out soon, so we can begin integrating the graphics changes. Many of them need updates to tracks so that they can be fully realized, which would push a release back a century or so, give or take 99.8 years.

7 comments:

  1. Sharp edges (trees, walls, etc.) are still bugging me a bit. Maybe using semi-transparent textures or blurring would make it all look better? (e.g. smooth grass hiding sharp edges on straight walls)

    ReplyDelete
  2. You mean aliasing? You can enable AA already, it's just off in these shots.

    ReplyDelete
  3. Wonderful, I wait 0.8.1... It's so long...

    ReplyDelete
  4. Second anonymous: Yes. And pixel shading - I just tried both of these features. Cool stuff, thanks.

    ReplyDelete
  5. BTW, I encountered this bug in the minigolf map - my car got stuck after using the rescue feature in the tunnel:

    http://i.imgur.com/mPVOWxW.jpg

    ReplyDelete
  6. i am learning some opengl at the moment and your posts are very interesting! thanks! i know what techniques i have to look into in the future. :)

    ReplyDelete
  7. 93 % I'm very impatient for STK 0.8.1 !!!

    ReplyDelete