Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
80 changes: 15 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,23 @@
# [Project 1: Noise](https://github.com/CIS-566-Fall-2022/hw01-fireball-base)

## Objective
## Name
Kevin Zhang, PennId: kzupenn, Penn#: 56877791

Get comfortable with using WebGL and its shaders to generate an interesting 3D, continuous surface using a multi-octave noise algorithm.
## Demo link
https://kzupenn.github.io/hw01-fireball/

## Getting Started
## Documentation

1. Fork and clone [this repository](https://github.com/CIS700-Procedural-Graphics/Project1-Noise).
Features of the project implemented

2. Copy your hw0 code into your local hw1 repository.
1. Perlin-based vertex and color modifiers. The fireball has a base ripple effect created from fBm with Perlin noise, which loops over time based on additional trig functions with u_Time input. The fireball will also slightly change its base color as a function of time regardless of user input.
2. Controls to customize various aspects of the fireball. Users can customize the base color of the fireball with rgb sliders. To customize the fireball, users can modify values that change the volatility (how fast flames rise and fall), explosivity (how far out flames can go), and flames color (how quickly the color gradients from the center to the edge) of the fireball. Users can also explore the music feature by uploading an mp3 file of their choice.
3. Music-based flames on the fireball. Audio from the user-uploaded mp3 file is played and parsed into a data array. This data array is then processed to add a multiplier to positions (additional vertex position modifiers) of the fire effects of the fireball, which are then passed into the shaders. Based on a value output by fBm Perlin noise on the position of the vertex, we select the corresponding index inside of the data array.

3. In the root directory of your project, run `npm install`. This will download all of those dependencies.
## Instructions to run
1. Use the RGB sliders to modify the base color of the fireball. It's not an exact 1-to-1 as I've encoded the fireball to enherently be a bit redder at the core and yellower at the tips.
2. You should now see a not-so-interesting rippling ball of your color choice. Click the upload button to upload a mp3 file to the website
3. Feel free to upload whatever you want– although I highly recommend Pitbull-Fireball in the spirit of the assignment. I've also included a folder of fire music samples in my submission in case you want some quick songs that work well on hand.
4. As the song is playing, you should see a bunch of waves appear from the fireball surface. You can tune the parameters of the flame as the song goes along with the provided sliders, such as turning up the volatility in soft parts or turning down the multiplier if the volume is too saturating.
5. Enjoy!

4. Do either of the following (but I highly recommend the first one for reasons I will explain later).

a. Run `npm start` and then go to `localhost:7000` in your web browser

b. Run `npm run build` and then go open `index.html` in your web browser

You should hopefully see the framework code with a 3D cube at the center of the screen!


## Developing Your Code
All of the JavaScript code is living inside the `src` directory. The main file that gets executed when you load the page as you may have guessed is `main.js`. Here, you can make any changes you want, import functions from other files, etc. The reason that I highly suggest you build your project with `npm start` is that doing so will start a process that watches for any changes you make to your code. If it detects anything, it'll automagically rebuild your project and then refresh your browser window for you. Wow. That's cool. If you do it the other way, you'll need to run `npm build` and then refresh your page every time you want to test something.

## Publishing Your Code
We highly suggest that you put your code on GitHub. One of the reasons we chose to make this course using JavaScript is that the Web is highly accessible and making your awesome work public and visible can be a huge benefit when you're looking to score a job or internship. To aid you in this process, running `npm run deploy` will automatically build your project and push it to `gh-pages` where it will be visible at `username.github.io/repo-name`.

## Setting up `main.ts`

Alter `main.ts` so that it renders the icosphere provided, rather than the cube you built in hw0. You will be writing a WebGL shader to displace its surface to look like a fireball. You may either rewrite the shader you wrote in hw0, or make a new `ShaderProgram` instance that uses new GLSL files.

## Noise Generation

Across your vertex and fragment shaders, you must implement a variety of functions of the form `h = f(x,y,z)` to displace and color your fireball's surface, where `h` is some floating-point displacement amount.

- Your vertex shader should apply a low-frequency, high-amplitude displacement of your sphere so as to make it less uniformly sphere-like. You might consider using a combination of sinusoidal functions for this purpose.
- Your vertex shader should also apply a higher-frequency, lower-amplitude layer of fractal Brownian motion to apply a finer level of distortion on top of the high-amplitude displacement.
- Your fragment shader should apply a gradient of colors to your fireball's surface, where the fragment color is correlated in some way to the vertex shader's displacement.
- Both the vertex and fragment shaders should alter their output based on a uniform time variable (i.e. they should be animated). You might consider making a constant animation that causes the fireball's surface to roil, or you could make an animation loop in which the fireball repeatedly explodes.
- Across both shaders, you should make use of at least four of the functions discussed in the Toolbox Functions slides.


## Noise Application

View your noise in action by applying it as a displacement on the surface of your icosahedron, giving your icosahedron a bumpy, cloud-like appearance. Simply take the noise value as a height, and offset the vertices along the icosahedron's surface normals. You are, of course, free to alter the way your noise perturbs your icosahedron's surface as you see fit; we are simply recommending an easy way to visualize your noise. You could even apply a couple of different noise functions to perturb your surface to make it even less spherical.

In order to animate the vertex displacement, use time as the third dimension or as some offset to the (x, y, z) input to the noise function. Pass the current time since start of program as a uniform to the shaders.

For both visual impact and debugging help, also apply color to your geometry using the noise value at each point. There are several ways to do this. For example, you might use the noise value to create UV coordinates to read from a texture (say, a simple gradient image), or just compute the color by hand by lerping between values.

## Interactivity

Using dat.GUI, make at least THREE aspects of your demo interactive variables. For example, you could add a slider to adjust the strength or scale of the noise, change the number of noise octaves, etc.

Add a button that will restore your fireball to some nice-looking (courtesy of your art direction) defaults. :)

## Extra Spice

Choose one of the following options:

- Background (easy-hard depending on how fancy you get): Add an interesting background or a more complex scene to place your fireball in so it's not floating in a black void
- Custom mesh (easy): Figure out how to import a custom mesh rather than using an icosahedron for a fancy-shaped cloud.
- Mouse interactivity (medium): Find out how to get the current mouse position in your scene and use it to deform your cloud, such that users can deform the cloud with their cursor.
- Music (hard): Figure out a way to use music to drive your noise animation in some way, such that your noise cloud appears to dance.

## Submission

- Update README.md to contain a solid description of your project
- Publish your project to gh-pages. `npm run deploy`. It should now be visible at http://username.github.io/repo-name
- Create a [pull request](https://help.github.com/articles/creating-a-pull-request/) to this repository, and in the comment, include a link to your published project.
- Submit the link to your pull request on Canvas.
Binary file added music_samples/Adele - Set Fire To The Rain.mp3
Binary file not shown.
Binary file added music_samples/Alicia Keys - Girl on Fire.mp3
Binary file not shown.
Binary file added music_samples/Initial D - Night Of Fire.mp3
Binary file not shown.
Binary file added music_samples/Katy Perry - Firework.mp3
Binary file not shown.
Binary file added music_samples/Linkin Park - Burn It Down.mp3
Binary file not shown.
Binary file added music_samples/Pitbull - Fireball.mp3
Binary file not shown.
Loading