# Thread: how to simulate curved surfaces?

1. ## how to simulate curved surfaces?

hi all,

i recently got an assignment as followings:

You are to create three separate, non-overlapping windows. You are also to create two different objects that will appear in all three of these windows.

The windows will have the following specifications:

Window 1 : In this window each object is to be displayed using flat shading. Two light sources are to be included and each of the objects is also to display different colours and material characteristics. This is an opportunity for you to experiment with surface characteristics of the objects to see what type of surfaces that you can simulate.

Window 2 : Objects in this window are to be displayed using Gouraud shading. The two light sources and material characteristics used in window 1 will also be used here.

Window 3 : Again you are to use a Gouraud shade with the same light sources and material factors. This time, though, you are to simulate curved surfaces by the process of averaging normals. These normals have to be calculated within your program.

i have successfully done window 1 and window 2. now i'm quite confused about window 3. what is meant by simulating curved surfaces? how to computer averaging normals.

thanks.

2. ## Re: how to simulate curved surfaces?

Huh! Computers can't draw curves! They can approximate them by drawing lots of little straight lines, so the more little lines used to draw a circle the more circular it will look. As for averaging normals, the normal for a polygon surface may be the average of the normals at each of its vertices, and these normals at the vertices are dependant on the adjoining polygons.

3. ## Re: how to simulate curved surfaces?

it seems not hard to calculate the average normal. then what shall i do?

4. ## Re: how to simulate curved surfaces?

it seems not hard to calculate the average normal. then what shall i do?
add your normals then divide the sum by the number of normals you have, then normalize if necessary.

b

5. ## Re: how to simulate curved surfaces?

thank u. what i'm really interested in after i get the averaging normals, what shall i do next?

6. ## Re: how to simulate curved surfaces?

Well you have to define the normal for each poygon/vertex you draw.
glNormal

7. ## Re: how to simulate curved surfaces?

well, maybe i should provide the complete requirements:

The objects can be generated (i) using a package such as 3D Studio Max, (ii) taken from the web or (iii) you can design the objects yourself. In any of these situations it must be made clear as to where the model has come from. The information for the objects must be read from a file and you will find that you will need to include both a vertex list for position and a face (polygon) list for topological information. The face list that you use in your program will need to include the colour and materials values for each face. These may come from an external source with the vertex and polygon data but all other information must be generated within your program.

what i did was i dragged an object from the website and exported it as a .asc file. i read the data from the file so i dont actually know which part displayed on the screen is for which data. now could someone explain me in more detail what window 3 asks me to do?

thank u.

8. ## Re: how to simulate curved surfaces?

look in the SDK and there is an example for a sphere, this should show you the idea of approximating a curved surface using polygons. You can work out the normal for each polygon and specify this in the code. So now when you shade and light this curved surface each polygon will light differently (due to the normal facing in a different direction) giving the illusion the surface is curved (if you have enough polys). Alternately have a play with glutSolidSphere which does all of the approximation and normal averaging fpor you but you can see the shading part a little better

9. ## Re: how to simulate curved surfaces?

a silly question: what is SDK?

10. ## Re: how to simulate curved surfaces?

software development kit