11 Replies Latest reply on Mar 21, 2007 3:25 PM by PiratesMoon

    3D spatial relationships in Flash?

    livelywoodsprite
      I am trying to develop a diagnostic/inquiry tool for a local chiropractor in Flash, integrating an account management/email PHP application with database and Flash actionscript using some of the more advanced features of Flash, such as drag-and-drop, dynamic resize of elements, and particle management in a vector-based self-contained unit.

      The idea is that the potential patient would be able to spin and/or manipulate the chosen figure – either male or female – and drag resizable red blotches onto key-point areas to indicate where their pain is located on their body and how large an area is affected. I was thinking that being able to edit the color to indicate the intesity of pain would be a good feature. On submit, the Flash application would then save the edited version and export the vector-based 3D representation of the patient with random-generated ID or blind user-name to protect the identity of the patient, along with the results of a short information collection form, associate it in the database with date, statistics, image, patient ID, etc and email the doctor that a new patient has used the tool. He will then log in and view the recorded 3D image of the patient and read the collected complaint from the new patient and subsequently be able to reply to the patient with an invitation to visit his practice (perhaps a thank-you coupon for using the website interface) and perhaps some feedback or reassurance. I want the user to feel as if they have accurately communicated their complaint to the doctor by providing an encompassing 3D image & audio interface for the experience.

      I want to be able to use actual scanned 3D digital data of real figures in the Flash application. While scans are usable as a still-figure movie frames, the whole thing would ultimately be more compact and versatile using static vector information or vector interpolated point references such as are used in typical 3D rendering programs, using either triangle or polygon-type spatial rendering.

      I would also like to incorporate scans of body parts which could conceivably be manipulated within the program (lifting an arm to expose the underside, for instance, or helping to visualize the arch of the foot with the foot lifted or pressing at an angle)

      I want to use real-data reference scales for resizing. It would be great if the patient could somehow indicate overall body morphism by dragging points around – making the model taller, heavier, thicker in the hips or stomach, etc.

      I have seen some places where there are published relationship equations, such as one clothing manufacturer web site relating a size 6 dress to a size 16 dress, or another site I visited where the medical study was about body-mass index and the models size relationships indicated a percentage of body fat to weight & shape ratios.

      What I especially like about the scanner-product images is the fine rendering of the contour-mapping of exterior surface detail without the visual interruption of localized distinguishable personal features. These images would clearly be usable to represent a generic patient image.

      I'm not sure if Flash is the appropriate medium to be working in for the end result of a web-accessible viewer, since Flash seems to be limited to using vector information in only one dimension.

      Does anyone have suggestions about how to do it?
        • 1. Re: 3D spatial relationships in Flash?
          Level 7
          MilkyMamaMayhem,

          > I am trying to develop a diagnostic/inquiry tool for a local
          > chiropractor in Flash, integrating an account management/
          > email PHP application with database and Flash actionscript
          > using some of the more advanced features of Flash, such
          > as drag-and-drop, dynamic resize of elements, and particle
          > management in a vector-based self-contained unit.

          Compared with the rest of your post, the features you just mentioned are
          hardly the "more advanced" you'll need to address. ;)

          > The idea is that the potential patient would be able to spin
          > and/or manipulate the chosen figure ? either male or female
          > ? and drag resizable red blotches onto key-point areas to
          > indicate where their pain is located on their body and how
          > large an area is affected. I was thinking that being able to
          > edit the color to indicate the intesity of pain would be a
          > good feature.

          This is do-able, to an extent. Flash does not support a 3D modelling
          engine, but impressive simulated 3D can be accomplished with extensive
          advanced programming.

          > On submit, the Flash application would then save the edited
          > version and export the vector-based 3D representation of
          > the patient ...

          Export where? How? Flash is certainly capable of talking with
          server-side middleware, but depending on the complexity of the data you want
          to send, you may have to export an abstraction that can then be "re-built"
          later by the chiropractor.

          > He will then log in and view the recorded 3D image of the
          > patient and read the collected complaint from the new
          > patient and subsequently be able to reply ...

          Sure thing. That will require a back end (server software) separate
          from the Flash portion of this project.

          > I want to be able to use actual scanned 3D digital data of
          > real figures in the Flash application.

          This is one of the ways 3D can be simulated in Flash. Pre-rendered
          images that are "rotated" to appear as if actually modelled in 3D.

          > the whole thing would ultimately be more compact and
          > versatile using static vector information or vector interpolated
          > point references such as are used in typical 3D rendering
          > programs, using either triangle or polygon-type spatial
          > rendering.

          At this point, you're comparing apples and elephants, but again ... this
          sort of thing can be *simulated* in Flash.

          http://www.kirupa.com/developer/actionscript/3dindex.htm
          http://www.adobe.com/devnet/flash/articles/3d_classes.html

          > It would be great if the patient could somehow indicate overall
          > body morphism by dragging points around ? making the model
          > taller, heavier, thicker in the hips or stomach, etc.

          Even this is possible, but challenging to program.

          > I'm not sure if Flash is the appropriate medium to be working
          > in for the end result of a web-accessible viewer, since Flash
          > seems to be limited to using vector information in only one
          > dimension.

          This last part baffles me. As erudite as the rest of the post sounds,
          this last statement doesn't just ring true. How is Flash limited to one
          dimension?

          > Does anyone have suggestions about how to do it?

          This would be a project for the stout-hearted only. I wouldn't even
          approach something of this complexity unless I was convinced I knew
          ActionScript inside out. A "how to" on the project you've described is
          outside the scope of any post I've seen -- ever. That said, I would
          recommend you familiarize yourself with 3D modelling theory (the above links
          are a good start) and, separate from that, familiarize yourself with
          ActionScript programming to an advanced level. In addition, familiarize
          yourself with a server-side programming language to an intermediate level.
          Then ... dig in. :)


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: 3D spatial relationships in Flash?
            livelywoodsprite Level 1
            WOW, yeah! Thanks for the links!

            More more more - this is great! Using classes? what a thought - just like in PHP - hadn't occurred to me. Thanks!
            • 3. Re: 3D spatial relationships in Flash?
              livelywoodsprite Level 1
              Thank you for contributing to the answer – at least giving me a starting point.

              I’m one year into learning PHP and actionscript – and I have learned some pretty advanced things before I had the basics down pat, so some of my learning curve is certainly not the usual. I’ve pulled apart a lot of example material and analyzed the code and how it works – and PHP and actionscript seem to be very similar and I find it easy to work back and forth between the two to make database-driven flash pieces. But using javascript from within flash has been a real challenge. See? That’s what comes of being self-taught and curiosity-driven. Managing to control particle driven events like swarming or whirlwind was a big break-through to me and I was hooked on actionscript after that. Drag-and-drop was easy, but when I took a class in Flash, it was at the end of the 8 weeks and called “advanced”, so I assumed it was and what did I know? I was bored the whole time because I already knew all that stuff, and it was called a secondary class!

              I usually need 2 or 3 working examples of the function that needs to be included to determine the relevance of each line of code and examine the method needed to make it work, and then how to plug in the math. I haven’t been able to “capture” an example of what I’m looking for, which is why I posted the question.

              Thank you for those links. I have not been able to figure out how to get 3D data into Flash without destroying the vector information and creating a mess. This is a good start. When I try to export to Flash it gets the points and relationships confused and it looks like a spider web on LSD or flattens the image into frames, and I also could not import directly without using expensive specially made plug-ins I don’t have. Yet. That’s why the comment about Flash being flat. It doesn’t have a 3D environment to build in, like building a scene with x-y-z values and setting lighting and stage proportions and viewer perspective. The Flash canvas goes from left to right and up to down and if you want to make something appear to come from behind you have to “animate” either a Flash generated image along a path, or write it out in actionscript.

              And I haven’t been able yet to actionscript something where several pieces have relationships (like an animated person made of actionscripted relative shapes with axis – arms, legs, torso, etc defined as shape with fill) to be able to respond to interaction determined by external direction like in a game AND make it also be able to move from foreground to background with shape morphing and size changes. I can do each thing separately, but trying to get them to work together is really a challenge.

              Seriously – I want to do this thing, even if it takes me a year and 10 versions to refine it. If you have more references, please do let me know. I do have a Safari subscription to O’Reilly, and it does help when I KNOW what I’m looking for, you know, the actual terms for things. That’s the hard part – getting the terminology down so I can get the information directly.

              OOOh – and another thing – can I somehow make a feathered mask in Flash? Instead of solid? And can I do the mask dynamically in actionscript somehow, and also apply effects to the mask in the same definitions?

              Thanks so much!

              • 4. Re: 3D spatial relationships in Flash?
                Level 7
                MilkyMamaMayhem,

                > And I haven?t been able yet to actionscript something
                > where several pieces have relationships (like an animated
                > person made of actionscripted relative shapes with axis ?
                > arms, legs, torso, etc defined as shape with fill) ...

                Pop into the nearest Barnes & Noble, or the like, and pick up a copy of
                Keith Peters' "Foundation ActionScript Animation: Making Things Move!".

                > OOOh ? and another thing ? can I somehow make a
                > feathered mask in Flash?

                Here's a tutorial from Community MX. They offer free trial memberships,
                so it won't hurt you a bit to jump in and poke around. :)

                http://www.communitymx.com/abstract.cfm?cid=1BD82


                David Stiller
                Adobe Community Expert
                Dev blog, http://www.quip.net/blog/
                "Luck is the residue of good design."


                • 5. Re: 3D spatial relationships in Flash?
                  Level 7
                  > This is do-able, to an extent. Flash does not support a 3D modelling
                  > engine,

                  :)) Take a look:

                  http://blog.papervision3d.org/



                  --
                  -------------------------------
                  Remove '_spamkiller_' to mail
                  -------------------------------


                  • 6. Re: 3D spatial relationships in Flash?
                    Level 7
                    Peter,

                    >> This is do-able, to an extent. Flash does not
                    >> support a 3D modelling engine,
                    >
                    > :)) Take a look:

                    Darn it, man, you're keeping me on my toes! :-p What I was thinking
                    and what I wrote were two different things. I should have said, "Flash does
                    not support a *native* 3D modelling engine," such as, for example,
                    Director/Shockwave. It's not built-in.

                    The Papervision3D engine is a tremendous development. Not the first
                    I've seen, but certainly the most impressive.


                    David Stiller
                    Adobe Community Expert
                    Dev blog, http://www.quip.net/blog/
                    "Luck is the residue of good design."


                    • 7. Re: 3D spatial relationships in Flash?
                      livelywoodsprite Level 1
                      Oh Yay, guys!
                      (same person originating question - corrected screenname)

                      Thank you so much for providing me the access points to launch from and the vocabulary to search with. I have been reading now for like 12 hours like a total sponge and all of this is so very exciting to me. You have opened this window for me and I am enraptured by what I am learning. Actionscript 3D is blowing me away! and Papervision is way cool - can't wait to try my hand at some things here.
                      • 8. Re: 3D spatial relationships in Flash?
                        Level 7
                        > Darn it, man, you're keeping me on my toes!

                        Lol - glad to hear it ;) It is very good indeed...

                        --
                        -------------------------------
                        Remove '_spamkiller_' to mail
                        -------------------------------


                        • 9. Re: 3D spatial relationships in Flash?
                          PiratesMoon
                          In Director, prior to the 3D engine, we used to code coordinate systems to mimic 3d, but not vertex representations of images. Just the coordinate system alone with scaling and rotating was a heavy scripting session. I don't recommend this in Flash.

                          Your idea of a series of frames where the image is seen in-the-round rotation is better. This way you strike a happy medium between vector graphics and the real body view. The vector graphics could be the blotches you mention, which you could allow the user to drag-and-drop, scale, rotate, and change the colors of to indicate the position, size, and pain of the area. Your database memory would have to retain the frame (of the figure) the user is on, the xy coordinate of the blotch, the scale of the blotch, the color of the blotch, and any text the user enters.

                          As far as lifting appendages to resolve the painful area, that will only be as good as the images thay you have to work with. If the client wants to pay for it, there are figures and anatomical studies in 3d that can be manipulated for this project. An example of a 3D generated figure is here http://www.daz3d.com/i.x/3d_models/overview/-/? Scroll down a little to view the figure in the round (Flash player by the way). They also have anatomical 3D studies. This is a low end 3D program; the high end ones like Maya provide even better imagery.

                          Your project is doable, but I don't recommend building a 3D engine in Flash. I do recommend Flash to - interactively manipulate images in the round using a vector system for describing the pain, to communicate with PHP, and to use the same presentation from a reverse point of view to retrieve the information from the database for the Doctor to view. I think this is an acceptable solution.

                          As far as body morphing, this is a more difficult prolem to pull off realistically with Flash. Rather than try to buld a vertex 3D rendering engine in Flash, maybe a number of seperate Flash modules that were generic to each body type needed would be easier to develop. These could all plug into a common manipulation shell "main" movie clip. Which moudule is being used would be one more thing to have the database store.

                          I have done a number of medical projects, and this is my best advice.

                          Richard
                          • 10. Re: 3D spatial relationships in Flash?
                            livelywoodsprite Level 1
                            Thank you for this feedback - this is actually how I planned to start the project - using 3D manipulations in Maya7 (that's what I have at the moment) to render frames just to get the Flash interface started with the actionscripted coordinate stuff I need to get done, and then work out how to tackle the 3D vector information, if that is even possible.

                            That's the part I am finding most challenging so far - relating 3D information to some mathematical relationship that I can work with. I have examples of how the first parts could concievably be coded, with several variations of each type of method in combinations of animation and actionscripting.

                            I haven't been able to find an actual working example of what I want the end product to be, nor any code examples of how to handle the complex vector information required for 3D inclusion, which is why I posed the question in the first place.

                            I originally was thinking that the vector equations required could perhaps be refined to point-relational constants that could be applied to each point positionally using one "network" of assembled mesh that could be reconfigured based on the variables input - like if the person is 5' 6" and 250 lbs the form would apply those variables to the overall representation defined in the relationships, which would appear very different from 6' 5" and 220lbs, for instance. If there was a basic formula for spatial relationships in the mesh definition based on vertex or corner ratios for size and shape, the actual body model could be redefined accurately according to input variables instead of dragging - maybe some room for extra variables like whether the person is pear-shaped or apple-shaped in addition to being generally of this weight and height. If I could make this "definition" of the mesh structure a mathematical equation which would be "assembled" or called outside of Flash but visually rendered in some kind of Flash-based viewer that could perform the user-based interactions, and then export either the edited math or the finalized compacted presentation, like as an swf.

                            I am still assembling and reading all this stuff you guys are putting up here for me to work with - I am very grateful for the feedback! I think this whole thing would be impossible without this kind of guidance.
                            • 11. Re: 3D spatial relationships in Flash?
                              PiratesMoon Level 1
                              Follow up:

                              Two books that may be useful for you

                              1. Actionscript Animation by Keith Peters, published by friendsOfEd
                              has a chapter on 3d Basics which discusses 3D wrapping. This may save you some coding.

                              2. Macromedia Flash MX 2004 Game Development by Glen Rhodes, published by Charles River Media
                              has a chapter on Entering the Third Dimension, which may also save you some coding time as it includes a section on depth shading.

                              If, from the above, you are talking about developing a faux plugin to Flash - perhaps a PHP web service can handle the calculations. - I always try to offload that kind of calculation to the client side, and Flash has no plug-in architecture per se. Just passingHTML variables, there is a little lag time with PHP and Flash. You might speed that up with binary datasets using some form of Remoting.

                              Anyway, sounds like an interesting project.