Friday, June 17, 2011

Invert Z-Depth ( Back-Face Culling ) in Blender 2.57

These are some of the first things that I created to start off in Blender and how I made them.

A Cube Inside of Another Cube
My first few creations were inspired by an artist on - Cezkid.  He makes 3D pixelated 8-bit video game characters (voxel models) that I found to be pretty novel - Cezkid Voxel Characters. He uses Google SketchUp not Blender.

cube inside of another cube with Invert Z Depth enabled
So at first glance, this cube looks quite unimpressive. You'd think it was just a cube with a big blue border around it, but it's not. And it wasn't that easy to figure out how to execute.  I asked Cezkid for some leads and he mentioned "back-face culling". Well it was a lead, but it did me little good because Blender doesn't have an option named back-face culling or anything similar.  Also, this was my first model, and I had little to no idea how to determine the visibility of a polygon or face.  After many hours of Googleing and tweaking, I happened to stumble upon the Invert Z Depth property (Zinvert in earlier versions) by accident - success.
Brief Invert Z Depth Explanation:
These are two cubes- a small one ( solid grey material with Recieve Shadows and Cast Shadows turned off and Z Transparency turned on), and a bigger blue one ( solid blue material with Shadeless and Invert Z Depth property turned on).  This creates a mesh (the big cube) that has transparent faces when they point to the camera.  This also works on two-sided faces in case anyone's wondering. Read on to see exactly how I did it.

Invert Z Depth Tutorial:
You don't need an actual mouse with a wheel for this tutorial. A touch pad will suffice.
  • Open a new Blender project
  • Right click on the cube in the 3D View to select it.
    selected cube object
  • Go to Properties Panel (SHFT+F7) and select Material
  • Materials icon in Properties panel
  • Scroll down to Shading and check Shadeless
  • set Shading to Shadeless
  • Scroll down to Options and check Invert Z Depth
  • Inver Z Depth
  • Place the cursor in the 3D View and press the ZKey to show the cube in Mesh mode.
  • Be sure the cube is selected and press SHFT+DKey to duplicate the cube. 
  • Press ESC (otherwise the duplicated cube will move around)
  • Press SKey > type the number .5 > press ENTER (this scales a cube down to half size)
  • scaled cube inside duplicate in mesh mode
  • Now be sure that the smaller cube is selected and go to the top of its Material panel.
  • Remove the Material by pressing the minus-looking button.
  • Remove material and add a new one
  • Press the + New button that pops up.
  • Check the Transparency option and enable Z Transparency (THIS IS IMPORTANT)
  • enable Z Transparency in the smaller cube
  • Scroll down to Shadow and un-check Recieve.
  • un-check Recieve in Shadows option
  • Press F12 to render!

If everything went smoothly, you should see this:

 Hope this may help anyone who may be looking for something similar. I have no idea how this will hold up under other scenarios or circumstances, but it worked for this example.

Other Objects
Here are two other objects that I created with the same concept.

No comments:

Post a Comment