3
$\begingroup$

In a Cycles node-based material, is there any way to determine (via an Attribute, properties of the Geometry node, Texture Coordinate node, or any other means) how many vertices make up the current face, ie, whether it is a Tri or a Quad (or Ngon).

$\endgroup$
  • $\begingroup$ You could write a Python script to assign different materials to faces depending on their type. $\endgroup$ – someonewithpc Dec 22 '16 at 20:52
  • $\begingroup$ Thanks @someonewithpc - nice suggestion. Looks like OSL may one day provide a solution but the geom:numpolyvertices only ever returns 3 at the moment. I presume this will be updated at some point in the future. Looking at the code behind the Attribute node, that shows promise too as it looks like that info could be available behind the scenes, just not exposed as an attribute. $\endgroup$ – Rich Sedman Dec 22 '16 at 22:50
4
$\begingroup$

Before Blender renders, all models are triangulated and normals are calculated. There is no way to detect whether the face was an ngon or a tri. But you could apply different material indicies for the ngons than for tris. Then you could just get the info from the object info node. You could easily do that by selecting a tri for example and hitting Shift+G (make sure you are in face select mode). A menu pops up and you choose Polygon Sides. That assign the same Material as before but in a new Materials Slot.

$\endgroup$
  • $\begingroup$ I do like that - nice solution. Combined with someonewithpc's suggestion of a script to automate the allocation of materials this would be good. Thanks. $\endgroup$ – Rich Sedman Dec 22 '16 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.