Chapitre 1 fini
This commit is contained in:
parent
2aaae09fb9
commit
88b38a21e7
BIN
Images/Fractal_fire.jpg
Normal file
BIN
Images/Fractal_fire.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
BIN
Images/Fractal_terrain_texture.jpg
Normal file
BIN
Images/Fractal_terrain_texture.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 254 KiB |
BIN
Images/Pink_red_liquid_using_perlin_noise_+_bump_+_coloring.png
Normal file
BIN
Images/Pink_red_liquid_using_perlin_noise_+_bump_+_coloring.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 489 KiB |
@ -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é.
|
nœud de grille coïncide avec le vecteur de gradient aléatoire précalculé.
|
||||||
\newline
|
\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]
|
\begin{lstlisting}[caption=Implantation du bruit de Perlin en C++, label=code:perlin]
|
||||||
// Function to linearly interpolate between a0 and a1
|
// Function to linearly interpolate between a0 and a1
|
||||||
// Weight w should be in the range [0.0, 1.0]
|
// Weight w should be in the range [0.0, 1.0]
|
||||||
function lerp(float a0, float a1, float w) {
|
float lerp(float a0, float a1, float w) {
|
||||||
return (1.0 - w)*a0 + w*a1;
|
return (1.0 - w)*a0 + w*a1;
|
||||||
}
|
|
||||||
|
// as an alternative, this slightly faster equivalent formula can be used:
|
||||||
// Computes the dot product of the distance and gradient vectors.
|
// return a0 + w*(a1 - a0);
|
||||||
function dotGridGradient(int ix, int iy, float x, float y) {
|
}
|
||||||
|
|
||||||
// Precomputed (or otherwise) gradient vectors at each grid node
|
// Computes the dot product of the distance and gradient vectors.
|
||||||
extern float Gradient[IYMAX][IXMAX][2];
|
float dotGridGradient(int ix, int iy, float x, float y) {
|
||||||
|
|
||||||
// Compute the distance vector
|
// Precomputed (or otherwise) gradient vectors at each grid node
|
||||||
float dx = x - (float)ix;
|
extern float Gradient[IYMAX][IXMAX][2];
|
||||||
float dy = y - (float)iy;
|
|
||||||
|
// Compute the distance vector
|
||||||
// Compute the dot-product
|
float dx = x - (float)ix;
|
||||||
return (dx*Gradient[iy][ix][0] + dy*Gradient[iy][ix][1]);
|
float dy = y - (float)iy;
|
||||||
}
|
|
||||||
|
// Compute the dot-product
|
||||||
// Compute Perlin noise at coordinates x, y
|
return (dx*Gradient[iy][ix][0] + dy*Gradient[iy][ix][1]);
|
||||||
function perlin(float x, float y) {
|
}
|
||||||
|
|
||||||
// Determine grid cell coordinates
|
// Compute Perlin noise at coordinates x, y
|
||||||
int x0 = floor(x);
|
float perlin(float x, float y) {
|
||||||
int x1 = x0 + 1;
|
|
||||||
int y0 = floor(y);
|
// Determine grid cell coordinates
|
||||||
int y1 = y0 + 1;
|
int x0 = int(x);
|
||||||
|
int x1 = x0 + 1;
|
||||||
// Determine interpolation weights
|
int y0 = int(y);
|
||||||
// Could also use higher order polynomial/s-curve here
|
int y1 = y0 + 1;
|
||||||
float sx = x - (float)x0;
|
|
||||||
float sy = y - (float)y0;
|
// Determine interpolation weights
|
||||||
|
// Could also use higher order polynomial/s-curve here
|
||||||
// Interpolate between grid point gradients
|
float sx = x - (float)x0;
|
||||||
float n0, n1, ix0, ix1, value;
|
float sy = y - (float)y0;
|
||||||
n0 = dotGridGradient(x0, y0, x, y);
|
|
||||||
n1 = dotGridGradient(x1, y0, x, y);
|
// Interpolate between grid point gradients
|
||||||
ix0 = lerp(n0, n1, sx);
|
float n0, n1, ix0, ix1, value;
|
||||||
n0 = dotGridGradient(x0, y1, x, y);
|
n0 = dotGridGradient(x0, y0, x, y);
|
||||||
n1 = dotGridGradient(x1, y1, x, y);
|
n1 = dotGridGradient(x1, y0, x, y);
|
||||||
ix1 = lerp(n0, n1, sx);
|
ix0 = lerp(n0, n1, sx);
|
||||||
value = lerp(ix0, ix1, sy);
|
n0 = dotGridGradient(x0, y1, x, y);
|
||||||
|
n1 = dotGridGradient(x1, y1, x, y);
|
||||||
return value;
|
ix1 = lerp(n0, n1, sx);
|
||||||
}
|
value = lerp(ix0, ix1, sy);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
@ -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}
|
BIN
rapport.pdf
BIN
rapport.pdf
Binary file not shown.
15
rapport.tex
15
rapport.tex
@ -13,10 +13,10 @@
|
|||||||
\newcommand{\guillemets}[1]{\og #1\fg{}} % [1]: nbr arg
|
\newcommand{\guillemets}[1]{\og #1\fg{}} % [1]: nbr arg
|
||||||
|
|
||||||
\lstset{
|
\lstset{
|
||||||
language=C, % Code langugage
|
language=C++, % Code langugage
|
||||||
basicstyle=\ttfamily, % Code font, Examples: \footnotesize, \ttfamily
|
basicstyle=\ttfamily, % Code font, Examples: \footnotesize, \ttfamily
|
||||||
% keywordstyle=\color{OliveGreen}, % Keywords font ('*' = uppercase)
|
% keywordstyle=\color{OliveGreen}, % Keywords font ('*' = uppercase)
|
||||||
% commentstyle=\color{gray}, % Comments font
|
% commentstyle=\color{gray}, % Comments font
|
||||||
% numbers=left, % Line nums position
|
% numbers=left, % Line nums position
|
||||||
% numberstyle=\tiny, % Line-numbers fonts
|
% numberstyle=\tiny, % Line-numbers fonts
|
||||||
% stepnumber=1, % Step between two line-numbers
|
% stepnumber=1, % Step between two line-numbers
|
||||||
@ -45,6 +45,7 @@ Université d'Aix-Marseille}
|
|||||||
|
|
||||||
\newpage
|
\newpage
|
||||||
\tableofcontents
|
\tableofcontents
|
||||||
|
\input{Parties/résumé.tex}
|
||||||
\newpage
|
\newpage
|
||||||
\section*{Introduction}
|
\section*{Introduction}
|
||||||
\input{Parties/intro.tex}
|
\input{Parties/intro.tex}
|
||||||
@ -55,8 +56,8 @@ Université d'Aix-Marseille}
|
|||||||
\input{Parties/chap1_1.tex}
|
\input{Parties/chap1_1.tex}
|
||||||
\subsection{Applications}
|
\subsection{Applications}
|
||||||
\input{Parties/chap1_2.tex}
|
\input{Parties/chap1_2.tex}
|
||||||
\subsection{Limitations}
|
% \subsection{Limitations}
|
||||||
\input{Parties/chap1_3.tex}
|
% \input{Parties/chap1_3.tex}
|
||||||
|
|
||||||
\section{Bruit de Gabor}
|
\section{Bruit de Gabor}
|
||||||
\input{Parties/chap2_intro.tex}
|
\input{Parties/chap2_intro.tex}
|
||||||
@ -77,8 +78,8 @@ Université d'Aix-Marseille}
|
|||||||
\section{Conclusion}
|
\section{Conclusion}
|
||||||
\input{Parties/conclusion.tex}
|
\input{Parties/conclusion.tex}
|
||||||
|
|
||||||
\section{Résumé}
|
% \section{Résumé}
|
||||||
\input{Parties/résumé.tex}
|
% \input{Parties/résumé.tex}
|
||||||
|
|
||||||
\section{Bibliographie}
|
\section{Bibliographie}
|
||||||
\end{document}
|
\end{document}
|
||||||
|
Reference in New Issue
Block a user