ICE Modeling Workshop 2: Cut edges
ICE Modeling Workshop 2: Cut edges
I was hoping we might spawn a bit of a discussion on these workshops here in the forum. Guillaume's original thread from the mailing list can be found here:
http://groups.google.com/group/xsi_list ... 0fa6b4cccc
The idea is to create an ICE tool that slices polygons between two nulls and an upvector. Guillaume's demonstration video is here:
http://vimeo.com/23367815
I went ahead and started playing with it, and so far I've been able to define a cutting plane for the Slice Polygon factory node via two nulls and an upvector. I had to do some transformations between global and local space, and I'm not sure if this is really necessary. Here is a screenshot of my current ICE tree (might be a spoiler if you want to do it yourself, or maybe my method is too convoluted and you'll get a laugh out of it):
http://www.abload.de/img/ice1as30.jpg
http://groups.google.com/group/xsi_list ... 0fa6b4cccc
The idea is to create an ICE tool that slices polygons between two nulls and an upvector. Guillaume's demonstration video is here:
http://vimeo.com/23367815
I went ahead and started playing with it, and so far I've been able to define a cutting plane for the Slice Polygon factory node via two nulls and an upvector. I had to do some transformations between global and local space, and I'm not sure if this is really necessary. Here is a screenshot of my current ICE tree (might be a spoiler if you want to do it yourself, or maybe my method is too convoluted and you'll get a laugh out of it):
http://www.abload.de/img/ice1as30.jpg
Re: ICE Modeling Workshop 2: Cut edges
I have now been able to replace the factory Slice Polygons with my own node tree. Using this math to find intersection points between lines and planes:
http://softsurfer.com/Archive/algorithm ... tersection
Looks complicated, but the second equation was straightforward enough for me to understand. Basically, the edge ratio is:
Cutting plane normal DOTPRODUCT (Cutting plane origin MINUS Edge vertex 1)
DIVIDED BY
Cutting plane normal DOTPRODUCT (Edge vertex 2 MINUS Edge vertex 1)
The edges are now cut correctly, but the new vertices still need to be connected by new edges. And the cutting should only happen between the nulls, not along an infinite plane.
Tree (with a bunch of comments):
http://www.abload.de/img/ice2ju7e.jpg
http://softsurfer.com/Archive/algorithm ... tersection
Looks complicated, but the second equation was straightforward enough for me to understand. Basically, the edge ratio is:
Cutting plane normal DOTPRODUCT (Cutting plane origin MINUS Edge vertex 1)
DIVIDED BY
Cutting plane normal DOTPRODUCT (Edge vertex 2 MINUS Edge vertex 1)
The edges are now cut correctly, but the new vertices still need to be connected by new edges. And the cutting should only happen between the nulls, not along an infinite plane.
Tree (with a bunch of comments):
http://www.abload.de/img/ice2ju7e.jpg
Re: ICE Modeling Workshop 2: Cut edges
My brain is fried now. I just can't connect those vertices properly. The vertex order is switched for some edges, so ICE won't connect those vertices.
168->169 = Okay
169->170 = Okay
170->171 = Not possible / ignored (should be: 170->172)
171->172 = Okay
172->173 = Not possible / ignored (should be: 171->173)
I've tried using the VertextoPolygons attribute. For two vertices to have a connection, they must share a polygon. 170 and 171 for example don't share a polygon. However, I've been unable to get proper results. Giving up for today.
168->169 = Okay
169->170 = Okay
170->171 = Not possible / ignored (should be: 170->172)
171->172 = Okay
172->173 = Not possible / ignored (should be: 171->173)
I've tried using the VertextoPolygons attribute. For two vertices to have a connection, they must share a polygon. 170 and 171 for example don't share a polygon. However, I've been unable to get proper results. Giving up for today.
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: ICE Modeling Workshop 2: Cut edges
First of all: I'm impressed you got this far, as I would probably have not gotten
past the stage of merely looking at the math (not even understanding it)
Secondly, this is probably a stupid remark, if so, sorry:
By what method are you creating the new edges? I assume "Add Edge", but if so, what exactly are you "feeding" it?
edit: and would you be willing to upload your progress so far as a "compound in progress",
so "we" could look at it within a "controlled environment" (i.e. ICE itself)
;)
past the stage of merely looking at the math (not even understanding it)
Secondly, this is probably a stupid remark, if so, sorry:
By what method are you creating the new edges? I assume "Add Edge", but if so, what exactly are you "feeding" it?
edit: and would you be willing to upload your progress so far as a "compound in progress",
so "we" could look at it within a "controlled environment" (i.e. ICE itself)
;)
Stay safe, sane & healthy!
Re: ICE Modeling Workshop 2: Cut edges
Don't be afraid of the math. I only understand the very basics myself. I have no clue how that dot vector equation works, I just replicated it in ICE.Hirazi Blue wrote:First of all: I'm impressed you got this far, as I would probably have not gotten
past the stage of merely looking at the math (not even understanding it)
To figure out the first step of the workshop (find cutting plane origin and cutting plane normal) you only need to know two things:
A) To draw a vector from one point in space to the other you simply subtract them.
Example: A vector from Null A (1/2/1) to Null B (2/4/3) is calculated via [Null B (2/4/3) MINUS Null A (1/2/1)]
B) The cross product of two vectors returns a vector that's perpendicular to both of them.
I assume that my current method is completely wrong.Secondly, this is probably a stupid remark, if so, sorry:
By what method are you creating the new edges? I assume "Add Edge", but if so, what exactly are you "feeding" it?
I create a custom attribute (self.NewPoints) that contains all newly created vertices. In a While loop I do Add Edge from index 0 of NewPoints to index 1 of NewPoints. Then I remove index 0 from NewPoints. The While continues until NewPoints is empty.
Here you go. The compound expects three nulls: CutterNull1, CutterNull2, CutterUpvectoredit: and would you be willing to upload your progress so far as a "compound in progress",
so "we" could look at it within a "controlled environment" (i.e. ICE itself)
;)
http://www.mediafire.com/?vxpn5dz9apdxd5p
Re: ICE Modeling Workshop 2: Cut edges
I just noticed that the cutting plane won't update when you translate/rotate/scale the object that has the ICE tree on it. Goes to show I really don't know what I'm doing, but that's why it's a workshop, eh?
Re: ICE Modeling Workshop 2: Cut edges
Given two arrays A and B, how can I find which values from A are also in B?
Example: Array A = [9,10,11,12]; Array B = [0,9,1,10,4,3] I want a tree that returns Array C = [9,10]
Example: Array A = [9,10,11,12]; Array B = [0,9,1,10,4,3] I want a tree that returns Array C = [9,10]
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: ICE Modeling Workshop 2: Cut edges
I've tried to set something up, but as a perpetual ICE NOOB I didn't get far...
I could tell you "exactly" how to do this in Python...
but arrays in ICE...
Sorry, not a helpful post: I just wanted to vent... ;)
Kudos for the nice explanatory image, BTW
I could tell you "exactly" how to do this in Python...
but arrays in ICE...
Sorry, not a helpful post: I just wanted to vent... ;)
Kudos for the nice explanatory image, BTW
Stay safe, sane & healthy!
- claudevervoort
- Posts: 89
- Joined: 16 Oct 2009, 02:56
- Location: Montréal, QC, Canada
- Contact:
Re: ICE Modeling Workshop 2: Cut edges
Hi Chris,
I stumbled upon that before, did not see any way to do an easy array intersect (I was hoping find in array could take an array of values, not just one, but looks like that does not work that way ).
So here is a quick setup which I think works.
Claude
I stumbled upon that before, did not see any way to do an easy array intersect (I was hoping find in array could take an array of values, not just one, but looks like that does not work that way ).
So here is a quick setup which I think works.
Claude
- Attachments
-
- array_intersect.jpg (196.57 KiB) Viewed 3467 times
- claudevervoort
- Posts: 89
- Joined: 16 Oct 2009, 02:56
- Location: Montréal, QC, Canada
- Contact:
Re: ICE Modeling Workshop 2: Cut edges
And just as I post that my brains connect and comes up with what I think is a much cleaner solution (for arrays made of integers).
Claude
Claude
- Attachments
-
- IntegerArrayIntersect.xsicompound
- (7.71 KiB) Downloaded 157 times
-
- array_intersect_no_repeat.jpg (182.57 KiB) Viewed 3464 times
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: ICE Modeling Workshop 2: Cut edges
Might be a stupid question,
but in your second tree I see no connection to the Value in "Find in Array".
Is this missing or am I missing something (which is quite probable...)?
;)
but in your second tree I see no connection to the Value in "Find in Array".
Is this missing or am I missing something (which is quite probable...)?
;)
Stay safe, sane & healthy!
- claudevervoort
- Posts: 89
- Joined: 16 Oct 2009, 02:56
- Location: Montréal, QC, Canada
- Contact:
Re: ICE Modeling Workshop 2: Cut edges
Oh that array is just the final array i.e. intersection array, so you can just plug it wherever you need the result.
Claude
Claude
- Hirazi Blue
- Administrator
- Posts: 5107
- Joined: 04 Jun 2009, 12:15
Re: ICE Modeling Workshop 2: Cut edges
I've plugged the compound into an ice tree now and I think I see now what's going on. The info I was missing (as I couldn't see it from looking at the graph alone), was that you set the "Value" port of the "Find in Array" node to "2".
Nice work, BTW...
;)
Nice work, BTW...
;)
Stay safe, sane & healthy!
Re: ICE Modeling Workshop 2: Cut edges
Claude, that is seriously the sexiest piece of ICE tree I've ever seen. It's freaking ingenious!claudevervoort wrote:And just as I post that my brains connect and comes up with what I think is a much cleaner solution (for arrays made of integers).
I've got to try this out right away..
Re: ICE Modeling Workshop 2: Cut edges
It works! Unfortunately the edge cutting is pretty slow. Optimizations are needed. Or maybe an entirely different method to figure out which vertices to connect.
Edit: Bad compound removed
Edit: Bad compound removed
Last edited by Chris_TC on 15 May 2011, 21:24, edited 1 time in total.
Re: ICE Modeling Workshop 2: Cut edges
Ahahahaha, I'm an idiot. The Add Edge can take per polygon arrays as inputs. New compound will be a hundred times faster. Coming right up.
- Attachments
-
- EdgeCuttingWIP3.xsicompound
- (46.34 KiB) Downloaded 153 times
Who is online
Users browsing this forum: No registered users and 9 guests