Hi,
Given 3 vertices each contain different color and they form a triangle.
What are my options and where - to impose the follow:
If two of the 3 vertices colors are the same, choose this color for the third one .
If all 3 vertices have different colors choose color from the first vertex for the other 2.
I should use geometry shader for that and do it in the triangle loop ?
thank you
Barak.
My first intuition would be to do so in the geometry shader indeed, since you will have access to all 3 vertices of a triangle.
Though if for some weird reason it kills your performance and the vertex colors are not changing, you might want to precalculate those on the cpu and pass the right vertex colors to your material.
cheers,
tim
Thanks Tim,
then - what is the best way to iterate thru polygon points…
Update :
just sharing an example to accsess the attriutes per primitive in python if you need better
performance - use C++ sop .
scriptOp.copy(scriptOp.inputs[0])
for prim in scriptOp.prims:
if ( prim[0].point.Cd[0] == prim[1].point.Cd[0]
and prim[0].point.Cd[1] == prim[1].point.Cd[1]
and prim[0].point.Cd[2] == prim[1].point.Cd[2]):
print ( "vertex number 0 Cd attribute
equal vertex number 1 Cd attribute" )