CSCI 441 - Computer Graphics

Fall 2016 - Assignment 6 - Summon the Wizard



|   Home |  Syllabus |  Assignments |  Leaderboard |  Schedule |  Resources   |
This assignment is due by Friday, November 21, 2016 by 11:59pm.

After some aimless wandering, you eventually find the man seated in a small hut. You scan the hut and notice the entire room is filled with books. The books are organized along shelves from the floor to the ceiling and you assume there is some system in place. The man closes the book he is reading, picks it up, and places it back on the shelf. He has yet to say a word to you but you follow him around the room as he slowly scans the shelves.

A few moments later, he stops and you almost bump into him as you had stopped paying attention. He realizes your lack of focus. He flicks his wrist and across the room, a book begins emitting flames. He motions for you to take the book. As you get closer, you can feel the warmth of the flames and pull your hand back. The man again motions towards the book, flicks his wrist and the flames go out. You take the book and bring it to the table. The cover reads
Beginner Magic
for
Demigods


Part I - Cast A Spell On You


At last the man speaks.
"For you to grow strong and become powerful, you must learn our ways. You were chosen to to sit atop Olympus because you already possess the necessary abilities to wield magic. You see, you are a Demigod. You must harness your power and overwhelm the enemy. When you are ready, we will send you back and it will be time for you to conquer Olympus. There is not much time before the battle will surely take place."
The book opens itself and flips many pages. When the pages stop, you begin reading the page that it is open to.
For this assignment, you will write an OpenGL/GLUT application that simulates several uses of Particle Systems. You can use your Assignment 5 submission as the starting point. To facilitate this task, you will need to create a Particle class that contains all the necessary information an individual Particle would need to keep track of (position, velocity, etc.). You will also need to create a ParticleSystem class that contains a list of Particles. We can then apply a set of rules to a ParticleSystem and every Particle in that System will follow those rules. One these rules must be gravity. Gravity should be a force that is acting on all Particles in a System.

There will be two different Particle System implementations that you can choose to implement. The particle system must be placed into a Skybox using textures. Your Hero will be able to move around your world as well to see where and how the particle system is running. The two particle system options are: (1) Fountains (2) Rain.

System I - Fountains

The first Particle System will simulate a fountain effect. A fountain can be used to simulate many different components in a graphics application (water fountain, sparks/fireworks). A fountain works by having a source point and a cone bounding the initial direction particles can move. Your particles will all have initial position equal to the System's source point (the emitter) and an initial velocity within the System's cone. Once a particle is spawned, it will continue along its current trajectory acting only under the force of gravity. The particle will continue to act under gravity for the lifespan of the particle. Once the particle's lifespan has elapsed, the particle will die, be deleted, and no longer a part of the System.

For this Particle System, each Particle will be a textured transparent quad. Choose a suitable image to texture on each quad and supply an alpha-channel texture as well for transparency on the quad. The textured quads should also exhibit a Billboarding effect: no matter what direction the user views the particles from, the particles should be rotated to face the user. Remember, the particles must also be drawn back-to-front from the user's point-of-view to display the textured transparent quads correctly using blending.

The actual context of the particle system is up to you. It could be a water fountain, fireworks, sparks, etc. Ensure the context is clear and choose an appropriate texture for each particle.

The rules for the Particle System will be specified by a control file. A single line will represent a single Particle System. At a minimum, each line must specify the following information:
  1. Type of particle system (more below)
  2. Particle system source point
  3. Particle system max cone angle
  4. Particle system min & max initial velocity
  5. Particle system min & max lifespan
  6. Particle system spawn rate (# particles / second)
These parameters will create bounds for the initial values of a Particle. A new Particle should have a random value within these bounds. Since it is possible to have multiple types of particle systems (like in the next part) so the first parameter on the line, the type of system, will dictate the expected input for the rest of the line. See example following the next description. Provide an example control file demonstrating the fountain particle system.

System II - Rain

To simulate rain, we must first create a source (emitter) for the rain to fall from. Create a cloud that will be the holder for the Particle System. Each drop of rain will be an individual Particle. Again, the Particle System will have an emitter and this point will be the center of the cloud. When a particle is spawned, it will have an initial position within the bounding box of the cloud. Once a rain drop is spawned, it will act with gravity as an outside force. The rain drop must also be a textured transparent quad.

Once a rain drop hits the ground plane, it could then create a splash. At this point, the rain drop particle will die and spawn a new particle system. This new Particle System should be very similar to the fountain from System I above. The splash system will move in a cone acting only under gravity and once the splash droplets hit the ground plane, they will die as well.

In addition to the rain drops falling under gravity, they could also be acting under wind. The wind should have a direction and a speed. This additional force will be acting on the rain drops. Give the wind a source point, a direction, and a bounding box. If rain enters this bounding box, then it will be blown accordingly. Think of a fan sitting in space, if rain falls in front of the fan then they will be blown. You must be able to have some sort of debug visual that can be toggled on and off to display where the wind volume is. Hint: this is a basic collision detection test.

Just as above, the Particle System specifications will be done via control file. A single line represents a single Particle System. The line should contain the necessary information for the rain Particle System (cloud position, cloud size, rain drops / second, wind speed, wind direction, wind position, etc). It can now be possible to have a single control file that specifies both a rain particle system and a fountain particle system in the same application. An example control file that specifies both particle systems is below:

# System Type, System Inputs
# Type = F, Fountain. System Inputs:
#    Emitter X, Y, Z, Cone Angle, Min Velocity, Max Velocity, Min Life, Max Life,
#    Spawn Rate
# Type = R, Rain. System Inputs:
#    Emitter X, Y, Z, Emitter Width, Depth, Min Velocity, Max Velocity, Spawn Rate
F, 0, 10, 0, 15, 2.5, 4, 4, 6, 10
R, 5, 25, 10, 4, 7, 0.2, 0.4, 15

This will place a fountain particle system at (0, 10, 0) which corresponds to the tip of a fountain object in our scene. There also is a rain cloud centered at (5, 25, 10) that is dropping rain in the distance. Provide an example control file demonstrating the rain particle system.

While you only need to create one particle system, you are encouraged to implement both particle systems. The description above and setup makes each particle system static, i.e. it has a fixed location and is always running. To truly become a wizard and harness your power as a Demigod, also let your Hero create a particle system at his current location on command (using some keyboard input). The particle system should then completely die after some time as the spell is finished casting.

For extra credit, create a third type of particle system that implements flocking. It is up to you to determine in what context flocking will take place. One possible scenario is a set of birds moving towards the lead bird (this case can be thought of in 2D). A second scenario is a school of fish swimming towards the lead fish (this case extends the bird scenario into 3D). Of course in whichever scenario you think of, particles must not overlap and should make an attempt to stay a minimum distance apart (two birds/fish cannot fly/swim in the same spot at the same time). Whichever context you decide on, the scene and surrounding environment should reflect the context (fish shouldn't swim in the sky and birds don't swim in the ocean for example). The type of flocking used should also be described in the README.txt file.

FINALLY (I know it seems like a lot, but there's only a few small pieces and many optional pieces), add a custom vertex and/or fragment shader to each particle in your system. You must pass a custom vertex attribute for each particle that corresponds to the particle's current age. Use this attribute to vary the particle's size, color, appearance, position, etc. Use the Fixed-Function Pipeline Shader from the Resources point as a starting point so you still have access to texturing and simple lighting.

A sample call to your program may look like:
./a6 controlFile.txt
And in your controlFile, you can specify the particle systems, the textures to use for the skybox, the shaders to use, any objects to load. Then with multiple control files, you can create new worlds without having to rebuild your entire program. This is just a suggestion.
Beginning your training, you focus your thoughts towards a candle on the table. Waiting for it to light.


Part II - Website


Update the webpage that you submitted with Assignment5 to include an entry for this assignment. As usual, include a screenshot (or two) and a brief description of the program, intended to showcase what your program does to people who are not familiar with the assignment.


Documentation


With this and all future assignments, you are expected to appropriately document your code. This includes writing comments in your source code - remember that your comments should explain what a piece of code is supposed to do and why; don't just re-write what the code says in plain English. Comments serve the dual purpose of explaining your code to someone unfamiliar with it and assisting in debugging. If you know what a piece of code is supposed to be doing, you can figure out where it's going awry more easily.

Proper documentation also means including a README.txt file with your submission. In your submission folder, always include a file called README.txt that lists:
  • Your Name / email
  • Assignment Number / Project Title
  • A brief, high level description of what the program is / does
  • A usage section, explaining how to run the program, which keys perform which actions, etc.
  • Instructions on compiling your code
  • Notes about bugs, implementation details, etc. if necessary
  • How long did this assignment take you?
  • How much did the lab help you for this assignment? 1-10 (1 - did not help at all, 10 - this was exactly the same as the lab)
  • How fun was this assignment? 1-10 (1 - discontinue this assignment, 10 - I wish I had more time to make it even better)


Grading Rubric


Your submission will be graded according to the following rubric.

Percentage Requirement Description
20% Particle class correctly implemented with Particle.h file. At a minimum, there is a draw() and update() function. ParticleSystem class correctly implemented with ParticleSystem.h file. At a minimum, there is a draw() and update() method.
30% Particles exhibit appropraite movement under gravity. Particles die once their life has expired. Particles are properly textured billboarded quads and are sorted back to front.
15% Control file structure specified in README.txt and file is read in properly. Two distinctly different control files are included to demonstrate particle system generation.
20% Vertex and Fragment Shaders compile without errors. Vertex Attributes are passed to shader and used to vary some visual state of the particle.
5% Hero is placed in a Skybox and can move around scene. Appropriate filters are applied to textures.
5% Appropriate lighting & materials used.
5% Submission includes source code, Makefile, and README.txt.
Source code is well documented. Webpage named <heroName>.html submitted and updated with screenshot from latest assignment. Submission compiles and executes in the lab machine environment.


Experience Gained & Available Achievements


Assignment Attribute
Assignments +100 XP
Web Attribute
Web +100 XP
Multicast
Multicast
Follow the Leader
Follow the Leader


Submission


Please update you Makefile so it produces an executable with the name a6. When you are completed with the assignment, zip together your source code (including all necessary object, shader, texture files), Makefile, README.txt , and www/ folder. Name the zip file, HeroName_A6.zip . Upload this file to Blackboard under Assignment6.


This assignment is due by Friday, November 21, 2016 by 11:59pm.
Last Updated: 01/01/70 00:00


Valid HTML 4.01 Strict Valid CSS! Level Triple-A conformance, W3C WAI Web Content Accessibility Guidelines 2.0