Surface and Volumetric Data Rendering and Visualization LAB: Blender integration with OpenGL/Qt Massimo Mauro Department of Information Engineering Faculty of Engineering University of Brescia Via Branze, 38 25231 Brescia - ITALY 1
Contents Blender import/export file formats Simple exporting to opengl Libraries and applications for 3D models 2
Blender import/export file formats Import: Collada (.dae) StanfordPLY (.ply) Wavefront (.obj) Stl (.stl) 3D Studio (.3ds) X3D Extensible 3D (.x3d/.wrl) Motion Capture (.bvh) Scalable Vector Graphics (.svg) Export: Collada (.dae) StanfordPLY (.ply) Wavefront (.obj) Stl (.stl) 3D Studio (.3ds)obj) X3D Extensible 3D (.x3d) Autodesk FBX (.fbx) 3
COLLADA COLLADA is an intermediate file format for the interoperability of different 3D computer graphic applications. COLLADA defines an XML schema that enables 3D applications to freely exchange 3D models without loss of information, enabling multiple software packages to be combined. <?xml version="1.0" encoding="utf-8"?> <COLLADA xmlns="http://www.collada.org/2005/11/colladaschema" version="1.4.1"> <asset> <contributor> <author>blender User</author> <authoring_tool>blender 2.63.0r45996 </authoring_tool> </contributor> <created>2012-05-26t12:15:18</created> <modified>2012-05-26t12:15:18</modified> <unit name="meter" meter="1"/> <up_axis>z_up</up_axis> </asset> <library_cameras> <camera id="camera-camera" name="camera"> <optics> <technique_common> <perspective> <xfov sid="xfov">49.13434</xfov> <aspect_ratio>1.777778</aspect_ratio> <znear sid="znear">0.1</znear> <zfar sid="zfar">100</zfar> </perspective> </technique_common> </optics> </camera> 4
Stanford PLY (.ply) PLY is a computer file format known as the Polygon File Format or the Stanford Triangle Format. The format was principally designed to store three dimensional data from 3D scanners.there are two versions of the file format, one in ASCII, the other in binary. A variety of properties can be stored including: color and transparency, surface normals, texture coordinates and data confidence values. ply format ascii 1.0 comment Created by Blender 2.63 (sub 0) - www.blender.org, source file: 'cow.blend' element vertex 17412 property float x property float y property float z property float nx property float ny property float nz element face 5804 property list uchar uint vertex_indices end_header 0.605538 0.183122-0.472278 0.313823 0.575926-0.754867 0.605538 0.183122-0.472278 0.313823 0.575926-0.754867 0.649223 0.129700-0.494875 0.313823 0.575926-0.754867 0.601082 0.105512-0.533343 0.313823 0.575926-0.754867 0.649223 0.129700-0.494875 0.169981 0.456875-0.873139 0.691245 0.056948-0.524762 0.169981 0.456875-0.873139 0.652035 0.037958-0.542332 0.169981 0.456875-0.873139 0.551138 0.035353-0.528984-0.240006 0.110934-0.964412 0.531619 0.086293-0.518267-0.240006 0.110934-0.964412 0.601082 0.105512-0.533343-0.240006 0.110934-0.964412 0.531619 0.086293-0.518267-0.267775 0.401942-0.875637 0.507370 0.153473-0.480014-0.267775 0.401942-0.875637 5
A simple opengl exporter The Blender.ply exporter is simplified, i.e. It doesn't support all the features of the Stanford file format. Vertices, faces and normals are specified; Colors, texture, and other informations are not specified. 6
Exercise Import COLLADA model 'cow.dae', export it in the.ply format, and load it into the 'collisions' opengl scene (see 'main.cpp' and 'plyloader.cpp' for how to do this). Assignment 7: Export the Blender model of the Assignment 6 into the opengl scene of the Assignment 5. 7
Libraries and applications Open Asset Import Library (short name: Assimp): a portable open source library written in C++ to import various well-known 3D model formats in a uniform manner. GLC Player: a cross-platform application for viewing 3D models which uses Qt and opengl libraries. Source code available. MeshLab: a cross-platform application for viewing and editing 3D models which uses Qt and opengl libraries. Source code available. Very complete and with a lot of features. Look at it! 8
Exercise Download MeshLab and/or GLC Player. Install it, load a model (e.g. 'cow.dae'), and explore the application. 9