SlideShare uma empresa Scribd logo
1 de 17
WRITING 3D
APPLICATIONS USING
 RUBY-PROCESSING
          Preston Lee
     http://prestonlee.com
      http://openrain.com
processing.org

Toolkit for creating visualization.
Primitive shapes, positioning, lighting etc.
3D accelerated. (OpenGL rendering available.)
Java.
Both web and desktop friendly.
!processing.org

An application framework. No design assumptions.
Object-oriented. BYOOOA&D.
Physics
Ruby.
Nutshell.
Processing provides you with a canvas and powerful
primitives, but is in no way a “framework” like Shoes or
Rails.
IMHO, processing is less quirky that the other popular
Ruby GUI toolkits.
Using processing effectively requires design effort
specific to your application.
A general GUI framework
 application architecture.
A main application/rendering/animation loop that
executes constantly.
CPU intense stuff in separate threads to keep rendering
fast.
I/O (such as network and disk access) in separate
threads to prevent render loop from blocking.
HID events arrive asynchronously and outside of the
rendering loop. Thread safety a must!
ruby-processing
`sudo gem install ruby-processing`
Ruby bindings to processing.
Comes bundled with a version of jruby. You do not
need a separate jruby installation.
`rp5 watch my_sketch.rb` to run your app.
Best API documentation from processing.org. (Java)
Great 3D use cases.
Data visualization: many things make more sense in
a 3D world, since we live in one and all.
Simulation: real or non-real-time execution.
Computation sometimes distributed across the tubes
with local visualization.
Gaming: real-time visuals with asynchronous state I/
O, as well as asynchronous input, graphics and audio.
3D-Specific Challenges
Underutilized: several   Positioning/
high learning curves.    Orientation: Tracking
                         where everything is at a
Math: strong spatial     given point in time.
reasoning skills are a
must.                    Input: click detection
                         and other HID.
Performance: models
sometimes need lots of   Collision detection.
CPU before rendering.
                         Physics.
Bundled examples.


`cd ruby-processing/samples/processing_app/3D`
`rp5 run form/brick_tower.rb`
`rp5 run typography/kinetic_type.rb`
Important missing stuff.
Camera position and object creation position do not
need to be the same. (The camera is fixed in the 3D
examples.)
No sophisticated movement or input methods.
Everything is in the animation (“main”) thread. This
does not scale for real applications.
Rendering is based on CPU time, not wall clock time.
Physics should be the same against a wall clock
regardless of CPU speed.
No I/O. All real-world apps have I/O.
Let’s build something cool!
A star field simulator      Behave according to
and twitter feed reader.   wall-clock time, even
                           on a crappy system.
All visible objects have
their own thread, and      First person shooter-
can execute arbitrary      style movement.
code such as I/O and       Keyboard and mouse
heavy computation.         both act on wall-clock
(Implausible on the 1.8    time.
                                       Note: object
MRI. JVM FTW!)                         execution
                                       parallelization is not
                                       needed for most
                                       games, but is useful to
                                       distribute CPU load
                                       across nodes.
Modeling the system.
The universe is a giant cube (the “clipping plane”).
The sun is stationary with start whizzing by it.
Camera position in discrete X, Y, Z integers.
Orientation as a vector and rotation.
Starting position and velocity (speed + direction)
for each star.
Stars get “recycled” when they leave the clipping
plane.
Every star has a thread.
Each star instance has its own thread that updates
its own state based on wall-clock time. It calculates its
own state when it can.
Stars move according to their own parameters. (We
could make them talk to each other, too.)
Let’s test our model in a simple ruby script..
`jruby starfield_1_model.rb`
Now let’s use ruby-
 processing to visualize it.

Callbacks: setup and draw.
Create our models and start the rendering loop.
Finally, we’ll add control.

Callbacks: key_pressed, key_released, mouse_dragged,
mouse_released etc.
Math: calculate ∆translation and ∆rotation for camera
on each render based on ∆time.
Move: apply movement to the camera on each draw.
Let’s add some I/O.


Bundled twitter gem dependent on native C code.
API call to pull in friends and their tweets.
Fill the twiverse with information asynchronously
Packaging as an OS X app.


`rp5 app my_sketch.rb`
Drop in your own icon.
Shove it all in a .dmg.

Mais conteúdo relacionado

Mais procurados

Developing Next-Generation Games with Stage3D (Molehill)
Developing Next-Generation Games with Stage3D (Molehill) Developing Next-Generation Games with Stage3D (Molehill)
Developing Next-Generation Games with Stage3D (Molehill) Jean-Philippe Doiron
 
【Unite 2017 Tokyo】Unityを使ったNintendo Switch™ローンチタイトル制作~スーパーボンバーマンRの事例~
【Unite 2017 Tokyo】Unityを使ったNintendo Switch™ローンチタイトル制作~スーパーボンバーマンRの事例~【Unite 2017 Tokyo】Unityを使ったNintendo Switch™ローンチタイトル制作~スーパーボンバーマンRの事例~
【Unite 2017 Tokyo】Unityを使ったNintendo Switch™ローンチタイトル制作~スーパーボンバーマンRの事例~Unite2017Tokyo
 
GDC16: Arbitrary amount of 3D data running on Gear VR by Vinh Truong
GDC16: Arbitrary amount of 3D data running on Gear VR by Vinh TruongGDC16: Arbitrary amount of 3D data running on Gear VR by Vinh Truong
GDC16: Arbitrary amount of 3D data running on Gear VR by Vinh TruongUmbra Software
 
[HTML5 BUG] 2,5D RTS Game in HTML5 by Dawid Lijewski
[HTML5 BUG] 2,5D RTS Game in HTML5 by Dawid Lijewski[HTML5 BUG] 2,5D RTS Game in HTML5 by Dawid Lijewski
[HTML5 BUG] 2,5D RTS Game in HTML5 by Dawid LijewskiBeMyApp
 
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobbmochimedia
 
Optimizing Unity games for mobile devices
Optimizing Unity games for mobile devicesOptimizing Unity games for mobile devices
Optimizing Unity games for mobile devicesBruno Cicanci
 
[UniteKorea2013] Memory profiling in Unity
[UniteKorea2013] Memory profiling in Unity[UniteKorea2013] Memory profiling in Unity
[UniteKorea2013] Memory profiling in UnityWilliam Hugo Yang
 
The next frontier: WebGL and WebVR
The next frontier: WebGL and WebVRThe next frontier: WebGL and WebVR
The next frontier: WebGL and WebVRCodemotion
 
Deep Learning on iOS #360iDev
Deep Learning on iOS #360iDevDeep Learning on iOS #360iDev
Deep Learning on iOS #360iDevShuichi Tsutsumi
 
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来Unite2017Tokyo
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法Unite2017Tokyo
 
【Unite 2017 Tokyo】Unity UI最適化ガイド 〜ベストプラクティスと新機能
【Unite 2017 Tokyo】Unity UI最適化ガイド 〜ベストプラクティスと新機能【Unite 2017 Tokyo】Unity UI最適化ガイド 〜ベストプラクティスと新機能
【Unite 2017 Tokyo】Unity UI最適化ガイド 〜ベストプラクティスと新機能Unity Technologies Japan K.K.
 
Umbra 3 IGDA & Unity Presentation
Umbra 3 IGDA & Unity PresentationUmbra 3 IGDA & Unity Presentation
Umbra 3 IGDA & Unity PresentationThomas Puha
 
UI Debugging - Cocoaheads Dresden (English)
UI Debugging - Cocoaheads Dresden (English)UI Debugging - Cocoaheads Dresden (English)
UI Debugging - Cocoaheads Dresden (English)Pit Garbe
 
【Unite 2017 Tokyo】最適化をする前に覚えておきたい技術
【Unite 2017 Tokyo】最適化をする前に覚えておきたい技術【Unite 2017 Tokyo】最適化をする前に覚えておきたい技術
【Unite 2017 Tokyo】最適化をする前に覚えておきたい技術Unity Technologies Japan K.K.
 

Mais procurados (18)

Unity project
Unity projectUnity project
Unity project
 
Developing Next-Generation Games with Stage3D (Molehill)
Developing Next-Generation Games with Stage3D (Molehill) Developing Next-Generation Games with Stage3D (Molehill)
Developing Next-Generation Games with Stage3D (Molehill)
 
【Unite 2017 Tokyo】Unityを使ったNintendo Switch™ローンチタイトル制作~スーパーボンバーマンRの事例~
【Unite 2017 Tokyo】Unityを使ったNintendo Switch™ローンチタイトル制作~スーパーボンバーマンRの事例~【Unite 2017 Tokyo】Unityを使ったNintendo Switch™ローンチタイトル制作~スーパーボンバーマンRの事例~
【Unite 2017 Tokyo】Unityを使ったNintendo Switch™ローンチタイトル制作~スーパーボンバーマンRの事例~
 
GDC16: Arbitrary amount of 3D data running on Gear VR by Vinh Truong
GDC16: Arbitrary amount of 3D data running on Gear VR by Vinh TruongGDC16: Arbitrary amount of 3D data running on Gear VR by Vinh Truong
GDC16: Arbitrary amount of 3D data running on Gear VR by Vinh Truong
 
[HTML5 BUG] 2,5D RTS Game in HTML5 by Dawid Lijewski
[HTML5 BUG] 2,5D RTS Game in HTML5 by Dawid Lijewski[HTML5 BUG] 2,5D RTS Game in HTML5 by Dawid Lijewski
[HTML5 BUG] 2,5D RTS Game in HTML5 by Dawid Lijewski
 
Cap
CapCap
Cap
 
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
 
VR Optimization Techniques
VR Optimization Techniques VR Optimization Techniques
VR Optimization Techniques
 
Optimizing Unity games for mobile devices
Optimizing Unity games for mobile devicesOptimizing Unity games for mobile devices
Optimizing Unity games for mobile devices
 
[UniteKorea2013] Memory profiling in Unity
[UniteKorea2013] Memory profiling in Unity[UniteKorea2013] Memory profiling in Unity
[UniteKorea2013] Memory profiling in Unity
 
The next frontier: WebGL and WebVR
The next frontier: WebGL and WebVRThe next frontier: WebGL and WebVR
The next frontier: WebGL and WebVR
 
Deep Learning on iOS #360iDev
Deep Learning on iOS #360iDevDeep Learning on iOS #360iDev
Deep Learning on iOS #360iDev
 
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
【Unite 2017 Tokyo】Unity UI最適化ガイド 〜ベストプラクティスと新機能
【Unite 2017 Tokyo】Unity UI最適化ガイド 〜ベストプラクティスと新機能【Unite 2017 Tokyo】Unity UI最適化ガイド 〜ベストプラクティスと新機能
【Unite 2017 Tokyo】Unity UI最適化ガイド 〜ベストプラクティスと新機能
 
Umbra 3 IGDA & Unity Presentation
Umbra 3 IGDA & Unity PresentationUmbra 3 IGDA & Unity Presentation
Umbra 3 IGDA & Unity Presentation
 
UI Debugging - Cocoaheads Dresden (English)
UI Debugging - Cocoaheads Dresden (English)UI Debugging - Cocoaheads Dresden (English)
UI Debugging - Cocoaheads Dresden (English)
 
【Unite 2017 Tokyo】最適化をする前に覚えておきたい技術
【Unite 2017 Tokyo】最適化をする前に覚えておきたい技術【Unite 2017 Tokyo】最適化をする前に覚えておきたい技術
【Unite 2017 Tokyo】最適化をする前に覚えておきたい技術
 

Semelhante a Writing 3D Applications Using ruby-processing

GPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaGPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaJanie Clayton
 
GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015Janie Clayton
 
GPU Programming 360iDev
GPU Programming 360iDevGPU Programming 360iDev
GPU Programming 360iDevJanie Clayton
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法Unity Technologies Japan K.K.
 
Gpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalGpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalJanie Clayton
 
Visibility Optimization for Games
Visibility Optimization for GamesVisibility Optimization for Games
Visibility Optimization for GamesUmbra
 
Visibility Optimization for Games
Visibility Optimization for GamesVisibility Optimization for Games
Visibility Optimization for GamesSampo Lappalainen
 
Introduction to html5 game programming with impact js
Introduction to html5 game programming with impact jsIntroduction to html5 game programming with impact js
Introduction to html5 game programming with impact jsLuca Galli
 
CUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesCUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesSubhajit Sahu
 
CNC plotter controlled using Android application
CNC plotter controlled using Android applicationCNC plotter controlled using Android application
CNC plotter controlled using Android applicationYuval Yoskovits
 
Distributed computing and hyper-parameter tuning with Ray
Distributed computing and hyper-parameter tuning with RayDistributed computing and hyper-parameter tuning with Ray
Distributed computing and hyper-parameter tuning with RayJan Margeta
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine OverviewSharad Mitra
 
Video Terminal Evolution and The Future of Browsers
Video Terminal Evolution and The Future of BrowsersVideo Terminal Evolution and The Future of Browsers
Video Terminal Evolution and The Future of BrowsersThomas Walker Lynch
 
Introduction to three.js & Leap Motion
Introduction to three.js & Leap MotionIntroduction to three.js & Leap Motion
Introduction to three.js & Leap MotionLee Trout
 
VisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_FinalVisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_FinalMasatsugu HASHIMOTO
 
Wp7 performance challenges
Wp7 performance challengesWp7 performance challenges
Wp7 performance challengesGergely Orosz
 
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...Johan Andersson
 
Web3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCIWeb3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCIVictor Porof
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computingArka Ghosh
 
jChampions JSR381 Visual recognition for java
jChampions   JSR381 Visual recognition for javajChampions   JSR381 Visual recognition for java
jChampions JSR381 Visual recognition for javaZoran Sevarac, PhD
 

Semelhante a Writing 3D Applications Using ruby-processing (20)

GPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf AtlantaGPU Programming: CocoaConf Atlanta
GPU Programming: CocoaConf Atlanta
 
GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015
 
GPU Programming 360iDev
GPU Programming 360iDevGPU Programming 360iDev
GPU Programming 360iDev
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
Gpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and MetalGpu Programming With GPUImage and Metal
Gpu Programming With GPUImage and Metal
 
Visibility Optimization for Games
Visibility Optimization for GamesVisibility Optimization for Games
Visibility Optimization for Games
 
Visibility Optimization for Games
Visibility Optimization for GamesVisibility Optimization for Games
Visibility Optimization for Games
 
Introduction to html5 game programming with impact js
Introduction to html5 game programming with impact jsIntroduction to html5 game programming with impact js
Introduction to html5 game programming with impact js
 
CUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesCUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : Notes
 
CNC plotter controlled using Android application
CNC plotter controlled using Android applicationCNC plotter controlled using Android application
CNC plotter controlled using Android application
 
Distributed computing and hyper-parameter tuning with Ray
Distributed computing and hyper-parameter tuning with RayDistributed computing and hyper-parameter tuning with Ray
Distributed computing and hyper-parameter tuning with Ray
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine Overview
 
Video Terminal Evolution and The Future of Browsers
Video Terminal Evolution and The Future of BrowsersVideo Terminal Evolution and The Future of Browsers
Video Terminal Evolution and The Future of Browsers
 
Introduction to three.js & Leap Motion
Introduction to three.js & Leap MotionIntroduction to three.js & Leap Motion
Introduction to three.js & Leap Motion
 
VisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_FinalVisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_Final
 
Wp7 performance challenges
Wp7 performance challengesWp7 performance challenges
Wp7 performance challenges
 
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
 
Web3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCIWeb3D - Semantic standards, WebGL, HCI
Web3D - Semantic standards, WebGL, HCI
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 
jChampions JSR381 Visual recognition for java
jChampions   JSR381 Visual recognition for javajChampions   JSR381 Visual recognition for java
jChampions JSR381 Visual recognition for java
 

Último

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Último (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Writing 3D Applications Using ruby-processing

  • 1. WRITING 3D APPLICATIONS USING RUBY-PROCESSING Preston Lee http://prestonlee.com http://openrain.com
  • 2. processing.org Toolkit for creating visualization. Primitive shapes, positioning, lighting etc. 3D accelerated. (OpenGL rendering available.) Java. Both web and desktop friendly.
  • 3. !processing.org An application framework. No design assumptions. Object-oriented. BYOOOA&D. Physics Ruby.
  • 4. Nutshell. Processing provides you with a canvas and powerful primitives, but is in no way a “framework” like Shoes or Rails. IMHO, processing is less quirky that the other popular Ruby GUI toolkits. Using processing effectively requires design effort specific to your application.
  • 5. A general GUI framework application architecture. A main application/rendering/animation loop that executes constantly. CPU intense stuff in separate threads to keep rendering fast. I/O (such as network and disk access) in separate threads to prevent render loop from blocking. HID events arrive asynchronously and outside of the rendering loop. Thread safety a must!
  • 6. ruby-processing `sudo gem install ruby-processing` Ruby bindings to processing. Comes bundled with a version of jruby. You do not need a separate jruby installation. `rp5 watch my_sketch.rb` to run your app. Best API documentation from processing.org. (Java)
  • 7. Great 3D use cases. Data visualization: many things make more sense in a 3D world, since we live in one and all. Simulation: real or non-real-time execution. Computation sometimes distributed across the tubes with local visualization. Gaming: real-time visuals with asynchronous state I/ O, as well as asynchronous input, graphics and audio.
  • 8. 3D-Specific Challenges Underutilized: several Positioning/ high learning curves. Orientation: Tracking where everything is at a Math: strong spatial given point in time. reasoning skills are a must. Input: click detection and other HID. Performance: models sometimes need lots of Collision detection. CPU before rendering. Physics.
  • 9. Bundled examples. `cd ruby-processing/samples/processing_app/3D` `rp5 run form/brick_tower.rb` `rp5 run typography/kinetic_type.rb`
  • 10. Important missing stuff. Camera position and object creation position do not need to be the same. (The camera is fixed in the 3D examples.) No sophisticated movement or input methods. Everything is in the animation (“main”) thread. This does not scale for real applications. Rendering is based on CPU time, not wall clock time. Physics should be the same against a wall clock regardless of CPU speed. No I/O. All real-world apps have I/O.
  • 11. Let’s build something cool! A star field simulator Behave according to and twitter feed reader. wall-clock time, even on a crappy system. All visible objects have their own thread, and First person shooter- can execute arbitrary style movement. code such as I/O and Keyboard and mouse heavy computation. both act on wall-clock (Implausible on the 1.8 time. Note: object MRI. JVM FTW!) execution parallelization is not needed for most games, but is useful to distribute CPU load across nodes.
  • 12. Modeling the system. The universe is a giant cube (the “clipping plane”). The sun is stationary with start whizzing by it. Camera position in discrete X, Y, Z integers. Orientation as a vector and rotation. Starting position and velocity (speed + direction) for each star. Stars get “recycled” when they leave the clipping plane.
  • 13. Every star has a thread. Each star instance has its own thread that updates its own state based on wall-clock time. It calculates its own state when it can. Stars move according to their own parameters. (We could make them talk to each other, too.) Let’s test our model in a simple ruby script.. `jruby starfield_1_model.rb`
  • 14. Now let’s use ruby- processing to visualize it. Callbacks: setup and draw. Create our models and start the rendering loop.
  • 15. Finally, we’ll add control. Callbacks: key_pressed, key_released, mouse_dragged, mouse_released etc. Math: calculate ∆translation and ∆rotation for camera on each render based on ∆time. Move: apply movement to the camera on each draw.
  • 16. Let’s add some I/O. Bundled twitter gem dependent on native C code. API call to pull in friends and their tweets. Fill the twiverse with information asynchronously
  • 17. Packaging as an OS X app. `rp5 app my_sketch.rb` Drop in your own icon. Shove it all in a .dmg.

Notas do Editor