Cocos3D

Why are you here??
 
Visit the new, shinier, and vastly improved Cocos3D website, instead!!


[bw_floater]

[bw_paypal_donation component=”” purpose=”cocos3d”]

[/bw_floater]

Cocos3D is a sophisticated, yet intuitive and easy-to-use, 3D application development framework for iOS, Android and OSX platforms. With Cocos3D, you can build sophisticated, dynamic 3D games and applications using Objective-C.

Cocos3D is a companion to Cocos2D, a popular framework for building iOS, Android and OSX games and applications that play out in 2D (or 2.5D isometric projection).

Cocos3D adds to this a full 3D modelling space, including 3D mesh models, perspective projection cameras, materials, and lighting. With Cocos3D, you can populate your world with 3D models exported from 3D editors such as Blender, 3ds Max, or Cheetah3D, combined with models you create dynamically in your Objective-C code. And users can interact with your 3D objects through touch events and gestures.

Both Cocos3D and Cocos2D are built on top of the OpenGL ES frameworks that runs on all iOS devices, and both are written in the native Objective-C familiar to all iOS developers. With Cocos3D, you can effortlessly create a full 3D game or application without getting into the nitty-gritty needs of the OpenGL ES state machine, and without having to switch over to C or C++, as required by most other 3D frameworks.

Cocos3D Features

  • Build 3D apps for iOS devices, Android devices, or Mac computers running OSX. The same 3D  content and game logic will run unchanged under iOS, Android, or Mac OSX.
  • Use OpenGL programmable pipelines for sophisticated GLSL shader rendering, or use OpenGL fixed pipelines for simpler configurable rendering.
  • Supports OpenGL ES 2.0 or OpenGL ES 1.1 on iOS and Android devices, and OpenGL on Mac OSX.
  • Seamless integration with Cocos2D. Rendering of all 3D model objects occurs within a special Cocos2D layer, which fits seamlessly into the Cocos2D node hierarchy, allowing 2D nodes such as controls, labels, and health bars to be drawn under, over, or beside 3D model objects. With this design, 2D objects, 3D objects, and sound can interact with each other to create a rich, synchronized audio-visual experience.
  • Seamless integration with the iOS UIViewController framework.
  • Pluggable loading framework for 3D models exported from familiar 3D editors such as Blender, 3ds Max or Cheetah3D, or through industry standard 3D object files such as Collada or PowerVR POD, or even from your own customized object file formats.
  • Loading 3D models, textures and GLSL shaders can be performed on a background thread while the  scene is being displayed, and automatically added to the scene when loading is complete.
  • 3D models can be selected and positioned by touch events and gestures, allowing intuitive user  interaction with the objects in the 3D world.
  • 3D models can include animation sequences, with full or fractional animation, in multiple tracks. Animation tracks can be blended together, and cross-fading actions can be used to smoothly transition between tracks.
  • 3D model objects can be arranged in sophisticated structural assemblies, allowing child objects  to be moved and oriented relative to their parent structure.
  • 3D models and assemblies can be easily duplicated. Each duplicated model can be independently  controlled, animated, colored, or textured. But fear not, underlying mesh data is shared between  models. You can quickly and easily create swarming hordes to populate your 3D world, without  worrying about device memory limitations.
  • 3D models, cameras, and lighting can be manipulated and animated using familiar Cocos2D Actions,  allowing you to quickly and easily control the dynamics of your 3D world, in a familiar, and easy-to-use programming paradigm.
  • 3D objects can be covered with dynamic materials and textures to create rich, realistic imagery.
  • Multi-texturing and bump-mapped textures are available, allowing you to create sophisticated surface effects.
  • Vertex skinning, also often referred to as bone rigging, allowing soft-body meshes to be realistically deformed based on the movement of an underlying skeleton constructed of bones and joints.
  • Automatic shadowing of models using shadow volumes.
  • Collision detection between nodes.
  • Ray-casting for nodes intersected by a ray, and the local location of intersection on a node or mesh, right down to the exact mesh intersection location and face.
  • The 3D camera supports both perspective and orthographic projection options.
  • Objects can dynamically track other objects as they move around the world. The 3D camera can dynamically point towards an object as it moves, and other objects can dynamically point  towards the camera as it moves.
  • Lighting effects include multiple lights, attenuation with distance, spotlights, and fog effects.
  • Mesh data can be shared between 3D objects, thereby saving precious device memory.
  • Mesh data can freely, and automatically, use OpenGL vertex buffer objects to improve performance  and memory management.
  • Culling of 3D objects outside of the camera frustum is automatic, based on pluggable, customizable object bounding volumes.
  • Automatic ordering and grouping of 3D objects minimizes OpenGL state changes and improves  rendering performance. Pluggable sorters allow easy customization of object sorting, ordering,  and grouping for optimal application performance.
  • Rendering to texture for dynamic textures within a scene, or to create sophisticated post-processing effects.
  • Automatic rendering of the scene to an environment map texture, to create automatic environment  reflections and refractions.
  • Integrated particle systems:
    • 3D point particles provide efficient but sophisticated particle effects.
    • 3D mesh particles allow particles to be created from any 3D mesh template (eg- spheres,  cones, boxes, POD models, etc).
  • Automatic OpenGL state machine shadowing means that the OpenGL functions are invoked only when a  state really has changed, thereby reducing OpenGL engine calls, and increasing OpenGL throughput.
  • Sophisticated performance metrics API and tools collect real-time application drawing and updating  performance statistics, for logging or real-time display.
  • Sophisticated math library eliminates the need to use OpenGL ES function calls for matrix mathematics.
  • Fully documented API written entirely in familiar Objective-C. No need to switch to C or C++ to work with 3D components.
  • Extensive logging framework to trace program execution, including all OpenGL ES function calls.
  • Includes demo applications and Xcode templates to get you up and running quickly.

Fantastic! Where Can I Get Me Some of That?

Screenshot from cocos3d Hello World Application
A screenshot from the cocos3d Application template, showing a 3D take on the traditional ‘hello, world’ application.

You can download Cocos3D 2.0 from github. It is distributed under an MIT license, which makes it free for you to use in your projects. However, if you find this code is useful, please remember to make a donation above to help us fund the ongoing development and support of frameworks such as this.

Once downloaded, unzip the file and follow the instructions in the README document to run the install-cocos3d script from an OSX Terminal session. Since Cocos3D is a companion to Cocos2D, you will also need to download the latest version of Cocos2D before running the installation script.

Once installed, it’s easy to get your first working Cocos3D application up and running. Open Xcode, create a new project using one of the Cocos3D Application templates, and then simply build and run it to produce a 3D take on the traditional ‘hello, world‘ application.

In addition, the Cocos3D distribution contains two Xcode workspaces, cocos3d-iOS and cocos3d-OSX, where you can build and run several demo apps. These include the CC3DemoMashUp app, a more sophisticated sample of what’s possible with Cocos3D. These demos are your best source of understanding about what is possible with Cocos3D, and how to work with the framework.

Learning Cocos3D