CATiledLayers

Tuesday, September 20, 2011

I've been working on a class in an iOS app, that displays a series of slides with one large image per slide. The user has the ability to swipe left or right and navigate to a new slide. The images were large enough that there was a noticeable lag. After much research I discovered CATiledLayers.
In short, a CATiledLayer will appropriately blend sections of an image together while a user is zooming and panning an image. Only small sections, or tiles, of the image are loaded into memory and onto the screen. This saves a lot of memory overhead as well as an allocation and a decompression lag in the main thread.

Apple gives you a nice head start on this functionality, but the don't give you everything. In my current iOS project, I am downloading images from a CMS. Once each image is downloaded, I slice it up accordingly using CGDrawing methods, then I cache them to disk, naming them imagename_row#_column#.png. In all, I saved four levels of detail for each image. This means that each image is resized, sliced up, and cached at four different resolutions (just think of having to do that in photoshop...for every client image). Then in the CATiledLayer implementation, it looks for the appropriate images to load based upon scale and position of the UIScrollView. It works really well and makes those high-res images load quickly.

Ocean Isles

Sunday, June 19, 2011

I've been dreaming of an oceanic island scene in Unity. Here I really didn't spend too much time on the models, but instead focused on implementing a nice camera fly courtesy of iTween, as well as some nice 3D sounds. I also implemented some basic pov manipulation scripts but they are buggy at best. This project was built in a days time. I deployed this to my iPad2 and it swims along at 60 fps...even when the camera is up next to the fire particles;). Click the image to give it a try. Make sure your speakers are on. I recommend headphones.

Unity Christmas Tree Scene

Friday, December 24, 2010




















Watch it on YouTube here.
I modeled this scene in Blender, imported it to Unity, light mapped it with beast, added occlusion culling and then ported it to the iPad. I am pleased to say that it gets a very high frame rate on the iPad.

iPad functionality includes: swipe finger to rotate the scene left or right. Touch on an area of interest to zoom in. Tilt the iPad up, down, left or right to do a smooth look in that direction. Pinch fingers together to zoom back out to the original point of view. Clicking on the end table reveals a Christmas card in the drawer.

I did not use any tween libraries for any of this functionality. I wanted to keep it very light for the iPad, so instead I used Unity's linear interpolation functions to calculate the distance for each movement. I wrote all the functionality in C#, as always.

This was created for my wife as a Christmas card on the iPad. Merry Christmas!

Asteroid Field

Monday, November 29, 2010
















 I just had to make an Earth with the sun and an asteroid field. I mean..wouldn't you? The camera fly is completely scripted. The asteroids are randomly placed.
Earth, cloud and specular map courtesy of oera.net (which seems to be down as of the moment of this post)

Cornel Box Fly

Tuesday, November 23, 2010
















I created a simple bluish-grey Cornel Box and lightmapped it with beast lightmapper in Unity. I played around with the settings a lot more in order to get a very nice over head lit look. I was able to script the camera fly in only a few lines of code. A nice polished piece for just a little bit of work! Give it a click and watch!

Unity City

Monday, November 15, 2010




Modeled by Sean McDonald
Before hand, this scene had one directional light and quite a few draw calls that slowed performance. I had the camera in forward render mode (no point lights so I don't need deferred render mode). Then I light mapped the entire scene and changed the rendering path to Vertex Lit. This immediately gave me a much better frame rate. I then baked in Occlusion Culling so that only the geometry that is seen by the camera is sent to the render pipeline which yielded a well optimized environment

Unity3D Studio Apartment

Tuesday, August 10, 2010

I modeled and UV mapped this 3D Studio with Blender and assembled it in Unity.
You can click and drag the sliders to dynamically change the room lighting. Click on a view button to see parts of the apartment.

Click here to view the interactive scene!


or watch the youtube video below.