Graphics Programming Workshop

2,425 views

Published on

For this workshop hosted my Stella Tran (@stella) and myself: https://www.eventbrite.com/e/graphics-programming-workshop-tickets-18945777330

Published in: Software
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,425
On SlideShare
0
From Embeds
0
Number of Embeds
135
Actions
Shares
0
Downloads
70
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Graphics Programming Workshop

  1. 1. Graphics Programming Workshop Stephanie Hurlburt
  2. 2. Before I start talking…  Download Cinder  https://libcinder.org/download  Windows users: download Visual Studio  https://www.visualstudio.com/products/visual-studio-community-vs  Mac users: download XCode  https://developer.apple.com/xcode/download/
  3. 3. What is graphics programming?  SIGGRAPH 2015 Technical Papers https://www.youtube.com/watch?v=XrYkEhs2FdA
  4. 4. What is graphics programming?  Cinder Creative Coding https://www.youtube.com/watch?v=uq1HetZMdfc
  5. 5. What is graphics programming?  Oculus Medium https://www.youtube.com/watch?v=IreEK-abHio
  6. 6. Get into a good headspace  These concepts will feel confusing and new  Some of them still feel confusing to me, and I get paid to do this!  Get used to not knowing a lot, but taking advantage of small pieces you do know to build something great now  Be patient, relax, be nice to yourself, have fun!
  7. 7. Get into a good headspace  This workshop was meant to give you a taste of what it’s like to do low-level graphics  I purposefully will not dive too deep into any subjects. We’re aiming to understand high level concepts, and enough to build something beautiful fast while still coding in C++/OpenGL  It’s how I learned graphics– just diving into a big low-level codebase, and figuring things out as I go
  8. 8. What is graphics programming?  Graphics programmers ask:  How are graphics processed on my computer?  How do GPUs work?  What else can we use the GPU for?  What isn’t possible now in graphics, and how can we make it possible?
  9. 9. What’s a Graphics Processor Unit (GPU)?  It’s hardware made with drawing images in mind!  The CPU sends it data needed for drawing  Much, much more parallelized than the CPU  This does come with downsides!  It’s good for things other than graphics, too!
  10. 10. What is OpenGL?  It allows you to tell your GPU what to do, in C  Clear the screen, set up the camera, start drawing, go!  OpenGL is just a standard. It tells the world what should be possible on GPUs.  It’s up to the GPU manufacturers to implement the standard.  You may have heard of GLSL  Part of the OpenGL ecosystem  Gives us control over shading, a particular part of graphics processing
  11. 11. What’s my job description?  I’m a Graphics Engineer  I build a graphics engine with C++/OpenGL  Part coding and making things work, part research and constantly learning
  12. 12. Why do I love graphics programming?  Graphics programming is a vastly unexplored new medium for art.  The more you know about graphics programming, the more possibilities you can unleash  In digital art  In computing!  It’s like solving math puzzles and getting rewarded by doing something never before possible in art.  It’s like one big, really complicated, mind-blowingly powerful paintbrush!  I can collaborate with a lot of fields– GPUs are used for lots of things!  Mathematics can be an important part of innovating in graphics, and I love math. I can get paid to do math.
  13. 13. Let’s do a sample together, to get started.
  14. 14. About Cinder  We’re not using direct C++/OpenGL, we’re using C++/Cinder.  Cinder is built on top of OpenGL– all Cinder calls turn into OpenGL calls.  It’s a great way to learn OpenGL while building things quickly
  15. 15. Particle Sphere  Go to the directory Cinder is installed in, then Samples -> _openGL -> ParticleSphereGPU. Open your project in your desired IDE.  Build and run the project.  You should see a beautiful rainbow particle system.  Try clicking it and moving your mouse.  Let’s talk about how to modify this.
  16. 16. Particle Sphere: Control the movement of your particles  Open up GPUSphereParticles -> Assets -> particleUpdate.vs  This little piece of code controls all of those seemingly complex movements in the particle system, and is processed completely on the GPU.  This code runs on every particle in your particle system, calculating its position (That’s a lot of particles!)  This particle system is a perfect candidate for GPU processing– none of the particles need to know about each others’ existence, so each particle’s simulation can be safely processed in parallel.  Try to understand what the math is doing by changing the values and seeing what happens.  Save the file, then close and rerun your app to see how it’s changed  Try changing dt2 to 0.0f, for example! Oh no!
  17. 17. Particle Sphere: Create the initial particle layout  Open ParticleSphereGPUApp.cpp  We first create an array of Particles  Each particle contains the properties we modified our vertex shader  They’re initially created on the CPU (in the Particle struct at the top of this file), and that’s where their initial positions are set.  Then set the initial positions of all our particles.  That for loop’s math makes our particles start as a sphere! Try modifying values to see how it works.  Be sure to rebuild and rerun your project each time you make a change.
  18. 18. Particle Sphere: Future Work  That’s really it when it comes to modifying this project’s core functionality.  Notice the comments around fragment shaders: we’re only using a special vertex shader– the fragment shader only sets each particle to Cinder’s default rainbow palette.  Try simply modifying the values discussed in the previous slides. You can make a completely different visual just by doing that.  Try adding a custom fragment shader.  Try adding more physics properties like gravity to the particles, and think about what you’d need to do to enable collision.  Try out the ParticleSphereCPU samples, and the other particle samples.
  19. 19. Now try some other samples!  I’m here to help, and we can go through a few more together too.  I want you to feel comfortable playing around with this unknown code so you can see that you can make interesting visualizations, and then learn more and figure out what you need to be learning to do more!  Remember that there are lots of great resources online too that can help. It’s common to frequently look up references to figure out how things are working.  Have fun!!!
  20. 20. Great graphics programming resources  Graphics Codex  http://graphicscodex.com/  Real Time Rendering  http://www.realtimerendering.com/  Learn OpenGL  http://learnopengl.com/  Making WebGL Dance  http://acko.net/files/fullfrontal/full frontal/webglmath/online.html  3D Graphics Tutorial  http://petercollingridge.appspot.co m/3D-tutorial  Modern OpenGL Tutorials  http://ogldev.atspace.co.uk  Interactive 3D Graphics  https://www.udacity.com/course/int eractive-3d-graphics--cs291  A Trip Through the Graphics Pipeline  https://fgiesen.wordpress.com/2011 /07/09/a-trip-through-the-graphics- pipeline-2011-index/  The Book of Shaders  http://patriciogonzalezvivo.com/201 5/thebookofshaders/
  21. 21. Great graphics programming resources  GLSL Sandbox  http://glslsandbox.com/  Shadertoy  https://www.shadertoy.com/  Getting Started with Cinder  https://libcinder.org/docs/guides/op engl/index.html  Processing Tutorials  https://processing.org/tutorials/  OpenFrameworks Tutorials  http://openframeworks.cc/tutorials/  SIGGRAPH Papers  http://kesen.realtimerendering.com/  Immersive Linear Algebra  http://immersivemath.com/ila/index .html  Render Hell 2.0  http://simonschreibt.de/gat/renderh ell/  OpenGL SuperBible  http://www.openglsuperbible.com/

×