Jump to content

How to group primitives by comparison?


Recommended Posts

This seems like an interesting problem.

Basically I have a geometry object where each primitive has an attribute called "area". I also have a primitive group that has a few primitives.

What I am trying to do is to go through all primitives and group ones that have the same area as the ones in my group.

Since these are primitives, I thought I can't use VOPs. I was thinking of foreach but then do I have to use 2 foreach nested inside one another? I know VEX has add to group, but outside it, not sure how I can add to an existing group continuously?

Any ideas on how to solve this problem? :)

Link to comment
Share on other sites

Since these are primitives, I thought I can't use VOPs. I was thinking of foreach but then do I have to use 2 foreach nested inside one another? I know VEX has add to group, but outside it, not sure how I can add to an existing group continuously?

What about making unique primitives with a facet or fuse and promoting the area attrib to points? Then you could run this through a vopsop.

  • Like 1
Link to comment
Share on other sites

Guest mantragora

Small fun with HDK.

Template Group = your grouped primitives that you want to use as a template

Found Group Name = new group name to which add primitives if they are found

Attribute Name = attribute to use as comparision

In attached scene just replace red node with compiled version of this code. As group = "template", as found group name = "thesame" and as attribute = "area_clamped".

I haven't tested this to extensively so there may be some errors. But it should be enough to play with. There is also VOP way in the file too.

WATCH AND DOWNLOAD CODE ON VIMEO

Edited by mantragora
  • Like 2
  • Downvote 1
Link to comment
Share on other sites

Guest mantragora

I found one error. I create newPrmitive group even if you specify existing one. And I don't check if there are more than one group specified too. So it may break here if you add more than one name.

Looks like you came to the grips with the HDK, NIIICE

It's my second today :). First was this LINK. I still don't know how to interact in viewport with HDK so I made selections with Python.

Got RF .bin exporter in works next. Hooking into Houdini with GEO_IOTranslator is really nice and easy. If only there was better documentation for it. There are so many functions that you really don't know why you should use them in some situations. More examples would be nice.

Edited by mantragora
  • Like 1
Link to comment
Share on other sites

Guest mantragora

You don't have Edge Selections. It's Point selection. It just translates edges into points. Ordered.

I got this in OnCreated part of DA.

DOWNLOAD CODE

Edited by mantragora
  • Like 1
Link to comment
Share on other sites

Guest mantragora

Thanks man, that's what I was assuming. I just never transferred scene selections. Will try your code tomorrow.

I cleaned code a little. Fixed crash problem, for "Attribute Name" and "Found Group Name" fields, if you specified more than one name and/or there is a space in the name. Now it will just report "wrong group"/"wrong attribute" error on the operator.

"Template Group" field can use more than one group, so you can for example add group with Area = 10, and second with Area = 20 and it will find prims just like if there was one template group specified.

I just updated code in this post.

While you are at it, you should also implement Edge Loops and Rings as operators :)

WTF are Rings ?

Magneto. You are expert Max TD. I don't even work in 3d. It could put you in a bad light if some company looked here and found out that simple amateur implements tools for you. So I will leave it to you ;).

Edited by mantragora
  • Like 1
Link to comment
Share on other sites

Thanks man, I will try out your code. It looks good. Do you know if the HDK has a sample that has most common errors handled so you can use it as a template? I feel like there are a lot of checks that has to be done, would be good if they were available like wrong group name, invalid group name, etc.

Rings are basically series of opposing edges of adjacent quads. It's much useful to select rings than loops IMO.

You can see it here:

GUID-3756136E-CF58-4A11-930F-862D54B4B74B-low.png

lol they wouldn't think that, they would think a pro getting help from another pro :)

Besides are you not trying to get into the industry? I certainly think you deserve to work if you aren't already.

  • Downvote 1
Link to comment
Share on other sites

Guest mantragora

Thanks man, I will try out your code. It looks good. Do you know if the HDK has a sample that has most common errors handled so you can use it as a template? I feel like there are a lot of checks that has to be done, would be good if they were available like wrong group name, invalid group name, etc.

Nope. I just started with SOP_BlindData example and wiped out every method and variable there that I didn't needed. I just made my own Template Solution for SOP. And the same for ROP and GEO.

After that I started first with figuring out different parameters, so I got one solution with parameters I used and found useful, like different menus, ramps, paths etc. and what flags I have to use to make them. Thats my Template solution for Parameters. There are some parameters things I haven't figured yet. If I will I will put it there. Next was how to build polygons. Than how to hook into Houdini and save data from it. And now how to get attributes and make groups.

I don't know any other way. VisualStudio "Visual Assist X" plugin is helpful. It's not on pair with C# Resharper but for C++ it's the best out there for VisualStudio..

Besides are you not trying to get into the industry? I certainly think you deserve to work if you aren't already.

I tried in couple places. In two I was recommended. No one wanted to hire me. I couldn't get even introductory job in my country. Half of the knowledge I got thru last couple years would be sufficient easily in any other industry to get really good paid job.

Besides, right now I'm to old and I'm doing this solely myself for too long to go and work in a group. And I'm also more interested in making things you will not find in this industry. Making effects for some shity films with bad scripts is not how I would like to spend my life anymore.

Like Macha said in some post I read here: If you are smart enough to learn Houdini and couple other things yourself (or something like this wink.gif), you are really better if you find job in other industry. And it's true.

Edited by mantragora
  • Like 1
Link to comment
Share on other sites

I will get into HDK too but I don't want to diverge too much from doing vfx right now, because I think HDK is not a simple undertaking. So I will leave when I am at a level in Houdini where I am content but want to step up the game :)

If you are from a different country, it's certainly harder to get it if you were local. Even the most locals wouldn't agree, the visa issues are very real. But don't get discouraged. If you make a video showing everything you did, I am sure it would attract a lot of attention.

There are a lot of ways you can extract money in this business IMO :)

Why not make some tool development series for Houdini for sale. There aren't many resources right now, and this way not only you would be doing what you are doing now, but also make money.

I agree with doing your own stuff though. No matter what company you are working for, nothing is better than living wherever you want, doing whatever you want just for fun, whether it's 3d or something else. No obligations just wild experiments :D

  • Downvote 1
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...