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$
2
  • $\begingroup$ You could write a Python script to assign different materials to faces depending on their type. $\endgroup$ Commented Dec 22, 2016 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$ Commented Dec 22, 2016 at 22:50

1 Answer 1

5
$\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$
1
  • $\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$ Commented Dec 22, 2016 at 22:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .