General Category > ASL Scripts

Old Magnet Tool

<< < (7/15) > >>

Francesco:
Hi all,
here I am with a pre-release of my multi-magnet tool. In some way it does what Neirao suggested - that is, you can use any mesh as magnet and try to emboss or carve its shape over a finely faced surface. Sort of clothing, but really bumpy at this very stage.

In shorts: each vertex of the magnet becomes a magnet itself.

I was about to start from scratch with stuff like computing if a point falls here or there, when related to a magnet's face, but I think I need a firmer grasp on such things before writing the script.

Changing the spherical magnet into a bunch of smaller spherical magnets was easier and quicker to do, by modifying the original script, so here you have the first results in four files:
- an example picture;
- the "multimagnet" script;
- the "show ranges" script;
- a "multimagnet" project;

The "multimagnet" script is the one doing the work. If you already have the needed materials set in a project you can try it out at once (the needed materials are the same used by the "magnet script", they are in the "magnet project" I attached before in this thread).

The "show ranges" script can be used to display the range of action of your magnet. You only need a mesh named "MAGNET" to run this script. The script adds a sphere for each vertex of your magnet displaying the range of action of each vertex. When the script stops, all the added spheres remain selected, so, if you had nothing selected before running it, you can get rid of all the spheres hitting "DEL" on your keyboard.

The "multimagnet" project isn't really needed, but there you have the magnet I used in the example picture and the all-triangles sheet I use to test the magnet. I saved this project in the state it was when I took the screenshots below, if you care to know. I didn't attach the bitmaps this time, so I suggest you to paste the project in the same folder of those AXYZ pictures, if you want Anim8or to load them.

The picture:
1 - the magnet alone;
2, 3 - a sphere for each vertex' range;
4 - mesh01 and the magnet;
5 - range of action from another angle;
6 - result on mesh01 after fiddling around with M_PUSH_Z

An important detail: the range of action of each vertex is nothing more than its distance from the nearest neighbour. Hence, more points will give you a more detailed and less bumpy magnet. The "show ranges" script will show you exactly what you are dealing with.

Sorry if, again, it looks all messy, incomplete and not so clear with the explanations, but I'm in a hurry.

Let me know your opinion, if it sounds promising I can keep this script and continue working on it, otherwise I would switch to the "other way" (checking and changing mesh01 against each magnet's face).

Anyway, by the way, have fun,
Francesco

odp04y:
This is a really useful script ;D

Posting an example of what it can do.

Francesco:
Thank you odp04y, also for posting that example.

A side note: now that the surface of the magnet is made up of several small magnets, you should take care of approaching the magnet to the mesh step by step. If you intersect the two too quick some points of the mesh will fall in the "backside" of each magnet, and those points will be pulled instead of being pushed (or vice versa, it depends from the material you are using).

I look forward for your experiments with this script, people, and even more for your advice (otherwise I'll go on making this stuff the way I see fitting ;) ).

Thanks a lot to all of you for your attention, I'm really glad.

bamman62:

--- Quote from: neirao on October 26, 2008, 06:34:32 pm ---Francesco VERY COOL SCRIP!!! CONGRATULATIONS!! ;)

I have two sugestions for Future using your script OK... ::)


--- End quote ---

Somehow you always manage to make these awesome looking pictures that perfectly display your idea... :P

Anyway, reminds me of nCloth in Maya.

Great idea. (A carve script would be really awesome though)

Francesco:
First things first: the Multi-Magnet Script is pure crap - although the Showranges script is funny in my opinion.

I wonder why nobody suggested me to throw away that crap, but I think that Bamman62's parenthetical "(A carve script would be really awesome though)" would kindly mean the same, and I agree ;-)

So then, I struggled a lot and I came up with the Polimagnet script, that I share in a .a8s and a .jpg, both attached to this post.

So please go ahead and try clothing or carving something, but bear in mind what follows - I will remove all those limitations, but I need some of your help before doing that:

Limitations:
- the magnet must be a well formed, all-triangles mesh;
- you cannot rotate the magnet, you cannot rotate mesh01;
- you can only use "M_PUSH" materials (I seriously think that M_PULL modes are unneeded);

The juice in few words: the script checks if a point of mesh01 lies between magnet's origin and one of its faces. In such a case the point will be pushed away from magnet's origin till magnet's surface.

Notice that magnet's origin is not its pivot. You might want to manually set magnet's location to (0,0,0). Magnet's origin will be on world's origin then. I'm gonna fix that.

Temporary tweaks:
- you can modify the magnet or the mesh in point edit mode (you can also rotate them);

Final note: the script only cares about mesh01 points, hence mesh01 can have all sorts of facets (tri, quad, poly). But resulting faces could be messed up, up to you to use non-triangular facets (converting to subdivided could eventually fix that?).

Now the most important thing: I need some help with the transformation matrices for applying the rotations... somebody wants to give me advice? It's something I cannot grab my mind on.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version