Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

Introduction

Particle systems are used in games, movies, etc. to depict phenomena such as clouds, dust, fireworks, fire, explosions, water flow, sand, insects, wildebeests, etc. Once you know what they are, you can't stop seeing them. We think of particle systems as being created digitally, like you will be doing. But recently, one was create analogly, like with LEDs attached to pigeons. (No, really.)
A bit of particle history, particle systems were first seen in the Star Trek II: The Wrath of Khan Genesis Demo.

To make a particle system work, you manipulate a collection of many 3D particles to exhibit some behavior. ( Look here for more information.)

In this project, you will use OpenCL and OpenGL together to make a cool particle system. (The degree of cool- ness is up to you.)

Requirements:

1. Design your 3D environment. The particles need to start from somewhere. Where should that be? The particles need to start with initial velocities. What should those be?

Your 3D environment needs to have at least two "bumpers" in it for the particles to bounce off of. Each bumper needs to be geometrically designed such that, given a particle's XYZ, you can quickly tell if that particle is inside or outside the bumper. To get the bounce right, each bumper must be able to know its outward-facing surface normal everywhere.

Let's face it. Spheres are computationally "nice". In computer graphics, we love spheres. It is fast and easy to tell if something is inside or outside a sphere. Determining a normal vector for a point on the surface of a sphere is even easier.

It is OK to assume that the two bumpers are separate from each other, that is, a particle cannot be colliding with both at the same time.

2. Create an OpenGL buffer object to hold the particles' XYZW positions as an array-of-structures. Create an OpenGL buffer object to hold the particles' RGBA colors as an array-of-structures.

Create a C++ array-of-structures to hold the particles' XYZ velocities.
(OpenGL buffer objects are used for position and color, but not velocity. This is because OpenGL will need to use positions and colors in the drawing, but not the velocities.)

3. Determine good starting values for all 3 data structures.
For the position and color buffers, use glMapBuffer( ) to send the values directly to the GPU. The velocity array is a C++ array-of-structures, so just fill it using C++ code.

4. Create two OpenCL buffers from the position and color OpenGL buffers using calls to clCreateFromGLBuffer( ). You don't need to transmit the data to these OpenCL buffers -- it is already there in the OpenGL buffers that they are now linked to.

5. For the velocity array, create an OpenCL buffer using clCreateBuffer and transmit the C++ array-of- structures to it like you've done before using clEnqueueWriteBuffer( ).

6. Decide on a time step, DT. Your .cl program will need to know about it. You can pass it in, or hard code it.

7. Create a .cl OpenCL kernel that will advance all of the particles by the timestep DT. The sample code shows giving the .cl program access to the particles' positions and velocities. You will need to use these, and will need to update them.

8. Your OpenCL .cl program must also handle the bounces off of your bumpers. Be sure to draw these bumpers in your .cpp program so that you can see where they are. Again, spheres are "nice".

9. The sample code shows giving the .cl program access to the particles' colors. But, Joe Parallel didn't do anything with these. But, your .cl kernel needs to dynamically change the color of the particles. You could base this on position, velocity, time, bounce knowledge, etc. But, the color of each particle needs to change in some way during the simulation.

Note that OpenGL defines the red, green, and blue components of a color each as a floating-point value between 0. and 1.

10. Leave the local work-group size at some fixed value. You can pull this out of your experience with Project #6, or you can experiment with the timing. Vary the total number of particles and measure the performance using units that make sense. Following our class tradition of inventing our own giga-cool-sounding units of measure, Joe Parallel used "Particles Per Second", or "MegaParticles Per Second", or "GigaParticles Per Second".

11. Make a table and a graph of Performance versus Total Number of Particles

12. Turn into teach, individually, not in a .zip file:
1. Your source code (.cpp and .cl). Give your .cl file a name that is some variation on your name or login. (See below.)
2. Your executable
3. Your commentary in a PDF file.

13. Your commentary PDF should include:

1. What machine you ran this on

2. What dynamic thing did you do with the particle colors

3. Include at least one screen capture image of your project in action

4. Show the table and graph

5. What patterns are you seeing in the performance curve?

6. Why do you think the patterns look this way?

7. What does that mean for the proper use of GPU parallel computing?

Attachment:- Advancing a Particle by DT.rar

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92321748
  • Price:- $80

Priced at Now at $80, Verified Solution

Have any Question?


Related Questions in C/C++

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As