Multi-scale Function Adding Noise over diverse frequencies and amplitudes )) * , * , * ( * ) , , ( 1 r scale t scale s scale noise amplitude r t s f i i i bands i i å = - =
Sum of Absolute Values Adding Noise over absolute values is Good for fire )) , , ( ( ) , , ( 1 r scale t scale s scale noise amplitude r t s f i i i bands i i å = - =
Marble Example § MarbleMap is from black to white § Scale scales [min, max] to [0,1] § u and v are in range [0,1] § Does not look that great, maybe a more complex color ramp is needed )) ) 5 . 11 , * 2 * 5 , * 2 * 5 ( * 2 * 6 * 20 sin ( ( ) , ( 4 1 ÷ ø ö ç è æ + = å = - v u PNoise u Scale MarbleMap v u Texture i i i i
§Axis-aligned Bounding Box (AABB) § An AABB is defined by its minimal and maximal positions in space Pmin=(xmin, ymin, zmin), Pmax = (xmax, ymax, zmax) § Calculate Initialize pmin to +infinite or the first vertex Initialize pmax to –infinite or the first vertex foreach vertex p do { if (p.x < pmin.x) then pmin.x = p.x if (p.y < pmin.y) then pmin.y = p.y if (p.z > pmax.z) then pmax.z = p.z }
Culling Face void display(void) { glEnable(GL_CULL_FACE); // checks all the faces that are front facing towards // the viewer and renders those while discarding all // the faces that are back facing // Improve performance also! glDisable(GL_CULL_FACE); }
Fog glEnable(GL_FOG); // specifies the equation to be used to compute the fog blend factor. // GL_LINEAR, GL_EXP, and GL_EXP2. // initial fog mode is GL_EXP glFogi(GL_FOG_MODE, GL_LINEAR); // the fog color. Color components are in the range [0,1]. // the initial fog color is (0, 0, 0, 0). GLfloat fogColor[4] = { 0.5, 0.5, 0.5, 1.0 }; glFogfv(GL_FOG_COLOR, fogColor); //Used in exponential fog equations. The initial fog density is 1. // Only nonnegative densities are accepted. glFogf(GL_FOG_DENSITY, 0.25); // the near distance used in the linear fog equation. The initial near distance is 0 glFogf(GL_FOG_START, 10.0); // the far distance used in the linear fog equation. The initial far distance is 1. glFogf(GL_FOG_END, 6000.0);