sprockets TV Commercial by Matt Campbell Greeting of Christmas Past by Gerry Mooney and Holmes Bryant! Learn to keyframe animate chains of bones. Gerald's 2024 Advent Calendar! The Snowman is coming! Realistic head model by Dan Skelton Vintage character and mo-cap animation by Joe Williamsen
sprockets
Recent Posts | Unread Content
Jump to content
Hash, Inc. - Animation:Master

Recommended Posts

  • Hash Fellow
Posted

Today we speculated on how to get AI to do mundane tasks like closing 5 point patches in A:M.

I think the rules for 5-point patchs are like this...

  • A patch is a set of 3, 4 or 5 CPs connected by two or more splines.
  • Each CP in the set is connected by splines to two and only two other CPs in the set.
  • For any two CPs in the set, a spline that connects them has no other CPs between the two CPs. (This will be true only for patches in which each side is a different spline.)
  •  [some rule about how the splines can be followed to loop around the patch to all the other CPs and return to the starting CP]

If a set of five points meets those rules it can be a five-point patch.

 

However, Rodney notes...

Quote

We'll have to feed ChatGPT some of Martin's info and algorithms on Hash Patches to get AI to understand what is going on with A:M models.  It doesn't understand what a valid patch is yet at this point so of course it's failing with 5 pointers as well.  I did get it to create some working models with splines without patches though.  It doesn't like to actually connect those splines yet however and that is rather important to getting patches.  ;)

 

What is a CP? What is a Spline?

Perhaps we can deduce some rules from a sample file like this.

  • A Spline is a sequence of CPs
  • Each CP is defined by
    • a 6-digit number that defines some style properties like peaked v. unpeaked
    • a 0 or 1 that flags if the CP is a duplicate of an existing CP
    • a unique ID number
    • x position
    • y position
    • z position
    • two dots means bias values are defaults
  • if the duplicate flag is a 1 then the ID number is followed by the ID number of an existing CP and the XYZ info will be taken from that existing CP.

 

image.png

 

 

262145 is binary 0100 0000 0000 0000 0001  This signifies a Smooth CP

262144 is binary 0100 0000 0000 0000 0000  This signifies a Peaked CP

 

  • Like 1
  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Hash Fellow
Posted

Remaining to be described... how to search a large mesh for 5-point candidates without having to test every possible set of five CPs in it?

 

Google says the formula for combinations of n points in a set of k points is...

image.png

the number of 5 point sets in 1000 points is

image.png

Which is about 8.25 trillion

In 2000 CPs there would be 265 trillion 5 point sets

If it took 1 millionth of a second to test each possible 5 point set it would still take 8.4 years to finish a search of 2000 CPs.

And yet identifying 5 pointers is instantly obvious to us when we look at a mesh.

 

 

image.gif

  • Admin
Posted

My mind goes back to the idea of odd number of control points versus even.

Ideally, we want to work with even number of control points.

1*, 3, 5, 7, 9, etc. are all problematic... primarily because dividing by two also gives us an odd number.

As discussed elsewhere we can't have a single control point... well we can but it's a bug/oddity.

The closest we can get to that 1 CP is when another is exactly in the same place... or... from specific POVs we only see 1 control point because another (or more) are hiding behind that CP due to the angle of view.

If even then we can subdivide... and subdivide and subdivide... to near infinity.

We can also duplicate... over and over again... seemingly forever.

 

So a theory off the cuff for me would be that from counting splines and control points we can narrow the scope of not just how many 5 point patches there may be but also where they may be.

 

Isn't one way to identify any open area (5 point patch eligible or otherwise) to examine that area's normal?

If there is no surface then there is no normal.

Something we have to account for of course is that an odd numbered spline times an even number will give us an even result.

So we might have to account for pairs of odd CP numbered splines, reducing then down to that inventable one that is truely 'odd'.

We can then trace along that odd spline and locate eligible areas for 3, 5, 7, 9 and other odd numbered patches.

Of course we are (at least theoretically) only interested in finding 5 point eligibility.

 

In other words, if a model has even one 5 point patch eligible area we could get rid of it by increasing the number of splines by 2 or 4 (or some other even number.  2x2=4, 2x4= 8, 2x6=12, etc.

A problem with that is overly dense models which Animation:Master deals with (when displaying models) by dynamically subdividing meshes so they have just enough detail/smoothness for where it counts with respect to the viewer/camera.

 

Pixar's SubDiv's get around part of the problem by doing an immediate step of multiplying the mesh by 2.

This ensures that all meshes can at least be divided in half/divided by 2 and therefore are always 'subdivisible'.

They still have to deal with extraordinary vertexes (3 and 5 point areas etc.) but... low and behold... those are all related to meshes having that odd man out.

  

  • Hash Fellow
Posted

 

55 minutes ago, Rodney said:

So a theory off the cuff for me would be that from counting splines and control points we can narrow the scope of not just how many 5 point patches there may be but also where they may be.

I think counting splines and control points is the right idea.

We know that every CP on a five pointer is five spline segments away from itself...

FiveHops.jpg

 

If we limit our search to finding "proper" five-pointers, five-pointers that have a different spline on each side, we could just check every five-segment path from a CP that changes splines at each intersection.

If a five-segment path doesn't lead back to the starting CP then that set of CPs is not a five-pointer.

 If a five-segment path leads back to the starting CP, then that set of CPs can be made a five-pointer...

FivePointPaths.jpg

There should be 4 * 2^4, or 64,  possible paths to check for each CP.

in a 2000 CP model that would be 128,000 paths to check.

If each path took 1/100th of a second to check, the whole model would take 21.3 minutes.

The number of paths to check could be greatly reduced by limiting the search to the "current selection".

 

  • Like 1
  • Admin
Posted

I like this potential approach Robert.

And I can easily agree that we need to drop all potential candidates if the CPs are found on the same spline.

Note that I have no idea how to do this programmatically of course.

With a proper nudge in the right direction though... that's why we are here considering AI usage.  ;)

 

Added:  I do think we should be able to quickly rule out any spline 'segment' that already has a patch applied to it.

We can't apply a 5 pointer to a set of splines that already has a patch applied to it (or at least we don't want to).

Or perhaps better stated any spline that has two patches adjacent to it.

 

And, isn't there already a plugin that finds 5 point patches?

  • Hash Fellow
Posted

I'm trying to work out how to explain it to the bot from the beginning:

 

An A:M model is made of patches.

Patches are made of splines.

Splines are a sequence of connected Control Points also known as CPs.

A sequence of connected Control Points is found between every pair of <SPLINE> </SPLINE> tags in the model file.

Every line between the <SPLINE> </SPLINE> tags defines a Control Point.

The line has several values separated by spaces

  • an integer that defines style properties like peaked v. unpeaked
  • a 0 or 1 that flags if the Control Point is a duplicate of an existing CP
  • a unique ID number for that Control Point
  • x position in Cartesian coordinates
  • y position
  • z position
  • other numbers may follow to define additional properties or two dots may indicate those properties are at default values.

If the second value is a 1 then the fourth value will be the ID number of an existing CP in another Spline and this Control Point's  X Y Z location will be inherited from that existing CP.  The two CPs form an intersection between the current Spline and the Spline the other existing CP is a member of.

A Spline Segment is the portion of a Spline from one Control Point to the next or the previous Control Point in a sequence with no intervening Control Points.

To be continued...

 

  • Admin
Posted

Here's an interesting model I want to remember as there are some ideas attached to it I want to follow up on:

 

<MODELFILE>
ProductVersion=19.5
Release=19.5 PC
<POSTEFFECTS>
</POSTEFFECTS>
<IMAGES>
InstanceCropStyle=InsteadOfCache
</IMAGES>
<SOUNDS>
</SOUNDS>
<MATERIALS>
</MATERIALS>
<OBJECTS>
<MODEL>
<MESH>
<SPLINE>
262144 0 1 -1.86365604 2.01896167 0 . .
262144 0 2 -2.22603416 -4.08969021 0 . .
262144 0 3 1.5530473 -2.74371624 0 . .
262144 0 4 2.95078969 1.13890147 0 . .
262148 0 5 2.58841228 5.48743343 0 . .
</SPLINE>
<PATCHES>
1 1 5 4 3 2
</PATCHES>
</MESH>
<FileInfo>
Organization=Open Animation Library
Url=newartofanimation.com
Email=rodney.baker@gmail.com
LastModifiedBy=Rodney
</FileInfo>
</MODEL>
</OBJECTS>
<ACTIONS>
</ACTIONS>
<CHOREOGRAPHIES>
</CHOREOGRAPHIES>
FileInfoPos=482
</MODELFILE>

I should not have named the attached 'Simple5pointer' as it isn't your standard 5 pointer but rather that very interesting exception where one spline can be a 5 point patch.  

Consider that we could... although perhaps would not want to... place a 5 point patch or better yet a valid set of 4 point patches directly over a valid area that could be closed as a 5 point patch.  These might not be 'attached' in the classic sense of spline attachment but might be 'glued' to CPs so that the floating patch exactly covers the area.  A rendering algorithm would likely smooth the transition between meshes.

The thought here is that all extraordinary vertex might receive this type of floating patch which because it isn't actually attached with continuity of splines to the main mesh would not adversely distort the area in any significant way.  As these floating patches would be 10 or more quad patches (5*2 being the lowest common denominator) they would not be subject to artifacting on the surface and only the edges would need to be given additional attention.  If the area to be covered by the 5 pointer the floating patch might consist of 20 four point patches or whatever number required to meet the needs of the model.  The users focus would be to choose the density of that floating patch if something other than the default is desired.

In the case of the attached mainly consider the variation we can get in patch coverage with a flat 5 point patch on one single spline whether peaked, smoothed or both.  Compare then then with a similar set of patches covering that same area but not flat.


Added:  Note the values of the spline and the patch and how simple they are.

What this suggests to me is that (in theory) all 5 point patches could have the same spline patch data.

It would just be their orientation and placment that is variable.

 

Simple5pointer.mdl

  • 1 month later...
  • Hash Fellow
Posted

A bit more I've discerned about CP definitions

Line 46 is a Hook:    266257 1 26 0.75 6

image.png

The second value, 1, means it is a "copy" CP. The third value is the hook's own CP ID,  but the fourth value, 0.75, is how far along the spline it hooks from the CP ID in the fifth value, 6.

Only 0.25  0.5 and  0.75 are allowed

 

the style integer has bits on in the 16 and 4096 place
image.png

 

 

 

 

Join the conversation

You are posting as a guest. 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...