Sprint 2 – Jumanah

My main focus this sprint was to refine the fire and make the colours and overall shape of the fire look realistic.

Version 1 – Fixed the shape of the fire by assigning particles at random offset to X values and decreasing their size as they reach the end of their life.. as they are going up. I also added the firewood to the scene using the ofImage class and I worked on making it transparent.

ofEnableAlphaBlending();

    

    //Drawing wood underneath the fire

    fireplaceWood.draw(400, 670, 200, 79);

    

    ofDisableAlphaBlending();

—————————

float lifePercent = life / maxLife;

    

    if (life >= maxLife){ //once reached max life stop

        life = maxLife;

    }

    

    //Values for the size of the particle based on life percent.. adjusted

    float size = 0 + (lifePercent)*100;

    size = 100-size;

screen-shot-2017-02-01-at-10-54-45-am

ofDrawEllipse(0, 0, diameter/3, diameter/1); //make a tall ellipse rather than a circle.. more fire like

Then I changed the colour and size based on the age of the particle. At first it was going from red to yellow, which was not realistic.. Version 2

screen-shot-2017-02-01-at-12-01-17-pm

  //COLOR AND ALPHA VALUE WILL BE BASED ON LIFE PERFECT

        ofSetColor(255,100*(1-lifePercent),30,lifePercent*255);

Version 3 – Then I added blending and glow to the fire with the help of Mr. Anthony. I also added a small random velocity to each particle to make it sway from left to right a little.

velocity[0] += ofRandom(-0.02,0.02); //random x value to make the fire sway a little.

screen-shot-2017-02-01-at-12-39-24-pm

ofSetColor(255);

    ofEnableAlphaBlending();

    ofEnableBlendMode(OF_BLENDMODE_ADD);

The last thing I did was add a fire class to make our code more scalable. It is an inherited class from Particle.  it will have its own colours and gravity, and way to add particles..

Reflection:

At first the shape of the fire wasn’t what I wanted, and blending was not working but I asked the prof for assistance and he helped me figure out what was going on. It was also harder than I expected to create a fire inherited class which would jumble up the code entirely..

The fire is almost done, and the background has been added. Overall a very successful sprint!

 

Jumanah

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s