Lights, please

By | May 21, 2011

Let there be light. Directional. Rotating. Slowly. From East to West. And we’ll take some ambient light as well, specially some blueish at night. There, I fixed it. Objects from Blender come with normals calculated for each triangle, but our terrain is still flat all day long. So we calculate and normalize all normals for each terrain part dynamically and feed the monster. Now you can actually tell what time of day it is by looking at the shades. Beautiful. While dynamically working on each terrain cut, we might just as well randomly add trees over certain height. We use region related seed for pseudo-random (no such thing as random or is there) function so we always get same random tree pattern. Unfortunately, now I already started to push humble mobile GPU capabilities. Apparently, it is very expensive to call rendering for each object, even more expensive if you are changing materials. So we only use one material, with vertex coloring. Also, I merged all trees into one renderable object. GPU liked that very much, and took me back to 100s fps. You are welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *