ICE Modeling Workshop 2: Cut edges

Here you can find ICE tutorials and learning material
Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 13 May 2011, 17:33

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

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 13 May 2011, 19:16

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

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 13 May 2011, 23:00

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.

Image

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: ICE Modeling Workshop 2: Cut edges

Post by Hirazi Blue » 14 May 2011, 09:16

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)
~x(
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!

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 14 May 2011, 12:56

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)
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.

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.
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 assume that my current method is completely wrong.
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.
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)
;)
Here you go. The compound expects three nulls: CutterNull1, CutterNull2, CutterUpvector
http://www.mediafire.com/?vxpn5dz9apdxd5p

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 14 May 2011, 13:11

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

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 14 May 2011, 19:04

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]

Image

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: ICE Modeling Workshop 2: Cut edges

Post by Hirazi Blue » 14 May 2011, 21:18

I've tried to set something up, but as a perpetual ICE NOOB I didn't get far... ~x(
I could tell you "exactly" how to do this in Python...
but arrays in ICE... x_x
Sorry, not a helpful post: I just wanted to vent... ;)
Kudos for the nice explanatory image, BTW
Stay safe, sane & healthy!

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Re: ICE Modeling Workshop 2: Cut edges

Post by claudevervoort » 15 May 2011, 17:21

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
Attachments
array_intersect.jpg
array_intersect.jpg (196.57 KiB) Viewed 3467 times

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Re: ICE Modeling Workshop 2: Cut edges

Post by claudevervoort » 15 May 2011, 17:33

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
Attachments
IntegerArrayIntersect.xsicompound
(7.71 KiB) Downloaded 157 times
array_intersect_no_repeat.jpg
array_intersect_no_repeat.jpg (182.57 KiB) Viewed 3464 times

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: ICE Modeling Workshop 2: Cut edges

Post by Hirazi Blue » 15 May 2011, 18:00

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...)?
;)
Stay safe, sane & healthy!

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Re: ICE Modeling Workshop 2: Cut edges

Post by claudevervoort » 15 May 2011, 18:40

Oh that array is just the final array i.e. intersection array, so you can just plug it wherever you need the result.

Claude

User avatar
Hirazi Blue
Administrator
Posts: 5107
Joined: 04 Jun 2009, 12:15

Re: ICE Modeling Workshop 2: Cut edges

Post by Hirazi Blue » 15 May 2011, 20:21

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...
;)
Stay safe, sane & healthy!

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 15 May 2011, 20:27

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).
Claude, that is seriously the sexiest piece of ICE tree I've ever seen. It's freaking ingenious! ^:)^

I've got to try this out right away..

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 15 May 2011, 21:12

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.

Image

Edit: Bad compound removed
Last edited by Chris_TC on 15 May 2011, 21:24, edited 1 time in total.

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 17:43

Re: ICE Modeling Workshop 2: Cut edges

Post by Chris_TC » 15 May 2011, 21:23

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

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests