Jump to content


How to group primitives by comparison?


  • Please log in to reply
12 replies to this topic

#1 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 2,020 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 01 July 2012 - 11:37 AM

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? :)

#2 kgoossens

kgoossens

    Illusionist

  • Members
  • PipPipPip
  • 265 posts
  • Joined: 04-May 06
  • Location:Belgium, Antwerp
  • Name:Kim Goossens

Posted 01 July 2012 - 12:42 PM

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.
“It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change.”

- Charles Darwin

#3 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 2,020 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 01 July 2012 - 01:27 PM

Thanks kgoossens, that's an interesting trick. I will give that a try :)

#4 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 634 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 01 July 2012 - 03:10 PM

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, 23 October 2013 - 06:08 AM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#5 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 2,020 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 01 July 2012 - 03:18 PM

Thanks man, I will have to take some time to ingest it all.

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

#6 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 634 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 01 July 2012 - 03:29 PM

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, 01 July 2012 - 03:43 PM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#7 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 2,020 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 01 July 2012 - 03:43 PM

Dude that's amazing :) How do you get the edge selection in python? I am not sure how you pass the viewport selection into an operator.

#8 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 634 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 01 July 2012 - 03:49 PM

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, 04 July 2012 - 07:09 AM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#9 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 2,020 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 01 July 2012 - 03:59 PM

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

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

#10 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 634 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 02 July 2012 - 08:27 AM

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, 02 July 2012 - 11:30 AM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me


#11 magneto

magneto

    Grand Master

  • Members
  • PipPipPipPipPip
  • 2,020 posts
  • Joined: 04-October 11
  • Location:Canada
  • Name:Ryan K

Posted 02 July 2012 - 01:54 PM

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:
Posted Image

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.

#12 mantragora

mantragora

    Houdini Master

  • Members
  • PipPipPipPip
  • 634 posts
  • Joined: 08-December 11
  • Location:here
  • Name:Real Time

Posted 02 July 2012 - 03:11 PM

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 Posted Image), you are really better if you find job in other industry. And it's true.

Edited by mantragora, 23 October 2013 - 05:51 AM.

magic happens here... sometimes

Vimeo
Twitter
 
 
 "If it's not real-time, it's a piece of shit not a state of the art technology" - me





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users