<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mobile Perspectives &#187; PowerVR</title>
	<atom:link href="http://www.BluMtnWerx.com/blog/tag/powervr/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.BluMtnWerx.com/blog</link>
	<description>Computing at the Edge!</description>
	<lastBuildDate>Fri, 19 Aug 2011 00:29:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>OpenGL-ES Texture Mapping for iPhone / Oolong / PowerVR</title>
		<link>http://www.BluMtnWerx.com/blog/2009/06/opengl-es-texture-mapping-for-iphone-oolong-powervr/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/06/opengl-es-texture-mapping-for-iphone-oolong-powervr/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 19:59:42 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Oolong]]></category>
		<category><![CDATA[OpenGL-ES]]></category>
		<category><![CDATA[PowerVR]]></category>
		<category><![CDATA[texturing]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=84</guid>
		<description><![CDATA[Resources to help newbs like me get started with more advanced texturing in OpenGL-ES for the iPhone, particularly when using Blender as the modeling tool.]]></description>
			<content:encoded><![CDATA[<p>Sorry it&#8217;s been so long, but I&#8217;ve been busy learning and applying texture mapping for the upcoming iPunt update.  As the old saw goes, &quot;The more I learn, the more I realize I don&#8217;t know!&quot;  The learning process has been pretty fun, and I hope that what I share here helps keep it fun for someone else.</p>
<p>I want to apologize in advance for the lack of polish in this post.  It&#8217;s kind-of a hodge-podge of information, but it&#8217;s been in the womb too long.  Time to get it out, even if it&#8217;s rough!</p>
<p>I&#8217;ve had a lot of trouble getting my head around texturing.  I know what I want to do, and I understand the &quot;how to&quot; do it for OpenGL, but there are a bunch of issues that make translating the theory to practice on the iPhone challenging:</p>
<ul>
<li>The iPhone uses OpenGL-ES 1.x which is not OpenGL when it comes to texturing.  (News flash, the iPhone 3G S will support OpenGL-ES 2.0.)</li>
<li>The PowerVR MBX chipset doesn&#8217;t support all of the OpenGL-ES functionality (particularly the stencil buffer.)  It will be interesting to see what the new SGX chipset provides.</li>
<li>If you&#8217;re using Blender for your modeling, as I&#8217;m trying to do, making the translation from a texturing strategy in Blender to something that will work on the device may not be obvious.</li>
</ul>
<p>I found myself doing a lot of googling and reading books, then trying things out only to find that the methods provided required an API call or technique that doesn&#8217;t work on the platform.  So, I&#8217;ve compiled a little list of resources and hints that perhaps will make the going easier for those that are also trying to climb the mountain.</p>
<p><strong>The Basics of Texturing</strong></p>
<p>There are some great tutorials on OpenGL texturing out there.  Here are a few to get you started, but there are many more that are worth mentioning:</p>
<ul>
<li><a title="Zeus Texture Mapping Tutorial" href="http://www.zeuscmd.com/tutorials/opengles/17-TextureMapping.php" target="_blank" title="Zeus Texture Mapping Tutorial">Zeus Texture Mapping Tutorial</a></li>
<li><a title="OpenGL Texture Mapping Tutorial" href="http://www.flipcode.com/archives/Advanced_OpenGL_Texture_Mapping.shtml" target="_blank" title="OpenGL Texture Mapping Tutorial">Flipcode Advanced OpenGL Texture Mapping</a></li>
</ul>
<p>These and others will get you the basics.  Please don&#8217;t waste time writing loaders for different graphics file types, generating textures and so-on.  Oolong and PowerVR have a solution for that which is much quicker and better.  Simply load your texture bitmap (in whatever format is convenient) into the PowerVR TexTool and generate the PVRTC (.pvr) compressed texture file.  A few easy calls and the .pvr file is loaded into your app and ready to use.  I&#8217;ll provide a more complete recipe for this a little later in this post.</p>
<p>One of the things that I struggled with in a big way was understanding and generating texture coordinates.  This is something that all of the tutorials make short shrift of.  Most of them provide a static array of 0&#8242;s and 1&#8242;s and leave it at that.  Those that go a bit deeper (the Red Book and Super Bible go into more detail) rely heavily on glTexGen().  Well, guess what, there is no glTexGen() for OpenGL-ES and I have found very little  help in working around that.  The one bright light is this article on &quot;<a title="Mathematics of glTexGen article." href="http://www.opengl.org/wiki/Mathematics_of_glTexGen" target="_blank" title="Mathematics of glTexGen article.">The Mathematics of glTexGen()</a> &quot; from the OpenGL wiki.  With this information, you can write your own procedural texture coordinate generation code.  One of the best explanations of what each of these generation &quot;modes&quot; does is found <a title="SuperBible chapter on texcoord generation." href="http://www.informit.com/articles/article.aspx?p=770639&amp;seqNum=4" target="_blank" title="SuperBible chapter on texcoord generation.">here</a> , from the OpenGL Super Bible.</p>
<p>More than likely, the main reason that these resources don&#8217;t help much with procedural texture mapping is because most texture mapping is performed in a modeling tool.  The funny thing is that, with all my searching, it took a while before I discovered how to do this in Blender.  There is actually a very good, comprehensive tutorial in the Blender manual that explains all:  <a title="Link to Blender texture mapping documentation." href="http://wiki.blender.org/index.php/Doc:Manual/Textures/UV" target="_blank" title="Link to Blender texture mapping documentation.">Blender UV Texture Mapping</a> .  The relevant documentation is several web pages long, so stick with it to the end.  Note that in the currently available iPhones (the PowerVR MBX chip) there are only two texture units, so don&#8217;t plan on deep multi-texturing for this device.</p>
<p><strong>The Blender-&gt;PVR-&gt;Oolong Procedure At A Glance</strong></p>
<p>Here&#8217;s a high level overview of the entire procedure at a glance.  Note that I have left out many details that are covered in the Blender documentation, only including those steps that are either structural or I have additional details for.</p>
<p>In Blender:</p>
<ol>
<li>Create your mesh.</li>
<li>Select the <em>Material</em> window configuration which puts the <em>UV/Image Editor</em> and <em>3D View </em> up simultaneously (see image below.)</li>
<li>Put the 3D window in texture mapped mode so that you can see the effects of texturing in real-time.</li>
<li>Create or select a material for the object or faces.</li>
<li>Create a UVTex mapping for the object or faces.</li>
<li>Unwrap the mesh.  This will probably take some experimentation with the many unwrapping algorithms Blender provides, along with some manual editing of the faces in the UV window.</li>
<li>Export the face layout to a .tga file using the Blender script <em>UVs-&gt;Scripts-&gt;Save UV Face Layout</em> .  Be sure to set the size to the final size of the texture (for a 256&#215;256 texture, set the size to 256.)  Be sure size is a power of 2.</li>
</ol>
<p>In GIMP or the image editing / paint tool of your choice&#8230;</p>
<ol>
<li>Open the .tga file and copy the layout to a semi-transparent, top layer (overlay).</li>
<li>&quot;Color&quot; the texture on layers underneath it.</li>
<li>Turn off the overlay and export to .png format</li>
</ol>
<p>In Blender</p>
<ol>
<li>Load the texture image and assign to the mesh faces to which it applies.</li>
<li>Use texture paint to touch up any areas where appropriate.  (Be sure to load the changed version into your image editor if you go back!)</li>
<li>Adjust vertices and mapping as necessary and iterate.</li>
</ol>
<p>For the most part, the result on the device will look the same as in Blender, so you can just stay in Blender and GIMP until you have it looking right.  I noticed that I occasionally had to flip normals on some faces in Blender, particularly when I manually added faces or reduced the face count during optimization.  Faces with the normal facing in the wrong direction will look transparent in Blender.</p>
<p>Note that the mapping is extremely flexible.  It is not necessary for faces in the UV window to have proportional area to the actual faces on the mesh.  In fact, it is a monumental waste of pixels to map faces that are a solid color or have low resolution data to large UV areas.  Devote most of the area in your texture to the high resolution content and put low resolution faces in smaller areas.  Also, remember that it&#8217;s OK if UV faces overlap as long as the result is what you want.  I sometimes just create a color splotch and put all the faces that are that color higgledy-piggledy in the splotch.</p>
<p>When the object looks the way you want, use the PVRTexTool to convert the texture image to .pvr format&#8230;</p>
<ol>
<li>Open the texture image produced above in the PVRTexTool (comes with the PowerVR SDK.)</li>
<li>Generate all MipMaps.  They should automatically show up.  If they don&#8217;t, your texture may not be square and a power of 2.</li>
<li>Use Save As to save the texture as a .pvr</li>
<li>In the encoding dialog that pops up, select 2bpp or 4bpp as needed, turn YFlip OFF, and export all mipmaps.  Many other encodings are supported, but I have found that the PVRTC 2bpp and 4bpp encodings work very well with the Oolong kit.  Use 4bpp where you need better image quality, 2bpp where the quality is not as important.  Experiment to get what you need.</li>
</ol>
<p>You can now load the POD and texture, apply the texturing during rendering in Oolong and it should look the same as it did in Blender.  I used the Shadows example to get me started.</p>
<p>Here are some examples from iPunt:</p>
<p><a href="http://www.BluMtnWerx.com/blog/wp-content/blenderapache1.png"><img src="http://www.BluMtnWerx.com/blog/wp-content/blenderapache1-300x223.png" alt="Apache helicopter being textured in Blender." /> </a></p>
<p><img src="http://www.BluMtnWerx.com/blog/wp-content/apacheondevice.png" alt="Textured helicopter as rendered on device." width="300" /></p>
<p><strong>Procedural Texturing</strong></p>
<p>Once I figured out how to use Blender to map an image to an object by &quot;unwrapping&quot; it, I didn&#8217;t have as much need for procedural texturing, but for certain things (like cube mapping and projections) procedural texturing is still useful.  Here&#8217;s what I learned.</p>
<p>One of the conceptual things that I struggled with is that I kept trying to think of wrapping my texture around an object.  The way these algorithms work is backwards from that, and much easier.  They work backwards from the point on the object to be textured to the pixel in the texture bitmap to be used.  I don&#8217;t know if that helps anyone else, but it was an epiphany for me!</p>
<p>One little trick that you need to be aware of is that you&#8217;ll need to &quot;adjust&quot; your texture coordinates after the chosen glTexGen() algorithm has generated them.  The algorithm will generate values in some range, such as -n .. +n and you&#8217;ll want to re-map that range to 0..1 or 0..r (for repeated textures.)  Otherwise, you&#8217;ll get garbage.  I call this &quot;re-boxing&quot; the coordinates instead of &quot;normalization&quot; since normalization tends to refer to reducing vectors to unit-length in OpenGL.  Here are some code fragments that do all of the above in an Oolong environment:</p>
<p>Here&#8217;s an implementation of glTxGen() OBJECT_LINEAR:</p>
<pre>// Note that these algorithms come from:
// http://www.opengl.org/wiki/Mathematics_of_glTexGen

void texGenObjectLinear(GLfloat* buf, unsigned int stride, const btVector3 &amp;sPlane, const btVector3 &amp;tPlane) {
  // Loop through the vertices and operate on each one
  unsigned char* p = (unsigned char*)buf;

  for (unsigned int i=0; i &lt; numVertices(); i++, p+=stride) {
    buf = (GLfloat*)p;
    const btVector3 vtx(vertex(i)[0], vertex(i)[1], vertex(i)[2]);
    buf[0] = vtx.dot(sPlane);
    buf[1] = vtx.dot(tPlane);
  }
} // computeTexObjectLinear()</pre>
<p>As you can see, this is just a direct translation of the pseudo-code in the Mathematics of glTexGen() article, using the Bullet vector dot product.</p>
<p>Here is the implementation of the vertex() method for SPOD meshes:</p>
<pre>virtual GLfloat* vertex(unsigned int i) {
  if (_pMesh-&gt;pInterleaved != NULL)
    return (GLfloat*)(_pMesh-&gt;pInterleaved+(size_t)_pMesh-&gt;sVertex.pData+i*_pMesh-&gt;sVertex.nStride);
  else
    return &amp;((GLfloat*)(_pMesh-&gt;sVertex.pData))[i*_pMesh-&gt;sVertex.nStride];
} // vertex()</pre>
<p>If you&#8217;ve loaded your meshes from a POD file, you can just call this as below (note that _pMesh is an SPODMesh* and texGenObjectLinearInPlace() will compute the new texcoords in-place, over-writing the texture coords in the SPOD data structure.)</p>
<pre>GLfloat* uvArray() {
  if (_pMesh-&gt;pInterleaved != NULL)
    return (GLfloat*)(_pMesh-&gt;pInterleaved+(size_t)_pMesh-&gt;psUVW[0].pData);
  else
    return (GLfloat*)_pMesh-&gt;psUVW[0].pData;
} // uvArray()

// Recompute text coords in-place
void texGenObjectLinearInPlace(const btVector3 &amp;sPlane, const btVector3 &amp;tPlane) {
  this-&gt;texGenObjectLinear(uvArray(), _pMesh-&gt;psUVW[0].nStride, sPlane, tPlane);
} // texGenObjectLinearInPlace()</pre>
<p>I ended up writing a general-purpose routine to &quot;re-box&quot; vertices.  Not pretty, and my brain tells me that it could be more elegant, but I haven&#8217;t figured out how yet.  Perhaps after I&#8217;m rested up&#8230;</p>
<pre>void BMWDrawableObject::reBoxVertices(GLfloat* buf, unsigned int stride, unsigned int numVtx,
       unsigned int coordsPerVert, const btVector4 &amp;min, const btVector4 &amp;max) {
  // Calculate (in-place) the new vertices based on the min and max vertices passed in.
  GLfloat* pStart = buf;
  btVector4 minAccum(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX);
  btVector4 maxAccum(FLT_MIN, FLT_MIN, FLT_MIN, FLT_MIN);

  // Compute the current nD bounding box
  unsigned char* p = (unsigned char*)pStart;
  for (unsigned int i=0; i &lt; numVtx; i++, p+=stride) {
    buf = (GLfloat*)p;
    for (unsigned int j=0; j &lt; coordsPerVert; j++) {
      minAccum[j] = (buf[j] &lt; minAccum[j]) ? buf[j] : minAccum[j];
      maxAccum[j] = (buf[j] &gt; maxAccum[j]) ? buf[j] : maxAccum[j];
    }
  }

  // Compute scale and offset to be used on each vertex.
  btVector4 offset(min[0]-minAccum[0], min[1]-minAccum[1], min[2]-minAccum[2], min[3]-minAccum[3]);
  btVector4 oD(maxAccum[0]-minAccum[0], maxAccum[1]-minAccum[1], maxAccum[2]-minAccum[2], maxAccum[3]-minAccum[3]);
  btVector4 nD(max[0]-min[0], max[1]-min[1], max[2]-min[2], max[3]-min[3]);
  btVector4 scale(nD[0]/oD[0], nD[1]/oD[1], nD[2]/oD[2], nD[3]/oD[3]);

  // Loop through and set the values.
  p = (unsigned char*)pStart;
  for (unsigned int i=0; i &lt; numVtx; i++, p+=stride) {
    buf = (GLfloat*)p;
    for (unsigned int j=0; j &lt; coordsPerVert; j++)
      buf[j] = (buf[j]+offset[j])*scale[j];
  }
} // reBoxVertices()</pre>
<p>Putting it all together, imagine that I want to map a texture to a hemisphere.  The texture is projected from the XY plan.  Here&#8217;s how I would call the above routines to accomplish that:</p>
<pre>    // Generate new texcoords based on OBJECT_LINEAR algorithm
    // We are going to put the data right back into the Mesh's UV array.
    // (pDef is a pointer to an object with the SPODMesh* _pMesh.)
    pDef-&gt;texGenObjectLinearInPlace(btVector3(1,0,0), btVector3(0,1,0));
    // Normalize the UV coords such that the texture wraps all the way around.
    reBoxVertices(pDef-&gt;uvArray(), pDef-&gt;mesh()-&gt;psUVW[0].nStride, pDef-&gt;numVertices(),
                                   pDef-&gt;mesh()-&gt;psUVW[0].n, btVector4(0,0,0,0), btVector4(1,1,1,1));
    // Re-load the VBO since we've changed the data
    pDef-&gt;loadVBO();</pre>
<h2>Additional Texturing Resources</h2>
<p><strong>Cube Mapping</strong></p>
<p><a title="Cube mapping description." href="http://developer.nvidia.com/object/cube_map_ogl_tutorial.html" target="_blank" title="Cube mapping description.">http://developer.nvidia.com/object/cube_map_ogl_tutorial.html</a> (Uses OpenGL extensions not available to us, but explains the process.)</p>
<p><a title="More cube mapping references." href="http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&amp;Number=247684" target="_blank" title="More cube mapping references.">http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&amp;Number=247684</a></p>
<p><strong>Spherical Mapping<br />
</strong></p>
<p><a title="Spherical mapping information." href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=23" target="_blank" title="Spherical mapping information.">http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=23</a></p>
<p><strong>Bump Mapping Tutorial</strong></p>
<p><a title="Bump mapping tutorial." href="http://www.paulsprojects.net/tutorials/simplebump/simplebump.html" target="_blank" title="Bump mapping tutorial.">http://www.paulsprojects.net/tutorials/simplebump/simplebump.html</a></p>
<p><strong>Sky Boxes in Blender</strong></p>
<p><a title="How to build a skybox in Blender." href="http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Build_a_skybox" target="_blank" title="How to build a skybox in Blender.">http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Build_a_skybox</a></p>
<p><strong>Texture Sources</strong></p>
<p><a title="A library of textures, most free." href="http://www.cgtextures.com/" target="_blank" title="A library of textures, most free.">http://www.cgtextures.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/06/opengl-es-texture-mapping-for-iphone-oolong-powervr/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Blender to POD for Oolong</title>
		<link>http://www.BluMtnWerx.com/blog/2009/03/blender-to-pod-for-oolong/</link>
		<comments>http://www.BluMtnWerx.com/blog/2009/03/blender-to-pod-for-oolong/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 17:21:23 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Blender]]></category>
		<category><![CDATA[Oolong]]></category>
		<category><![CDATA[OpenGL-ES]]></category>
		<category><![CDATA[PowerVR]]></category>

		<guid isPermaLink="false">http://www.BluMtnWerx.com/blog/?p=38</guid>
		<description><![CDATA[For those of you who, like me, are just getting started developing with OpenGL-ES for the iPhone, one of the challenges is building some meshes to work with.  This post gives some pointers on using the open source Blender tool for your 3D modeling.]]></description>
			<content:encoded><![CDATA[<p>For those of you who, like me, are just getting started developing with OpenGL-ES for the iPhone, one of the challenges is building some meshes to work with.  If you don&#8217;t have lots of money to spend on the real &quot;pro&quot; tools, you&#8217;ll want to check out <a title="Link to Blender web site." href="http://www.blender.org/" target="_blank" title="Link to Blender web site.">Blender</a> (<a title="Link to Blender web site." href="http://www.blender.org/" target="_blank" title="Link to Blender web site.">http://www.blender.org</a> ).  Blender is a feature-rich, but somewhat hard to learn, open-source 3D modeling and animation environment.  It even has integrated physics simulation and scripting.  To get up to speed on Blender, I highly recommend the <a title="Link to Wikibooks web site." href="http://www.wikibooks.org/" target="_blank" title="Link to Wikibooks web site.">Wikibooks</a> tutorial <a title="Link to Blender tutorial." href="http://en.wikibooks.org/wiki/Blender_3D/Noob_to_Pro" target="_blank" title="Link to Blender tutorial.">Blender 3D: Noob to Pro</a> .  Once you face the Blender GUI for the first time, you&#8217;ll be very thankful for this grand effort at a tutorial!</p>
<p>Before I go on, I need to state that I&#8217;m a real noob myself and my needs at this point only include the creation of some meshes that I&#8217;m going to import into my application and then manage entirely there.  I haven&#8217;t yet had a need or chance to try out boned meshes or any of the animation features.  That being said, here are a few guidelines for developing your meshes in Blender with the intenion of importing them into an <a title="Link to Oolong web site." href="http://oolongengine.com/" target="_blank" title="Link to Oolong web site.">Oolong</a> (<a title="Link to PowerVR SDK web site." href="http://www.imgtec.com/powervr/insider/powervr-sdk.asp" target="_blank" title="Link to PowerVR SDK web site.">PowerVR</a> ) application as POD files.</p>
<ul>
<li>Go ahead and create your meshes in Blender, but recognize that rendering is going to be performed in your application, so don&#8217;t spend a lot of time trying to get it to look &quot;just right&quot; in the Blender renderer.</li>
<li>You can set up initial light and camera locations in Blender.  These are imported in the POD file.</li>
<li>Create and apply your materials in Blender.  Materials will be imported in the POD file (although I can&#8217;t find the Emission component yet.)</li>
<li>Note that meshes with different materials on different faces will be split up into multiple meshes (with a single parent mesh.)  For instance, a cube with a different material on each face will be split up into 6 different meshes, one for each face.  Each of these &quot;child&quot; meshes will have a pointer to the parent node.  More on how to deal with this in Oolong later.</li>
<li>Right now, I&#8217;m applying textures to textured surfaces as place-holders only.  This ensures that the UV coordinates are included in the interleaved vertex data.  In Oolong, textures are imported from PVR files, and I haven&#8217;t yet figured out a path from Blender texture to PVR.  If you can help out with this, please chime in!  The result is that you will have to figure out the right texture settings through experimentation.</li>
</ul>
<p>Once you have your meshes built, you&#8217;ll want to do the export/import dance to get to POD.  Right now, it appears that the best path is from Blender to Collada 1.4 (via the Blender Export menu) then from Collada to POD via the PowerVR Collada2POD tool.  (Collada2POD is in the utilities folder of the PowerVR SDK distribution.)  Sorry, I couldn&#8217;t find a Mac OS-X version of the SDK, so I have to use a Windows PC for this step.  Here are the settings I&#8217;ve come up with for the export and import.</p>
<h2>Export to Collada 1.4 Settings</h2>
<ul>
<li>Set the geometry type to triangles.</li>
<li>Don&#8217;t set anything else.  I tried messing with the &quot;UV Image Materials&quot; but didn&#8217;t find that useful.</li>
</ul>
<p>That&#8217;s all.</p>
<h2>Collada2POD Settings</h2>
<ul>
<li>Under geometry options select (not all of these may be required, I didn&#8217;t experiment with dropping any out.):
<ul>
<li>Normals</li>
<li>Vertex Colors</li>
<li>Mapping Channels</li>
<li>Flip V</li>
<li>Interleave Vectors</li>
</ul>
</li>
<li>PowerVR documentation recommends sorted, indexed, triangle strips for performance, so I turned on
<ul>
<li>Sort vertices with PVRTTriStrip</li>
<li>Indexed Triangle List</li>
</ul>
</li>
<li>I haven&#8217;t selected anything special in the Vertex vector formats.</li>
<li>The resulting POD file can be automatically opened in PVR Shaman for examination by simply setting up the path on the Post-Export tab.</li>
</ul>
<p>I used the Shadowing example as the template for how to load POD and PVR texture files.  Here are a few notes on what I&#8217;ve discovered:</p>
<ul>
<li>A &quot;SPODNode&quot; is created for each instance of a mesh, the camera and light, and each parent node (for composite meshes.)  The Node has a link to it&#8217;s defining mesh, a transform, and a link to it&#8217;s SPODMaterial.</li>
<li>A &quot;SPODMesh&quot; is created for each mesh and contains the interleaved, indexed, vertex data.</li>
<li>You can draw the children of  &quot;composite&quot; nodes ad-hoc if you like, because the GetWorldMatrix( ) methods automatically multiply by the parent&#8217;s transform matrix.  However, if you&#8217;re doing physics, you&#8217;ll want to treat them as a unit (a single btCollisionShape for the composite node.)</li>
<li>As mentioned before the Emission component of materials doesn&#8217;t come through, so I&#8217;m having handle that manually in my application.</li>
<li>Again, I haven&#8217;t figured out how to get textures directly from Blender to PVR.  I&#8217;m handling them separately.  Create your texture externally, use it in Blender and convert it to PVR for use in your application and fiddle to get things right.  (If you&#8217;ve got a better way, please tell us noobs about it!)</li>
<li>April 24, 2009 &#8212; Discovered that if you have a material assigned to an object, and you have also assigned materials to faces, but the material assigned to the object is not used on any of the faces, the Collada exporter will crash.  Make sure that all materials assigned to an object in blender are actually used.  Delete any that are unused before attempting to export.</li>
</ul>
<p>Note that there has been some recent discussion of this same topic on the Oolong mailing list, so I really recommend getting hooked up to that.  In particular, there is someone there working on a direct Blender reader (into the ModelPOD structures), and mention of a blender reader in the Bullet physics toolkit.  So, there may be more direct methods of using your Blender models in Oolong soon.</p>
<p>I&#8217;d really like to thank Wolfgang Engel, the PowerVR folks, the Bullet Physics team, and the rest of the Oolong contributors.  My early efforts are showing excellent performance on the device and I&#8217;m having a blast with the programming.  I don&#8217;t know where things are headed next for Oolong, but it can only get better!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.BluMtnWerx.com/blog/2009/03/blender-to-pod-for-oolong/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

