4x4x4 Lattice deformer in Daz Studio -- pre-release / Beta / Unfinished PC/Win x32 / x64 version av

mCasualmCasual Posts: 4,605
edited April 2013 in Freebies

last time i checked the patent on Lattice deformers had run its course ( 1986-2006 )

so i think i can safely integrate it as a plugin or a script

shown below is my first attempt

the scaling-up effect is not supposed to happen

but .... the torus being stretched as if one corner of the lattice is pulled up and away is what i want !

so ... this spring or summer .... should be very useful for poke-through fixes

the deformation is added to the object as a morph channel

-----------

second test, second image, that's more like it !

the torus being deformed is 512 vertices and the test script took only 8 / 10th of a second to compute the morph

so, lets say a 10000 vertices dress would take 16 seconds to lattice-deform

guess we better make it a plugin ... maybe interactive

--------

the maths are all explained here
Real-Time Soft-Object Animation Using Free-Form Deformation
by Alex Ferrier
August 27th 1999
http://www.gamasutra.com/view/feature/131779/realtime_softobject_animation_.php
itself based on
Sederberg, Thomas W.; Parry, Scott R. (1986). "Free-form deformation of solid geometric models".
SIGGRAPH Computer Graphics (ACM) 20 (4): 151–160.


************************************************************************
** sneak peek **** sneak peek **** sneak peek **** sneak peek **
************************************************************************
pre-beta for the adventurous Indiana Jones’s ( or uh the Marion Ravenwood’s )
https://sites.google.com/site/mcasualsdazscripts3/mcjlattice
This is an early version of mcjLattice for DS4.5 PC/WIN
it possibly contains bugs which will crash Daz Studio
( but so far this didn’t happen too often )
if you save a scene containing this version of an mcjLattice node
it may later make the re-loading of that scene problematic
you could proceed this way:
use mcjLattice to create the deforming morph
delete the mcjLattice node, delete the control points,
save this scene or export the morph or the morphed shape
then use morph-loader ... or ... well i dont know DS4.5 that well smile
************************************************************************
for now the plugin works best on objects that remain at their zero position, no rotations
it may work on figures ( see i didnt get to that part yet ) but the figures must be in their zero pose
and the morphis applied to the whole figure
i hope to be able to deal with figure body parts in non-zero-pose poses
************************************************************************

ffart.jpg
626 x 240 - 25K
morlikit.gif
480 x 270 - 183K
maybe.gif
840 x 524 - 644K
Post edited by mCasual on
«13

Comments

  • mCasualmCasual Posts: 4,605
    edited April 2013

    my code will be based on the article
    Real-Time Soft-Object Animation Using Free-Form Deformation
    by Alex Ferrier
    August 27th 1999
    http://www.gamasutra.com/view/feature/131779/realtime_softobject_animation_.php

    which itself is based on
    Sederberg, Thomas W.; Parry, Scott R. (1986). "Free-form deformation of solid geometric models".
    SIGGRAPH Computer Graphics (ACM) 20 (4): 151–160.

    my script code will be in readable form (maybe not the plugin code )

    Post edited by mCasual on
  • scotchfairyscotchfairy Posts: 54
    edited December 1969

    Whoo hoo! Now *that's* the type of stuff I was thinking of when I idly started poking at 3D software again (my attempt to learn Maya several years ago crashed and burned from lack of time and the fact that Autodesk's student license agreement wouldn't allow me to actually *do* anything with what I learned). I couldn't figure out why some of this stuff looked so primitive. But patented algorythms explain it.

    I bow down to you. Yes, yes, please write that plugin!

  • amy_aimeiamy_aimei Posts: 139
    edited December 1969

    That's cool! Good work!
    I'm sure that a lattice deformer will be very useful for fixing poke-through.

  • mCasualmCasual Posts: 4,605
    edited December 1969

    i'm tempted to do it now, the lattice deformer

    though the next project is supposed to be -- updating, the mcjWarp plugin for DS4.5 use

    it still works for DS 3 though https://sites.google.com/site/mcasualsdazscripts/mcjwarp-plugin-for-ds3-pc
    ------

    image below : deforming a 3x3x3 faces cube

    ffd3.gif
    600 x 337 - 45K
  • SloshSlosh Posts: 2,391
    edited December 1969

    This would be a great help to all. DForms in DS are not always preferable to use, and this would be another great tool for the arsenal. Is it possible to create a lattice with higher resolution than 4x4? Like the one Photoshop uses for deforming.

  • mCasualmCasual Posts: 4,605
    edited April 2013

    Slosh said:
    This would be a great help to all. DForms in DS are not always preferable to use, and this would be another great tool for the arsenal. Is it possible to create a lattice with higher resolution than 4x4? Like the one Photoshop uses for deforming.

    i could possibly make the resolution adjustable later ( it's in fact 3 spans x 3 spans x 3 spans for my script experiments )

    first i have to cope with the fact that moving any lattice control point deforms all vertices of the object

    incidentally that may hold the key to expanding the resolution,
    since i read that in games they build 3x3x3 lattices using 3x3x3 lattices that are 1x1x1

    gg.gif
    600 x 337 - 150K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,605
    edited April 2013

    results when moving only the 4 lattice control points on the bottom front row

    note that this is a low resolution skirt so we don't see the (Bezier) curving effect of the deformer

    fig 2.

    the script based test setup uses 4x4x4 null nodes as the lattice

    ( wireframe display courtesy of the mcjTracer splugin )

    fig 3 -- a 32x32 cylinder was processed in 2 seconds by the script

    --

    maybe i'll bring the test script to a humanly-usable form , release that,
    and return to the mountain of backlog ... the mcjWarp plugin , the Aiko pumps, the openGL water simulations, the hardware rendered mirrors, the pseudo-dynamic hair ... the Aiko3 bodycon dress ... the other plugins that need to be upgraded to DS 4,5

    yup.jpg
    1052 x 602 - 117K
    444.png
    1052 x 598 - 97K
    blii.gif
    600 x 337 - 114K
    Post edited by mCasual on
  • SimonJMSimonJM Posts: 5,967
    edited December 1969

    Just when do you find time to sleep? ;)

  • mCasualmCasual Posts: 4,605
    edited December 1969

    SimonJM said:
    Just when do you find time to sleep? ;)

    i live in a deformed time continuum :)

    ( lattice plugin widget in DS4.5 )

    wid.jpg
    818 x 615 - 77K
  • mCasualmCasual Posts: 4,605
    edited April 2013

    check this out

    the basics of the plugin became functional !

    i selected the sphere

    created an mcjLattice

    the plugin created the 64 null-nodes and placed them around the sphere

    then i can simply select and move anyone of the null nodes

    and the blue lattice lines immediately follow

    next phase is to compute the deformed shape of the sphere ( should be very very fast for under-50K vertices )

    and embed that shape as a morph channel of the sphere

    it's not a by-the-book deformer, but it's a good candidate for exports

    then on June 15th 2013 mcjLattice will become self-aware

    editable.png
    828 x 620 - 64K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,605
    edited April 2013

    ah! lost my 5 lines long post!

    so as i was saying before being bamboozled away to my account's "dashboard"

    ---

    this is the first succesful deformation done with the upcoming mcjLattice plugin
    ( for which i wont give a release date )

    - created a sphere
    - selected it
    - created an mcjLattice
    - parented, moved and twisted the top layer of 16 control points
    ( they are just good old null nodes, easy to work with ! )
    - ran this script : Scene.findNode( "mcjLattice" ).activated();

    less than 5 milliseconds later a new morph channel was added to the sphere by the plugin

    i made the morph strength 100%

    done
    -----
    ideally it will be interactive, so as one moves the control points the object will deform
    should not be excessively slower than a d-form
    -----

    imagine the possibilities, dancing bananas

    bananas.jpg
    880 x 718 - 98K
    deformmm.png
    992 x 732 - 113K
    Post edited by mCasual on
  • SimonJMSimonJM Posts: 5,967
    edited December 1969

    Ruddy hell, impressive! :)

  • TugpsxTugpsx Posts: 737
    edited December 1969

    Wow this could have a lot of application. Thanks for sharing your work.

  • mCasualmCasual Posts: 4,605
    edited April 2013

    Tugpsx said:
    Wow this could have a lot of application. Thanks for sharing your work.


    demo video of the interactive mode ! http://www.youtube.com/watch?v=wB4PJOAogUU

    ( not included in the video , the crash of the previous attempt )

    Post edited by mCasual on
  • JimmyC_2009JimmyC_2009 Posts: 8,891
    edited December 1969

    Super stuff!

    Now THAT is a Deformer :)

  • mCasualmCasual Posts: 4,605
    edited April 2013

    example, we fit Aiko 3 shoes on Aiko 5's feet

    this was done in 10 minutes, so great results could be obtained under an hour

    ( also, i was able to prevent crashes that happened with this loaded .obj )

    also ----> demo video of the interactive mode ! http://www.youtube.com/watch?v=wB4PJOAogUU

    x5.jpg
    800 x 800 - 121K
    x4.jpg
    800 x 800 - 148K
    x3.jpg
    800 x 800 - 144K
    x2.jpg
    800 x 800 - 142K
    x1.jpg
    800 x 800 - 119K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,605
    edited April 2013

    a funny test that had a good side, i discovered the mcjLattice node continues working after being deleted

    . o O ( now i guess the mcjLattice node should disconnect itself from the control nodes and self destruct ? )

    . o O( its like the 6th sense, the node diesnt know it's dead )

    mnah.gif
    640 x 480 - 315K
    Post edited by mCasual on
  • DollyGirlDollyGirl Posts: 2,656
    edited December 1969

    This is a very exciting development. I just discovered the lattice deformer in Hex and was bemoaning the fact that this would be great in DAZ. Did you read my mind?

  • wancowwancow Posts: 2,708
    edited December 1969

    WHOLLY BOVINE!!!!! This is amazing!!! Casual, you sure you want to give this away?????

  • mCasualmCasual Posts: 4,605
    edited April 2013

    wancow said:
    WHOLLY BOVINE!!!!! This is amazing!!! Casual, you sure you want to give this away?????

    one of the factors is that, if i create something to sell, i'll have to put a lot of additional effort to make it robust and test it longer, and write cleaner instruction manuals and there's the update issue that would be more pressing :)

    note that i plan to just make it useful and not add too much options, so i can get back to all the other stuff i started

    in unrelated matters, old pre 2003 music selected by me http://mcasual.tripod.com/momo156.html

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,605
    edited April 2013

    New Preview / Test video

    https://www.youtube.com/watch?v=ukVgkjYyAbc

    when i was moving 16 of the lattice nodes at the same time,
    the plugin would get 16 requests to update the deformation
    so i instituted an update throttle at 10fps

    it will probably be adjustable in the release

    also you can see i'm using a little script to select whole panels of lattice control points in 1 click

    and you can see there's a vertex of the deformed object mistakenly left behind

    figure 2 - solved the "vertex left behind" issue by inflating the lattice

    nina.gif
    640 x 480 - 68K
    promomovi.jpg
    1280 x 720 - 114K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,605
    edited April 2013

    i'm thinking of a release this weekend

    but recent experiences showed predictions may be off by 1 week or 2 :)

    here's the ToDos, features and fixes i can think of

    - make sure the plugin doesn't eat up memory (memory leaks )
    - understand why mcjSceneGraf cant see the morph channel created by mcjLattice
    - make it possible to narrow down the deformed surfaces -- selection by Bone or by Material
    - do the maths to handle body parts that are rotated in space ( vs their zeroed position )
    - 32 bit / 64 bit,
    - for DS 3.1 and for DS 4.5
    - make it possible to create many morphs from the same lattice ( example, morph per animation frame )
    - control the maximum updates per second ( which is presently set at 10 per second ) ...
    - accommodate animation renders
    - prepare for verlet-based cloth physics ( dangling chains of nodes )

    accommodate.gif
    640 x 480 - 56K
    Post edited by mCasual on
  • SimonJMSimonJM Posts: 5,967
    edited December 1969

    However long it takes! :)

  • mCasualmCasual Posts: 4,605
    edited April 2013

    i wasn't expecting this test to work,
    but that's the first test where the object is not immobile
    plus, i was able to render an animation
    and this involves the morph for each shape shown is updated before each frame is rendered

    what we're talking about here is a custom morph generated on the fly

    so it the lattice was deforming long hair,
    then by parenting part of the cage to the head and part of the cage to the chest,
    we could have head movements and dangling part of the hair would stay laid on the chest

    ( in some cases that type of trick is already achievable using good old D-Forms )

    one thing to note is that the entire universe is deformed, even what's outside the initial cage area
    this is not always wanted so i'll have to do something about that


    ---------
    figure 2 - we sure don't want to completely get rid of them world deformations

    yeah.jpg
    824 x 618 - 64K
    peanut.gif
    640 x 480 - 143K
    Post edited by mCasual on
  • amy_aimeiamy_aimei Posts: 139
    edited December 1969

    Is it ready for trying? It is amazing. I'm sure that it will cut down the time I spend on making morphs.

  • mCasualmCasual Posts: 4,605
    edited April 2013

    amy_aimei said:
    Is it ready for trying? It is amazing. I'm sure that it will cut down the time I spend on making morphs.

    ************************************************************************
    ** sneak peek **** sneak peek **** sneak peek **** sneak peek **
    ************************************************************************

    pre-beta for the adventurous Indiana Jones's ( or uh the Marion Ravenwood's )

    https://sites.google.com/site/mcasualsdazscripts3/mcjlattice

    This is an early version of mcjLattice for DS4.5 PC/WIN
    it possibly contains bugs which will crash Daz Studio
    ( but so far this didn't happen too often )
    if you save a scene containing this version of an mcjLattice node
    it may later make the re-loading of that scene problematic

    you could proceed this way:

    use mcjLattice to create the deforming morph
    delete the mcjLattice node, delete the control points,
    save this scene or export the morph or the morphed shape
    then use morph-loader ... or ... well i dont know DS4.5 that well :)

    --------

    for now the plugin works best on objects that remain at their zero position, no rotations

    it may work on figures ( see i didnt get to that part yet ) but the figures must be in their zero pose
    and the morphis applied to the whole figure

    i hope to be able to deal with figure body parts in non-zero-pose poses

    ====

    figure 1 shows a 16x32 primitive sphere being deformed by an mcjLattice-produced morph


    fig 2 shows the "Geometry" section of the mcjLattice's "Parameters" tab

    theres a slider to change the crayon width used to draw the cage

    and there's a drop down list to select which node is the object of the deformation


    fig 3 shows that the mcjLattice was transfered from the 16x32 sphere to a 4x8 sphere ( for now you have to kick one of the control points to uh apply the deformation to the newly selected object

    ff3.jpg
    823 x 619 - 48K
    ff2.jpg
    768 x 614 - 68K
    ff1.jpg
    823 x 619 - 54K
    Post edited by mCasual on
  • RAMWolffRAMWolff Posts: 10,157
    edited December 1969

    So this would be like a softbody deformer right in DAZ Studio?? If so this will be very very helpful in getting some of the fix morphs I need done completed if there is a way to save them as a morph target afterwards.

  • mCasualmCasual Posts: 4,605
    edited April 2013

    RAMWolff said:
    So this would be like a softbody deformer right in DAZ Studio?? If so this will be very very helpful in getting some of the fix morphs I need done completed if there is a way to save them as a morph target afterwards.

    for now,
    you select an object and you create the mcjLattice, which appears to you as a cage around the object to deform
    the cage is attached to 64 null nodes , which i call control points
    as you move the control points, the cage is deformed and the object in the cage is deformed
    what the plugin did just now, is, it added a morph channel named Doby which contains this deformation and it set its strength to 100%
    as you continue moving the control points, the Doby morph is updated
    ------

    for now
    the deformation affects the whole object or figure (didnt test this yet )
    but i plan to make it possible to deform just the part of the figure "owned" by a bone
    or just the part of the figure in the cage

    ------

    i don't know all the options available in DS4.5

    one way to export the morphs on props is to use "PP2 exporter"

    DS4.5 can also export some things and it saved the Doby morph

    another way is to export the morphed object as an .obj file, then re-import the .obj using uhh Morph Loader which is somewhere in the Scene sub-menus

    Post edited by mCasual on
  • RAMWolffRAMWolff Posts: 10,157
    edited December 1969

    If there is a way to set up the plugin like the D-Form plugin to name and then "Spawn Morph" one could then just save out the figure with the morph information embedded. :-)

    Looking forward to seeing how this develops. Your on to something Casual!

  • mCasualmCasual Posts: 4,605
    edited April 2013

    RAMWolff said:
    If there is a way to set up the plugin like the D-Form plugin to name and then "Spawn Morph" one could then just save out the figure with the morph information embedded. :-)

    Looking forward to seeing how this develops. Your on to something Casual!

    Note that in a way the deformation is already Spawned the moment you move a control point, but for now it's always the Doby morph on the Doby Channel. for figure use, it would be on a standard figure channel like PBM_something


    this morning's version is very premature

    --

    the other thing i plan is indeed to let users specify morph names, also the possibility to create 1 morph per animation frame , and maybe as is the case in mcjElevate, the possibility to export the morphs as pose files

    mcjElevate https://sites.google.com/site/mcasualsdazscripts/mcjelevate-reva
    mcjElevate the movie ... http://www.youtube.com/watch?v=6dP8faP3KMo

    Post edited by mCasual on
Sign In or Register to comment.