Designing an Objective-C Framework about 3D       (to Rule Them All)        Raphael Sebbe       Twitter: @rsebbe
We all Enjoy Cocoa
Because it’s Smart & Elegant
Developers are UsersKeep that in mind when designing a framework
The Wonderful World of 3D OpenGL               Pixar’s PRMan           Direct X                   POV  Ogre               ...
What• A framework for building 3D apps / games,  for Mac & iOS• Common foundation for 3D• Specialized to talk to various l...
Conceptualizing (a bit)                App                         •   Computer Graphics                                  ...
Focus on FrameworksC3Node                 C3Scene        C3Renderer  C3Object                                 C3RenderManR...
Objects Talk TogetherValue   Sphere A1.7      Radius                         Cube B             Transform                 ...
Objects Talk TogetherValue   Sphere A1.7      Radius                          Cube B             Transform                ...
Coping with Diversity• Objective-C is high level• Sometimes, subclassing is your enemy• And then, categories are your frie...
Category UseCeed3D.framework             C3Sphere       C3MeshCeed3DGL.framework          +GL          +GLCeed3DRenderMan....
Focus on OpenGL• Modern OpenGL only (no legacy calls)• Support for OpenGL ES• Sophisticated Shader Definition
Focus on OpenGL• Modern OpenGL only (no legacy calls)• Support for OpenGL ES• Sophisticated Shader Definition         Ceed3...
Cocoa Interactions•   KVO / KVC: easy access to object inputs/outputs•   Core Image: CIImage used as textures, CIFilter as...
Examples!   sphere = [C3Sphere sphere];!   sphere.radius = 0.15;!   sphere.translation.z = 0.3;!!   C3GenericMaterial *mat...
Examples!   glRenderer = [C3GLRenderer new];!   glRenderer.scene = scene;!!   glView.viewer.camera = camera;!   glRenderer...
Demo
Demomesh = [C3Mesh meshWithAttributedString:@"" options:nil];
Availability• Work in progress• Low-level, stable parts will be released as  open source soon• We want to release more lat...
Thank you! Raphael SebbeTwitter: @rsebbe
Designing an Objective-C Framework about 3D
Designing an Objective-C Framework about 3D
Designing an Objective-C Framework about 3D
Designing an Objective-C Framework about 3D
Upcoming SlideShare
Loading in …5
×

Designing an Objective-C Framework about 3D

5,023 views

Published on

Blitz T

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
5,023
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
37
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Designing an Objective-C Framework about 3D

  1. 1. Designing an Objective-C Framework about 3D (to Rule Them All) Raphael Sebbe Twitter: @rsebbe
  2. 2. We all Enjoy Cocoa
  3. 3. Because it’s Smart & Elegant
  4. 4. Developers are UsersKeep that in mind when designing a framework
  5. 5. The Wonderful World of 3D OpenGL Pixar’s PRMan Direct X POV Ogre 3Delight Quesa Pixie Aqsis OSG VL Lucille DotC OpenSG LuxRender Mental Ray 3DKit
  6. 6. What• A framework for building 3D apps / games, for Mac & iOS• Common foundation for 3D• Specialized to talk to various libs / tools• Good Cocoa citizen
  7. 7. Conceptualizing (a bit) App • Computer Graphics Math Ceed3DGL Ceed3DRenderMan ... • 3D Data Representation(s) Ceed3D • Object Graph(s) •GL CeedMath Foundation Rendering Interfaces
  8. 8. Focus on FrameworksC3Node C3Scene C3Renderer C3Object C3RenderManRenderer C3ProceduralObject C3PixarRenderer C3Sphere C3AqsisRenderer ... C3GLRenderer C3GLView C3GeometricObject C3Mesh C3Geometry C3Buffer ... C3ParametricGeometry C3Light C3MeshGeometry C3Camera C3StreamGeometry C3Material C3SubdivisionGeometry
  9. 9. Objects Talk TogetherValue Sphere A1.7 Radius Cube B Transform Parent Transform Cube C Transform Size
  10. 10. Objects Talk TogetherValue Sphere A1.7 Radius Cube B Transform Parent Transform Cube C Transform Size Style Group 1 Style Group 2
  11. 11. Coping with Diversity• Objective-C is high level• Sometimes, subclassing is your enemy• And then, categories are your friend• Renderer interface & file read/write’s as categories of existing classes
  12. 12. Category UseCeed3D.framework C3Sphere C3MeshCeed3DGL.framework +GL +GLCeed3DRenderMan.framework +RenderMan +RenderMan +POV +Obj +3ds +Collada + ...
  13. 13. Focus on OpenGL• Modern OpenGL only (no legacy calls)• Support for OpenGL ES• Sophisticated Shader Definition
  14. 14. Focus on OpenGL• Modern OpenGL only (no legacy calls)• Support for OpenGL ES• Sophisticated Shader Definition Ceed3DGL • Thin Objective-C layer for OpenGLCeedGL Ceed3D • Encapsulates GL objects (texture, buffer, framebuffer, program, shader...)GL CeedMath • Defines Draw Commands
  15. 15. Cocoa Interactions• KVO / KVC: easy access to object inputs/outputs• Core Image: CIImage used as textures, CIFilter as post process filters on rendered image• Quartz: NSBezierPath used as geometry source, incl. glyphs• Quartz Composer: Ceed3D should be able to render as a QCPlugin, QC outputs usable as Ceed3D textures• Grand Central Dispatch: Parallelism for computations• OpenCL: Geometry filters
  16. 16. Examples! sphere = [C3Sphere sphere];! sphere.radius = 0.15;! sphere.translation.z = 0.3;!! C3GenericMaterial *material = [C3GenericMaterial genericMaterial];! material.diffuseColor = [C3Color redColor];! material.environmentImage = [C3Image imageWithContentsOfFile:! ! [[NSBundle mainBundle] pathForResource:@"skydome_1024" ofType:@"jpg"]];! sphere.defaultMaterial = material;!! [scene addNode:sphere];!! NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect! ! xRadius:0.1 yRadius:0.1];! [path appendBezierPath:[[NSBezierPath bezierPathWithOvalInRect:! ! NSInsetRect(rect, 0.15, 0.15)] bezierPathByReversingPath]];!! id options = [NSDictionary dictionaryWithObjectsAndKeys:C3DOUBLE(0.02),! ! kC3MeshOptionAdaptiveSubdivisionDistance, nil];!! C3MeshGeometry *geom = [C3MeshGeometry meshGeometryWithBezierPath:path! ! options:options];! C3Mesh *mesh = [C3Mesh mesh]; [mesh insertObject:geom inGeometriesAtIndex:0];! [scene addNode:mesh];
  17. 17. Examples! glRenderer = [C3GLRenderer new];! glRenderer.scene = scene;!! glView.viewer.camera = camera;! glRenderer.viewers = [NSArray arrayWithObject:glView.viewer];! pixarRenderer = [C3PixarRenderer new];! pixarRenderer.outputDirectoryPath = @"~/Render/Ceed3D-pixar";! pixarRenderer.scene = scene;! aqsisRenderer = [C3AqsisRenderer new];! aqsisRenderer.outputDirectoryPath = @"~/Render/Ceed3D-aqsis";! aqsisRenderer.scene = scene; // .... [glRenderer render];
  18. 18. Demo
  19. 19. Demomesh = [C3Mesh meshWithAttributedString:@"" options:nil];
  20. 20. Availability• Work in progress• Low-level, stable parts will be released as open source soon• We want to release more later...• Stay tuned!
  21. 21. Thank you! Raphael SebbeTwitter: @rsebbe

×