Preparation for Lesson 7 Lesson 7 is focused on particle systems, compute shaders, and geometry shaders. For smooth lesson, review: • Remember the high-school physics: rigid body motion, forces acting on a rigid body and how they affect its acceleration, velocity, and position (this knowledge is not mandatory for the lesson, but it will help you with understanding the simulation we will do). • Think about how to render a point as a billboard - a textured quad that is always facing the viewer. • Remember Shader Storage Buffer Objects (SSBO) from the 4. lesson, we will use them again. Go through project 7 in the study materials. Focus on: • In this lesson, we will simulate a motion of thousands of particles. The code contains the initialization of their position and velocity, CPU - GPU transfer of their data, and their rendering. Project 7 also includes the following stuff, which has not been tought yet and which will be discussed at the lecture: • Compute shaders: nbody.compute.glsl, nbody_shared.compute.glsl, and functions glMemoryBarrier and glDispatchCompute. • Geometry shaders: particle .textured.*'.glsl Příprava na 7. cvičení Na sedmém cvičení budeme probírat časticové systémy, compute shadery a geometry shadery. Pro hladký průběh cvičení si zopakujte a připravte: • Vzpomeňte si ze školy z fyziky na mechaniku hmotného bodu, zejména na to, jak spolu souvisí síla působící na hmotný bod a zrychlení tohoto bodu, a také jak simulovat pohyb hmotného bodu, který má nějakou rychlost a zrychlení. (Tato znalost není nutná pro toto cvičení, ale lépe pochopíte prováděnou simulaci.) • Popřemýšlejte, jak vykreslit bod jako billboard, tedy jako otexturovaný čtverec, který je vždy natočen k pozorovateli. • Vzpomeňte si na Shader Storage Buffer Objects (SSBO) ze 4. cvičení, opět je budeme používat. 1 Projděte si projekt Cv7 ve studijních materiálech. Zaměřte se zejména na: • Ve cvičení budeme simulovat pohyb tisícovek částic. V kódu proto najdete mj. inicializaci poloh a rychlostí těchto částic, přenos dat mezi CPU a OpenGL, a kreslení těchto částic. Ve Cv7 jsou navíc tyto věci, které ještě nebyly probrány a které budou probrány na přednášce: • Compute shadery: nbody.compute.glsl, nbody.shared_compute.glsl a funkce glMemoryBarrier a glDispatchCompute. • Geometry shadery: particle_textured_* .glsl 2