Mark Sachs (ksleet) wrote,
Mark Sachs

  • Mood:
  • Music:

With the grant money we get, we could buy a Porsche!

Some improvements to the sprite landscape thing.

First, the camera now rolls to complement the aircraft's roll. A minor thing, but it's nice for that whole Top Gun kinda feel.

Second, I finally buckled down and read Derek Yu's pixel art tutorial in an effort to see if I could make my sprites less horrific. And it turns out I could! Pixel art isn't actually that hard or time-consuming in principle, but there are some very important and non-obvious tips to follow when you do it. I'd advise you to check out the tutorial; after reading it, I made the new trees you see in the screenshot, and in this one stroke my pixel art has risen from "dreadful" to "almost passable"! I'm pretty pleased by that.

Third, I also cleaned up the underlying mechanics of how the various sprite types are organized, in order to make it easier to add to and/or reshuffle the sprite types in the scene. Along with that, there are now two types of trees as well as ocean waves in the scene, for a total of five different billboard sprites (land, tree 1, tree 2, water, wave). The framerate doesn't drop too much in release mode even then, but that's not shocking -- I'm not actually drawing more polygons than before except for the waves, and polygon drawing is what takes most frame time right now. Still, I can certainly improve performance. If nothing else, the utter lack of any clipping whatsoever means that three quarters of the sprites we're spending our time processing are entirely offscreen. I, uh, don't think we need to actually draw those.

So since the subject has been broached, how do we clip the sprites to the viewing frustum (the volume of space visible to the game camera), anyway? Well, let's see. The sprite landscape is effectively a giant grid of squares on a 2D plane. As long as I don't let the camera tip downwards too far, when projected down onto the plane the viewing frustum is close enough to being a triangle that we might as well just say it is one and move on. So the problem becomes: how do we find the squares on a 2D grid that are inside a triangle? In other words, we're just rasterizing a triangle, and there's lots of well-known ways to do that! I was so chuffed when I made this connection that actually implementing it just feels like a formality, really.
Tags: art, neon galaxy
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.