Wednesday, January 3, 2007

Baked Textures, attempt 1

I took the plunge and rented myself a little vendor stall. Of course, I wanted to make it look nice, and I wanted to try out some texture baking, so I've spent the past couple of days working on that.

Aimee Weber's American Apparel build changes textures at sunset, and displays a floodlit look at night. Because I don't own the building my stall is in, I couldn't do much about the exterior — but since my stall has windows on two sides, and is across an aisle from similarly windowed stalls, I decided to change the interior lighting and shadows to match the position of the sun.



Every fifteen minutes (except at "night"), it gets the sun's current position and uses that to determine which texture to display. Fortunately, Linden Lab have been kind enough to provide a function to tell us where the sun is:

vector SunDirection = llGetSunDirection();


For some reason, the sun doesn't go straight east to west; it's tilted over by about 45 degrees, and the center of its path is somewhat above the grid, so it's below the horizon only one hour out of every four.

Anyway, making the textures for the store was fairly easy, but time-consuming. I recreated the entire store, plus some of the surrounding walls, ceiling and floor, using the Persistence of Vision Raytracer (a free 3D renderer). I chose POV-Ray over the other 3D packages I have because, like SL, it works with graphics primitives rather than polygon meshes, so it was easy to exactly re-create the geometry. Also, it can be scripted, so I could just plug in the list of sun positions, and make it light the scene from a different position based on which frame number I was rendering.

I had to render everything which would receive a baked texture: the wall, the floor, the ceiling, and every visible side of the wooden "bench" which would hold three vendor boxes. Then upload and apply! (The uploading was a bit pricey, since I had foolishly chosen to make a new set of textures for every fifteen minutes except nighttime. I managed to squeeze all the "bench" textures onto a single image for each time slot, but the grand total was still L$480 for only four things to texture — ouch! Maybe just day/night textures next time after all.)

3 comments:

Caterin said...

Good stuff Johanna, what will you be selling?

Johanna Hyacinth said...

Thanks!

I'll start out with the jewelry I've posted pictures of here on the blog, as well as some random things that I've made here and there.

Bolo said...

Very good blog