# Is it possible to work out the normal of a face based on the smoothing of the surface

 01 January 2009 reForm Expert portfolio Patrick Macdonald CG Artist reForm Studios London, United Kingdom Is it possible to work out the normal of a face based on the smoothing of the surface Say you have a low poly cylinder with all the faces in the same smoothing group, is it possible to work out the normal of a point on a face based on the curvature defined by the smoothing between faces? __________________ Patrick Macdonald Lighting TD : http://reformstudios.com Developer of Mission Control , the spreadsheet editor for 3ds Max share quote
 01 January 2009 ZeBoxx2 Lord of the posts   Richard Annema Caustic Graphics / SplutterFish Groningen, Netherlands I may be mistaken - autogrid and such handily respect derived and explicit normals, so I hope I'm just missing something - but I think you'd have to do it manually - getting the face normals, checking the smoothing groups and calculating (via interpolation) the appropriate normals from those. Slightly easier may be through the edit normals modifier interface (get the normals from each of the face corners directly), which would also let you handle explicit normals. Near's I know there's no 'getSurfaceNormal ', at least. Edit: just to note - you mentioned that they all have the same smoothing group - in that case, you can just interpolate between the vertex normals of each vertex for a given face using the mesh/poly methods of getting the vertex normal. share quote
 01 January 2009 reForm Expert portfolio Patrick Macdonald CG Artist reForm Studios London, United Kingdom Originally Posted by ZeBoxx2: Edit: just to note - you mentioned that they all have the same smoothing group - in that case, you can just interpolate between the vertex normals of each vertex for a given face using the mesh/poly methods of getting the vertex normal. I guess that leads on to the next question of how one would work out the correct interpolation for the surface-point-normal. Given the face could be attached to n-faces I would need to loop through all the adjacent faces to get their normals, and then measure the distances between the face centers and edges to work out the correct weighting to give each normal. Am I right in thinking an edge between two faces is always at the midpoint between the two face centers? It quickly becomes quite a complicated process to my mind! hmmm __________________ Patrick Macdonald Lighting TD : http://reformstudios.com Developer of Mission Control , the spreadsheet editor for 3ds Max share quote
 01 January 2009 ZeBoxx2 Lord of the posts   Richard Annema Caustic Graphics / SplutterFish Groningen, Netherlands I think that the normal at the barycentric center of the face is the same as what getFaceNormal() returns - so if you just need it at the center, you could just use that. If you need it for an arbitrary barycentric coordinate on the face, then all you need to do is interpolate between the 3 vertex normals of that face (no need to check the other faces*), based on the barycoord - near's I know, it's a linear interpolation. I think there's some interpolation stuff in the math functions sticky in this forum. * that 'no need to check other faces' hinges entirely on the assertion that the entire object only has a single smoothing group. If it does not, then you'll have to get really down and dirth with getting face normals, checking whether an adjacent face is in the same smoothing group - determine the vertex normal for just that face from that (again, edit normals interface gives more direct access to this), and then proceed as you would before. Dare I ask what you're trying to do? share quote
 01 January 2009 reForm Expert portfolio Patrick Macdonald CG Artist reForm Studios London, United Kingdom Thanks, I forgot that the vertex normals would be an easier approach. Haha, well if I told you I'd have to kill you.... well not quite. I'm trying to write a script or plugin that distributes objects on another object. But, to go beyond the normal scatter object, I intend this plugin to deform the child mesh's to conform to the shape and curvature of the object they are being applied to. I have the basics working, I'm just looking at adding further functionality (ie being able to infer the curvature of a low poly parent object to smoothly deform the child object across its surface). Hope that makes some sense! __________________ Patrick Macdonald Lighting TD : http://reformstudios.com Developer of Mission Control , the spreadsheet editor for 3ds Max share quote
 01 January 2009 ZeBoxx2 Lord of the posts   Richard Annema Caustic Graphics / SplutterFish Groningen, Netherlands yep, makes perfect sense good luck - sounds like a nice project share quote
 01 January 2009 SyncViewS IC.Developer   Enrico Gullotti Technical Artist and Programmer United Kingdom Hi Patrick, maybe it can help you to know that tools like intersectRay, mouseTrack, thePainterInterface, take into account the face normal corrected by the smoothing groups. You can get for example the actual face normal of a specific point on a surface, by casting a ray passing through the point and using the intersectRay to get a new ray composed by the intersection position between face and first ray (your point) and a vector representing the corrected normal. - Enrico __________________ IllusionCatalyst – Instrument set for 3ds Max │ AliquaForma – Personal portfolio in fieri share quote
 01 January 2009 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.