Flower Shop FinalProject.exe Lindsey DeSalvo A03727288 CSE167 12/4/2003 This project is a flower shop in a greenhouse type room. I built the flowers and pots out of parametric shapes, as well as the walls. This was the intended design for my project and I think it worked out well. Professor Buss and I had originally discussed just doing petals in different patterns, but I think the 3 different shapes I used for the flowers looked much more realistic and were simpler to form because they could be easily rotated The added design feature that we had not included in previous projects was 5 different texturemaps (2 for windows, 2 for the gradient coloring on the walls and 1 for the sign on the side of the desk). I was going to attempt to add 3-D text for the sign, but the parametric flowers took me so long to do that I would not have finished this project on time had I attempted such a feat. It probably would have been a project all on it's own. This project looks and works best on higher end processors and graphics cards. It works much better on my home computer than it does in the lab. Controls: - Arrow keys control viewpoint. - Press "f" to move your view forwards. - Press “b" to move your view backwards. - Press "w" to toggle wireframe mode. - Press "c" to toggle culling of back faces. - Press "M" or "m" to increase or decrease resolution of the flowers, pots, and corners (respectively). - Press "R" or "r" to increase or decrease rate of movement (respectively). - Press \"h\" to toggle between positional and directional lighting. Figures: - Wire frame flowers - Flowers all toggle between wireFrame and solid mode using the 'w' key. - You can increase the mesh count on the walls and on the flowers by using the 'm' and 'M' keys. I had to use two different Mesh counts for this project because the daisy petals were so small that they did not need a high mesh count, but the toruses for the roses needed higher than the petals to look good, so in order to keep rendering time down, I split up the mesh counts. - My goal with the flower pots was to create a really general function that would draw a pot and fill it with flowers of a type specified by the user. I wanted the user to have lots of control over how the flowers looked through the parameters passed to the function, but not have to deal with changing the code. I definitely think I suceeded in this task. - Flower pots are created by specifying the color of the leaves and stems (all zeros if these are to be chosen randomly), color of the petals (all zeros if these are to be chosen randomly for each individual flower), specifics for the pot (including radius, rim dimensions, and angle of the base), the scarcity, and ranges for the flower diameters and flower heights. Specific values for the flower diameter and flower height are chosen randomly within the range given. The user can specify what type of flowers they would like as well through an integer parameter. 0 chooses a random type for each individual flower, 1 is daisies, 2 is tulips and 3 is roses. - Flowers are placed in the pot by placing one in the center and then placing one flower everywhere they can be placed around the next allowed ring. Allowed flower placement is based on the maximum radius of the flowers times the scarcity. This is the change in radius for each ring and the distance each flower will be placed from the next around the ring. As long as the scarcity remains about 1, no flowers will overlap each other because of this placing algorithm. - Daisies - The daisies were done using a function for the ellipsoid petals and then rotating the petals around the center. The stem color, petal color, center radius, petal width (must be smaller than the center diameter), petal length, number of petals, stem length, and number of leaves, can be chosen, though most of these things are chosen randomly by the specifications given to drawPot(). - The parametric equation for a daisy petal is < 2.0*sin_theta*cos_phi/(l*l), 2.0*sin_phi/(w*w), 2.0*cos_theta*cos_phi/(l*l)> - Tulips - The tulips were done using a function for the paraboloid petals and then adding the centers on stems. The stem color, petal color, width to height ratio (must be greater than .2 to avoid the stems sticking outside the petals), petal height, stem length, and number of leaves, can be chosen, though most of these things are chosen randomly by the specifications given to drawPot(). - The parametric equation for a tulip is < 2.0*sin_theta*cos_phi/(width*width), 2.0*sin_phi/(height*height), 2.0*cos_theta*cos_phi/(width*width)> - Roses - The roses were done using a function for the torus shaped petals, starting with the center torus, drawing it, and then expanding outwards. When all the rings are drawn, they are rotated and drawn again a specified number of times. The stem color, petal color, center radius, petal radius, number of rotations, stem length, and number of leaves, can be chosen, though most of these things are chosen randomly by the specifications given to drawPot(). - While these don't exactly look like roses, I couldn't think of any other way to draw anything that resembled them with parametric shapes. They might actually be more like sunflowers, but for the purpose of this program, I'm going to call them roses. - Walls - The paneled windows were done with two different textures. The left wall was done with a stained glass window texture that have a bit of lighting showing through. This wall is where the lighting is placed in OpenGL. Because our version of OpenGL will not add lighting effects to the texture maps, I decided to add this effect in by hand to give the illusion of light coming through the left windows. - The rest of the windows are done with a window texture without the lighting effect - The rounded corners on the walls were done with quarter cylinders for the sides and tops and quarter spheres for the corners. The normals had to be reversed and the shapes essentially drawn backwards to show the insides of these shapes as the fronts. - The parametric equation for a cylinder is - The parametric equation for a sphere is - The light brown to dark brown blending texture on the corners was done with texture mapping as well. I did this with a texture map rather than blending colors because it was blended across the inner surface of both a sphere and a cylinder. These would have been extremely difficult to colorize vertex by vertex without a texture map. While I lost the lighting effects on the walls, I though that matte walls were a decent trade-off for a little bit of code simplicity and avoiding a complex coloring algorithm. - I left the tops of the room open to provide aerial views of the pots, though it could be easily closed. - Shop Sign - The flower shop sign was created by taking a screen shot of one of the pots of daisies and editing it in Photoshop 6.0 to only get a few specific flowers, and then adding in the gradient text and sign components. - The sign is a texture map on the side of the desk. It is nearly at a right angle with the lights, so very few specular highlights are lost by it being a texture map. - I originally struggled with this texture map because I was trying to map it to a brown surface, as is the color of the rest of the desk. OpenGL blends the surface color and the texture color together, which was why I was having no trouble with the texture maps on my white walls, but this map had distorted coloration. After changing the color of the surface to white, it worked beautifully.