Loading ...
Sorry, an error occurred while loading the content.

796RE: [cc2-dev-l] Roof angle

Expand Messages
  • Simon Rogers
    Oct 16, 2006
      Thank you.
      We were considering using a fixed roof angle for simplicity. I (or some
      other lucky person) needs to go through every png symbol and add the
      information to each one, so I need a fairly straightforward way of doing it.
      Maybe the filters will make this more straightforward. The option to add
      textures is tempting, though, even if we don't specify everything. I'll look
      into it.

      Simon Rogers
      http://www.profantasy.com <http://www.profantasy.com/>
      Livejournal - http://sjrlj.notlong.com <http://sjrlj.notlong.com/>

      The traditional way to encode angle information is via a surface normal (a
      unit XYZ vector) encoded into the RGB channels of an image, with the image
      being referred to as a "normal map". The dot product of the normalized light

      vector direction and the pixel from the normal map at the location gives the

      lighting intensity at that point. These calculations only work in something
      called tangent space, however. If you transform the light direction by the
      rotation matrix for your object then the images will be in tangent space (or

      maybe it's the transpose of the rotation matrix, I forget right now). There
      are many discussions of this sort of operation out there on the web (key
      phrases "normal map", "tangent space", and/or "pixel shader" should give the

      required references).

      The fun part about normal maps is that if you use single colors for the
      whole image then you can encode a single direction for each polygon, but if
      you use a normal map of varying colors then you can encode things like
      shingles, roughness, and so on into the image. There are filters available
      for Photoshop and the like that make it easy to construct normal maps (see
      the http://developer.nvidia.com <http://developer.nvidia.com> and search
      for PhotoShop Filters).

      The hardest part about this implementation is that you need to pass the
      rotation matrix for your entities to the renderer, but that's another issue
      entirely.

      Joe Slayton
    • Show all 7 messages in this topic