View Full Version : Bitmap to rotation - particle challenge

 jonahhawk04 April 2007, 11:28 PMHave a look at the link below. We are trying to create a CLOSEUP shot of a sculpture like this. We have the long shot figured out, simply using displasement on the lower verts of each panel. This deforms the panels by stretching them back and forth. We have had some success with reactor and wind on smaller sets of panels but on large arrays max breaks. We have created great animated diplacement maps using wave and smoke maps, and applied them with displacement. What we would like to do is use the bitmap to rotate the panels instead of deform them. Any clues? (http://nedkahn.com/videoplayer/videoplayer_v2.html?vidpath=../videos/technoramaFacaVP6_384K.flv&clipTitle=Technorama%20Facade) (http://nedkahn.com/videoplayer/videoplayer_v2.html?vidpath=../videos/technoramaFacaVP6_384K.flv&clipTitle=Technorama%20Facade) http://nedkahn.com/videoplayer/videoplayer_v2.html?vidpath=../videos/technoramaFacaVP6_384K.flv&clipTitle=Technorama%20Facade http://nedkahn.com/wind.html#
Bobo
04 April 2007, 05:59 AM
Ok, here is what I did:

*Create a Plane with 99x99 segments (10000 vertices)
*Create a PFlow
*Create as many particles as vertices and place one particle on each vertex (I used a Birth Script, but a regular Birth and Particle Obejct+ by Orbaz could also be used)
*Assign a small plane the size of the segment to each particle using Shape Instance
*Assign a Material with a bitmap texture (static or animated) in the diffuse slot to the original Plane
*Hide the plane
*Add a Script Operator which reads the UVs of the plane, reads the texel color at that coordinate and rotates the particle +/- 30 degrees based on the value of the pixel.

Quicktime (10MB):
http://www.scriptspot.com/bobo/mxs9/RotateParticlesByBitmap/rotateparticlesbybitmap.mov

Source:
MAX7_RotateByBitmap.max
(http://www.scriptspot.com/bobo/mxs9/RotateParticlesByBitmap/MAX7_RotateByBitmap.max)EDIT: I replaced the Max 9 file with a Max 7 version which is also slightly optimized.
It should load in Max 7, 8 and 9. If it does not, let me know...

NOTES:
*If you want more rotation, just change the values in the script.
*If you have procedural maps, render them to a single bitmap sequence and load as IFL - I used an IFL of a baked Turbulent Noise Map that looks like caustics.
*In the special case of a plane, each mesh vertex corresponds to exactly one map vertex with the same index. This is not true in the general case but simplifies the work with the plane as you don't have to resolve UV maps though the mesh and map faces.

http://www.scriptspot.com/bobo/mxs9/RotateParticlesByBitmap/RotateParticlesByBitmap_screenshot1_tn.jpg

http://www.scriptspot.com/bobo/mxs9/RotateParticlesByBitmap/RotateParticlesByBitmap_screenshot2_tn.jpg

rdg
04 April 2007, 06:08 AM
Thanks Bobo for that breakdown.

jonahhawk:
There was once a maxscript challenge 'converting bitmaps to planes (http://forums.cgsociety.org/showthread.php?f=98&t=271753&highlight=challenge)'.
Maybe you can find there some inspiration and snippets for your project.

Georg

handiklap
04 April 2007, 02:27 PM
On a side note, this reminds me of a series I saw a while back where the artist used a webcam to capture live video of the exhibit patrons, took that video and translated the frame bitmaps to drive actuators that rotated a grid of objects on their local X-axes - sometimes square tiles, sometimes organic shapes pieced together stonework style - towards and away from a light source, effectively varying their "color" depending on specular highlighting. Imagine a big wall of "junk" displaying a live video feed (albeit in a very degraded resolution), with this incredible click-swooshing sound as the panels rotated in succession.

jonahhawk
04 April 2007, 02:12 AM
Thanks for that Bobo!

We have yet to roll out Max9 on all of our workstations (including mine). But we have it on one test station. I'll have a look at the file this weekend maybe.

We got as far as the Particle Object+ on our own before looking for help. I created an animated plane and Particle Instance and spawned from static to animated particles with colision tests. This was fun but not wwhat we wanted; too regular. I'm sure I could take that metod further with more colliders and variation but we knew there was a better way out there.

Brian, the guy really faced with gietting the job done, ended up with displacement for the long shot and reactor for a closeup. The results are great visually. But we know in our minds that the displacement method is deforming not rotating.

@hanndiklap: I found that thread right at the begining but get boggled by the script. It's just too deep for me to take it to the next level. Only one of us here is a decent scriptor and he has been busy with other projects. So we have had to avoid the scripting route.

With the wooed mirrors are you talking about Daniel Rozin? http://www.smoothware.com/danny/

Bobo we have The Matrix: Explained as well as the fundimentals 1 and 2. We need to learn MaxScript, that's all there is to it.

Following your hints, I'll give it a go this weekend.

The peeps over at the VRay forum reminded me to post here in the hopes of catching your attention. Thanks for taking interest and taking the time to work it out.

jonah

hogobingo
04 April 2007, 01:27 PM
many thanks bobo u still my hero

Bobo
04 April 2007, 04:06 PM
Thanks for that Bobo!

We have yet to roll out Max9 on all of our workstations (including mine). But we have it on one test station. I'll have a look at the file this weekend maybe.

I replaced the example with a Max 7 version which should load in 7, 8 and 9. See my initial post for the new link.

The file attempts to use the standard texture file HOUSE.JPG which ships with Max in the maps\backgrounds folder. Replace with your own. If the bitmap is not found, the script would fail.

I also simplified the code a bit, avoiding the necessity to Xform the instanced shape and flip the axes of the matrix.

If you rotate the Plane01 main object and update the PFlow, the tiles should still align correctly to it, so it should work for arbitrary alignments and not just a vertical plane.
It does NOT work with arbitrary geometry (like cylinder, sphere etc.) because I am using the node tmatrix and not the orientation of the vertex itself.

BakerCo
04 April 2007, 08:06 PM
thanks for that Bobo that is some pretty sweet work.

-Baker

CGTalk Moderation
04 April 2007, 08:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

1