PDA

View Full Version : To smooth or not to smooth


robosport
31st January 2005, 01:19 AM
I used the AC3D file format documentation and the sample loader to integrate the .ac format directly into my application. It was very straight forward. My compliments to the chef! :)

I have a couple basic questions. I'll start with this one for now: Is there information or a flag stored somewhere in the format that I can use to let my renderer know when a surface normal should be used instead of vertex normals when rendering a surface. The difference being a flat shaded or smooth shaded result, respectively.

Reworded for clarity: Some models require flat parts and smooth parts. How can I tell if a specific surface should be flat or smooth shaded in an AC3D object?

Thank you in advance.
robo

Andy
31st January 2005, 06:39 AM
The flag on SURF indicate is a surface should be flat or smooth shaded:

SURF %d
The start of a surface. The parameter specifies the surface type and flags.
The first 4 bits (flags & 0xF) is the type (0 = polygon, 1 = closedline,
2 = line). The next four bits (flags >> 4) specify the shading and
backface. bit1 = shaded surface bit2 = twosided.

For rendering in AC3D, it calculates the vertex normals by averaging the attached surface normals (using the crease angle too). Any surfaces that are set to be 'smooth' will be drawn using the vertex normals; vertices of a 'flat' surface will get the surface normal.

Andy

robosport
31st January 2005, 10:01 AM
That is exactly what I was looking for. I read about the flags but since the words flat and smooth were not actually listed in that paragraph I thought the flag was for shaded or not shaded at all.

Thank you for the fast response (and the great 3D tool)!