Jump to content

How to promote attributes optimally?


Recommended Posts

I have to promote primitve class attributes into point one. Do we have any facility in HDK to do this? I see only

void GEO_VertexAttribDict::promoteAttrib(const char * n, int s, GB_AttribType type) 			

Promote an attribute to the vertex dictionary.

Or shall I find out which polygons are sharing the point and just do the sampling / interpolation manually?

Cheers.

Link to comment
Share on other sites

If anyone is interested... findPrimsUsingPoint(pt, primlist, prefarr) operation is very expensive and not very useful in this particular case.

But I have found a pretty fast solution: instead of baking an attribute as primitive attribute (in "for all polygons" pass) we can bake this attibute into each point of the polygon with addition (ptAttrib += val). Also we have to create a counter attribute (cntAttrib += 1). In second pass (i.e. "for all points") we just have to divide ptAttrib by cntAttrib and we are done.

It's fast but if somebody knows "one line" or faster or more proper solution please tell about it.

Edited by hoknamahn
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...