eBook - ePub
Fluid Engine Development
Doyub Kim
This is a test
Partager le livre
- 300 pages
- English
- ePUB (adapté aux mobiles)
- Disponible sur iOS et Android
eBook - ePub
Fluid Engine Development
Doyub Kim
DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations
Ă propos de ce livre
From the splash of breaking waves to turbulent swirling smoke, the mathematical dynamics of fluids are varied and continue to be one of the most challenging aspects in animation. Fluid Engine Development demonstrates how to create a working fluid engine through the use of particles and grids, and even a combination of the two. Core algorithms are explained from a developer's perspective in a practical, approachable way that will not overwhelm readers. The Code Repository offers further opportunity for growth and discussion with continuously changing content and source codes. This book helps to serve as the ultimate guide to navigating complex fluid animation and development.
- Explains how to create a fluid simulation engine from scratch
- Offers an approach that is code-oriented rather than math-oriented, allowing readers to learn how fluid dynamics works with code, with downloadable code available
-
- Explores various kinds of simulation techniques for fluids using particles and grids
-
- Discusses practical issues such as data structure design and optimizations
-
- Covers core numerical tools including linear system and level set solvers
-
Foire aux questions
Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier lâabonnement ». Câest aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via lâapplication. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă la bibliothĂšque et Ă toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode dâabonnement : avec lâabonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă 12 mois dâabonnement mensuel.
Quâest-ce que Perlego ?
Nous sommes un service dâabonnement Ă des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă toute une bibliothĂšque pour un prix infĂ©rieur Ă celui dâun seul livre par mois. Avec plus dâun million de livres sur plus de 1 000 sujets, nous avons ce quâil vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Ăcouter sur votre prochain livre pour voir si vous pouvez lâĂ©couter. Lâoutil Ăcouter lit le texte Ă haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, lâaccĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Fluid Engine Development est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă Fluid Engine Development par Doyub Kim en format PDF et/ou ePUB ainsi quâĂ dâautres livres populaires dans Computer Science et Computer Graphics. Nous disposons de plus dâun million dâouvrages Ă dĂ©couvrir dans notre catalogue.
Informations
1
Basics
This chapter covers the most fundamental topics that will frequently be referred throughout the book. Before anything else, a minimal fluid simulator will be introduced to bring a basic understanding of building a simulation engine. We will then start building up the foundation for mathematical and geometric operations that are commonly used in this book. This chapter will also introduce the core concept of computer-generated animations as well as its implementation, which will then evolve to the physics-based animation. Finally, the general process of simulating fluid flow will be introduced at the end of the chapter.
1.1 Hello, Fluid Simulator
In this section, we will implement the simplest fluid simulator in this book. This minimal example may not be fancy at all, but it will cover the key ideas of the fluid simulation engine end to end. It is self-contained and doesnât depend on any other libraries other than the standard C++ library. Although we havenât discussed anything about the simulation yet, this hello-world example will provide insight into how to approach to writing a fluid engine code. The only prerequisite for this is some knowledge on C++ and ability to run it on a command line tool.
The goal of the example is simple: to simulate two traveling waves in a one-dimensional (1D) world as shown in Figure 1.1. When a wave hits the end of the container, it will bounce back to the opposite direction.
1.1.1 Defining State
Before we start coding, letâs step back and imagine how we would describe the waves with code. At a given time, a wave is located at a certain position with its speed as illustrated in Figure 1.2. Also, as shown in the figure, the final shape can be constructed from the wave positions. Therefore, the state of a wave can be simply defined as a pair of the position and speed. Since we have two waves, we need two pairs of states. Extremely straightforward and nothing complicated.
Now, itâs time to code. Consider the following:
1 #include <cstdio>
2
3 int main() {
4 double x = 0.0;
5 double y = 1.0;
6 double speedX = 1.0;
7 double speedY = -0.5;
8
9 return 0;
10 }
2
3 int main() {
4 double x = 0.0;
5 double y = 1.0;
6 double speedX = 1.0;
7 double speedY = -0.5;
8
9 return 0;
10 }
When naming the variables, we will use alphabet X to refer one of the waves and Y for the other one. As shown in the code, initial values assigned to those variables tells us that wave X starts from the left-most side (
double x = 0.0
) and travels to the right with 1.0 speed (double speedX = 1.0
). Similarly, wave Y starts from the right-most side (double y = 1.0
) and travels to the left (double speedY = -0.5
) with half of the magnitude of wave Xâs speed.Note that we just defined the âstatesâ of the simulation using four variables which are the most crucial steps when designing a simulation engine. In this particular example, the simulation state is simply the positions and velocities of the waves. But in more complex systems, it is often implemented with a collection of various data structures. Thus, identifying the quantity to keep track of during the simulation is very important as well as finding the right data structure for storing the data. Once the data model is defined, the next step is to bring the life to it.
1.1.2 Computing Motion
To make the waves move, we should define âtimeâ. See the following code:
1 #include <cstdio>
2
3 int main() {
4 double x = 0.0;
5 double y = 1.0;
6 double speedX = 1.0;
7 double speedY = -0.5;
8
9 const int fps = 100;
10 const double timeInterval = 1.0 / fps;
11
12 for (int i = 0; i < 1000; ++i) {(*@\label{code:basics-hello-simplewave1}@*)
13 // Update waves
14 }
15 return 0;
16 }
2
3 int main() {
4 double x = 0.0;
5 double y = 1.0;
6 double speedX = 1.0;
7 double speedY = -0.5;
8
9 const int fps = 100;
10 const double timeInterval = 1.0 / fps;
11
12 for (int i = 0; i < 1000; ++i) {(*@\label{code:basics-hello-simplewave1}@*)
13 // Update waves
14 }
15 return 0;
16 }
The code just got doubled in length, but still quite straightforward. First of all, the new variable
fps
stands for âframes-per-second (FPS)â, and it defines how many frames we want to draw for each second. If we invert this FPS value, which is seconds-per-frame, we get time interval between the two frames. Ri...