Chapitre 1 fini

This commit is contained in:
DylanVsn 2019-12-03 17:53:29 +01:00
parent 2aaae09fb9
commit 88b38a21e7
7 changed files with 82 additions and 55 deletions

BIN
Images/Fractal_fire.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

View File

@ -33,53 +33,56 @@ Cela a pour effet que le gradient de la fonction de bruit résultante à chaque
nœud de grille coïncide avec le vecteur de gradient aléatoire précalculé.
\newline
Voici le pseudo-code de l'implantation du bruit de Perlin à 2 dimensions:
Voici une version C++ de l'implantation du bruit de Perlin à 2 dimensions:
\begin{lstlisting}[caption=Implantation du bruit de Perlin en pseudo-code, label=code:perlin]
// Function to linearly interpolate between a0 and a1
// Weight w should be in the range [0.0, 1.0]
function lerp(float a0, float a1, float w) {
return (1.0 - w)*a0 + w*a1;
}
// Computes the dot product of the distance and gradient vectors.
function dotGridGradient(int ix, int iy, float x, float y) {
// Precomputed (or otherwise) gradient vectors at each grid node
extern float Gradient[IYMAX][IXMAX][2];
// Compute the distance vector
float dx = x - (float)ix;
float dy = y - (float)iy;
// Compute the dot-product
return (dx*Gradient[iy][ix][0] + dy*Gradient[iy][ix][1]);
}
// Compute Perlin noise at coordinates x, y
function perlin(float x, float y) {
// Determine grid cell coordinates
int x0 = floor(x);
int x1 = x0 + 1;
int y0 = floor(y);
int y1 = y0 + 1;
// Determine interpolation weights
// Could also use higher order polynomial/s-curve here
float sx = x - (float)x0;
float sy = y - (float)y0;
// Interpolate between grid point gradients
float n0, n1, ix0, ix1, value;
n0 = dotGridGradient(x0, y0, x, y);
n1 = dotGridGradient(x1, y0, x, y);
ix0 = lerp(n0, n1, sx);
n0 = dotGridGradient(x0, y1, x, y);
n1 = dotGridGradient(x1, y1, x, y);
ix1 = lerp(n0, n1, sx);
value = lerp(ix0, ix1, sy);
return value;
}
\begin{lstlisting}[caption=Implantation du bruit de Perlin en C++, label=code:perlin]
// Function to linearly interpolate between a0 and a1
// Weight w should be in the range [0.0, 1.0]
float lerp(float a0, float a1, float w) {
return (1.0 - w)*a0 + w*a1;
// as an alternative, this slightly faster equivalent formula can be used:
// return a0 + w*(a1 - a0);
}
// Computes the dot product of the distance and gradient vectors.
float dotGridGradient(int ix, int iy, float x, float y) {
// Precomputed (or otherwise) gradient vectors at each grid node
extern float Gradient[IYMAX][IXMAX][2];
// Compute the distance vector
float dx = x - (float)ix;
float dy = y - (float)iy;
// Compute the dot-product
return (dx*Gradient[iy][ix][0] + dy*Gradient[iy][ix][1]);
}
// Compute Perlin noise at coordinates x, y
float perlin(float x, float y) {
// Determine grid cell coordinates
int x0 = int(x);
int x1 = x0 + 1;
int y0 = int(y);
int y1 = y0 + 1;
// Determine interpolation weights
// Could also use higher order polynomial/s-curve here
float sx = x - (float)x0;
float sy = y - (float)y0;
// Interpolate between grid point gradients
float n0, n1, ix0, ix1, value;
n0 = dotGridGradient(x0, y0, x, y);
n1 = dotGridGradient(x1, y0, x, y);
ix0 = lerp(n0, n1, sx);
n0 = dotGridGradient(x0, y1, x, y);
n1 = dotGridGradient(x1, y1, x, y);
ix1 = lerp(n0, n1, sx);
value = lerp(ix0, ix1, sy);
return value;
}
\end{lstlisting}

View File

@ -0,0 +1,23 @@
Due à sa grande flexibilité, ce générateur de bruit peut être utilisé pour
créer plusieurs types d'éléments comme les nuages, le feu, la fumée…
Voici Quelques exemples d'images produites depuis cette méthode:
\begin{figure}
\centering
\includegraphics[width=0.9\linewidth]{Images/Fractal_fire.jpg}
\caption{Feu généré à partir du bruit de Perlin}
\label{img:feu-perlin}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.9\linewidth]{Images/Fractal_terrain_texture.jpg}
\caption{Terrain généré à partir du bruit de Perlin}
\label{img:terrain-perlin}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.9\linewidth]{Images/Pink_red_liquid_using_perlin_noise_+_bump_+_coloring.png}
\caption{Surface organique générée à partir du bruit de Perlin et travaillée avec application texture et lumière}
\label{img:organique-perlin}
\end{figure}

Binary file not shown.

View File

@ -13,10 +13,10 @@
\newcommand{\guillemets}[1]{\og #1\fg{}} % [1]: nbr arg
\lstset{
language=C, % Code langugage
language=C++, % Code langugage
basicstyle=\ttfamily, % Code font, Examples: \footnotesize, \ttfamily
% keywordstyle=\color{OliveGreen}, % Keywords font ('*' = uppercase)
% commentstyle=\color{gray}, % Comments font
% keywordstyle=\color{OliveGreen}, % Keywords font ('*' = uppercase)
% commentstyle=\color{gray}, % Comments font
% numbers=left, % Line nums position
% numberstyle=\tiny, % Line-numbers fonts
% stepnumber=1, % Step between two line-numbers
@ -45,6 +45,7 @@ Université d'Aix-Marseille}
\newpage
\tableofcontents
\input{Parties/résumé.tex}
\newpage
\section*{Introduction}
\input{Parties/intro.tex}
@ -55,8 +56,8 @@ Université d'Aix-Marseille}
\input{Parties/chap1_1.tex}
\subsection{Applications}
\input{Parties/chap1_2.tex}
\subsection{Limitations}
\input{Parties/chap1_3.tex}
% \subsection{Limitations}
% \input{Parties/chap1_3.tex}
\section{Bruit de Gabor}
\input{Parties/chap2_intro.tex}
@ -77,8 +78,8 @@ Université d'Aix-Marseille}
\section{Conclusion}
\input{Parties/conclusion.tex}
\section{Résumé}
\input{Parties/résumé.tex}
% \section{Résumé}
% \input{Parties/résumé.tex}
\section{Bibliographie}
\end{document}