Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Dots on mesh in Viewport

Dots on mesh in Viewport

Anonymous
Not applicable
1,198 Views
8 Replies
Message 1 of 9

Dots on mesh in Viewport

Anonymous
Not applicable

Hi,

 

I have compiled the provided apiMeshShape and in viewPort 2.0 I get the dots in the middle of each shape. Any idea how to remove these dots ?

 

Cubes

 

In addition to that, the shading is a bit strange (a standard lambert has been applied). As the attached picture shows it, the faces are not of uniform color (black at the bottom, bright at the top). How to have more flat colors on the faces like when I create a simple box using Maya's UI ?

 

Thanks !

0 Likes
1,199 Views
8 Replies
Replies (8)
Message 2 of 9

RFlannery1
Collaborator
Collaborator

Maybe try from the menus "Display > Polygons > Reset Display"?  Does that make any difference?

0 Likes
Message 3 of 9

Anonymous
Not applicable

Unfortunately that didn't help. As you can see on the image below, I've added a standard polygon box that displays as I expect. So basically how to have the same effect on the "dotted" polygons than on the single cube ?

 

Thanks

Screen Shot 2015-06-10 at 11.16.28 PM.png

0 Likes
Message 4 of 9

Anonymous
Not applicable

did you try to set normals? 

0 Likes
Message 5 of 9

Anonymous
Not applicable

Hi vlad_d,

This is something I looked at, but to be honest did not understand. Look at the apiMeshCreator code:

 

	pa.append( MPoint( -cube_size, -cube_size, -cube_size ) );
	pa.append( MPoint(  cube_size, -cube_size, -cube_size ) );
	pa.append( MPoint(  cube_size, -cube_size,  cube_size ) );
	pa.append( MPoint( -cube_size, -cube_size,  cube_size ) );
	pa.append( MPoint( -cube_size,  cube_size, -cube_size ) );
	pa.append( MPoint( -cube_size,  cube_size,  cube_size ) );
	pa.append( MPoint(  cube_size,  cube_size,  cube_size ) );
	pa.append( MPoint(  cube_size,  cube_size, -cube_size ) );

	normals.append( MVector( -normal_value, -normal_value, -normal_value ) );
	normals.append( MVector(  normal_value, -normal_value, -normal_value ) );
	normals.append( MVector(  normal_value, -normal_value,  normal_value ) );
	normals.append( MVector( -normal_value, -normal_value,  normal_value ) );
	normals.append( MVector( -normal_value,  normal_value, -normal_value ) );
	normals.append( MVector( -normal_value,  normal_value,  normal_value ) );
	normals.append( MVector(  normal_value,  normal_value,  normal_value ) );
	normals.append( MVector(  normal_value,  normal_value, -normal_value ) );

 

I don't understand why we have as many normals as points. For me a normal should be for a Quad or a Triangle, not for a point. So for a cube we should have 6 normals, not 8.

Any idea why this code has 8 normals ?

Thanks.

0 Likes
Message 6 of 9

RFlannery1
Collaborator
Collaborator

Ah, that explains the shading issue.  Normals are defined per vertex, not per face.  The normals are interpolated across the surface of the face.  This is important because otherwise, you would never get smooth shading.  (To see what I am talking about, make a poly sphere in Maya, and then deselect it.  Then in the viewport menus, select "Shading > Flat Shade All".  Notice how every polygon looks flat and every edge looks hard now?  That is because in "flat shade" mode, Maya does not interpolate the normals across the face.)

 

A cube is a special case.  You actually *want* each face to look flat.  To make that happen, the normals of all four vertices on a particular face must point the same direction.  When I said that normals are defined per vertex, that was actually not completely true.  Normals can be specified per-vertex-face.  With the cube, since each vertex borders three faces, each vertex can have three normals.  So a cube can have up to 24 normals (8 vertices * 3 faces at each vertex).

 

The code you showed only specified 8 normals.  So you are essentially getting soft edges instead of hard edges.  The picture below shows a cube with shared normals (8 normals) and one with separate per-vertex-face normals (24 normals).

Normals_cube.png

 

I still have no clue about the dots on each face, though.

0 Likes
Message 7 of 9

Anonymous
Not applicable

Thanks for this clear explanation !

I still need to understand how to pass 3 normals per Vertex to the Maya Api.

 

Cheers.

0 Likes
Message 8 of 9

RFlannery1
Collaborator
Collaborator

I tried looking at the code in the example, but I couldn't figure out how it is processing the normals, or any of the data structure.  Sorry, wish I could help more.

0 Likes
Message 9 of 9

Anonymous
Not applicable

check MFnMesh::setFaceVertexNormals(...) or something similar

0 Likes