Script: Smoothen Meshes without SubDividing them

mCasualmCasual Posts: 4,607
edited November 2020 in Freebies

https://sites.google.com/site/mcasualsdazscripts9/mcjsmoothmeshmorph

This script will create a morph that moves each vertices of a mesh to the average position of each neighboring vertex

roughmounts.jpg
540 x 960 - 54K
fourpassmounts.jpg
540 x 960 - 50K
smoothcube.jpg
540 x 960 - 82K
smoo.jpg
800 x 800 - 111K
Post edited by mCasual on

Comments

  • Very nice. Thank you for your hard work.

  • GreymomGreymom Posts: 1,113

    Now that is interesting!  Thanks!

     

  • manekiNekomanekiNeko Posts: 1,408

    looks interesting.. question: when you use the inbuilt DS smoother, you have the option to delete it i.e. go back to your object's initial state (or just deactivate it in the properties panel).

    with your script, on the little dialog panel, i don't see anything in that direction.. does this mean, once my object has been smoothed with your script, there is no way back ever? so if i want it unsmoothed i'd have to reload it again?

  • Looking at the script code itself there is no 'beginUndo()'-'acceptUndo([undo action name])' wrapper encapsulating the action which is the thing (in my limited knowledge) I'd expect around the outside of an undo-able action. I don't know more than the most basic of basics, so there may be other ways of recording an undo-able action that I don't know about and the much more experienced and knowledgeable mCasual does know. So, don't take my opinion as the final word on it.

    My suggestion would be to experiment with it on a wobbly surface, then press the DS 'Undo' button/menu item and see if the action undoes.

    Regards,

    Richard

  • manekiNekomanekiNeko Posts: 1,408

    Looking at the script code itself there is no 'beginUndo()'-'acceptUndo([undo action name])' wrapper encapsulating the action which is the thing (in my limited knowledge) I'd expect around the outside of an undo-able action. I don't know more than the most basic of basics, so there may be other ways of recording an undo-able action that I don't know about and the much more experienced and knowledgeable mCasual does know. So, don't take my opinion as the final word on it.

    My suggestion would be to experiment with it on a wobbly surface, then press the DS 'Undo' button/menu item and see if the action undoes.

    Regards,

    Richard

    thank you, of course an undo might, would probably work, even if no guarantee. but only if i do it like immediately afterwards. i meant at some point in my creation of the scene, maybe even after i saved/closed the app.

    on the other hand... i'm wondering if i didn't get confuzzled again by what this script does. my knowledge of DS is quite a mess, so is my brain, and i mix up things quite often because i get bits of info which seem to fit with other bits of info... while they actually don't match.

     what i had in mind as i saw this here was the smoothing that you use, for example, on clothes so they fit better. smoothing modifier? and this here might be sth totally different - like a subdividing.. well, without subdividing. supposed to be use on static surfaces like a terrain as in the example above, or anything not supposed to be fitted. i dunno...

  • I did have a brief look at the code & from my first glance it looks as if the model vertices are being moved by a morph as there is a function called 'function addMorph( obj, numorphname, deltas )', which would be a safe and undo-able way of doing it.

    I will say, I'm not great at reading other people's programs, and I may have got this wrong. I am a self taught programmer & I don't seem able to condense my thoughts & code as much as a good programmer can, so I tend to get a bit lost reading a pro's creations.

    I honestly think you need to try it and check for yourself.

    Regards,

    Richard.

  • manekiNekomanekiNeko Posts: 1,408

    I did have a brief look at the code & from my first glance it looks as if the model vertices are being moved by a morph as there is a function called 'function addMorph( obj, numorphname, deltas )', which would be a safe and undo-able way of doing it.

    I will say, I'm not great at reading other people's programs, and I may have got this wrong. I am a self taught programmer & I don't seem able to condense my thoughts & code as much as a good programmer can, so I tend to get a bit lost reading a pro's creations.

    I honestly think you need to try it and check for yourself.

    Regards,

    Richard.

    thanks Richard. if i try to think logically, using this instead of the smoothing modifier doesn't make a lot of sense anyways, since you can't modify the collision parameters .ike under the mesh smoothing parameter... so this is an excellent script - so thanks a lot mCasual! ^^ - just not for the same purpose. but i have some terrain creating possibilities, and this might come just handy for that ^^

  • mCasualmCasual Posts: 4,607

    the script generates a morph so if you go in the parameters tab of that object, turning the morph strength to 0 strength removes the smooth 

    looks interesting.. question: when you use the inbuilt DS smoother, you have the option to delete it i.e. go back to your object's initial state (or just deactivate it in the properties panel).

    with your script, on the little dialog panel, i don't see anything in that direction.. does this mean, once my object has been smoothed with your script, there is no way back ever? so if i want it unsmoothed i'd have to reload it again?

     

  • mCasualmCasual Posts: 4,607
    edited November 2020

     i didnt put an undo because the script does thousands ( 180000 in the case of this terrain ) of operations and i'd worry about memory usage 

    and as i was saying, turning the morph generated by the script removes the smoothing

    Looking at the script code itself there is no 'beginUndo()'-'acceptUndo([undo action name])' wrapper encapsulating the action which is the thing (in my limited knowledge) I'd expect around the outside of an undo-able action. I don't know more than the most basic of basics, so there may be other ways of recording an undo-able action that I don't know about and the much more experienced and knowledgeable mCasual does know. So, don't take my opinion as the final word on it.

    My suggestion would be to experiment with it on a wobbly surface, then press the DS 'Undo' button/menu item and see if the action undoes.

    Regards,

    Richard

     

    highvibrationfrequencies2sat.png
    1920 x 1080 - 2M
    highvibrationfrequencies.png
    1920 x 1080 - 2M
    Post edited by mCasual on
  • Very, very clever. The compactness of the code is incredible. It really shows me how much I have to learn. Thank you for offering this.

    Regards,

    Richard.

  • manekiNekomanekiNeko Posts: 1,408
    mCasual said:

    the script generates a morph so if you go in the parameters tab of that object, turning the morph strength to 0 strength removes the smooth 

    looks interesting.. question: when you use the inbuilt DS smoother, you have the option to delete it i.e. go back to your object's initial state (or just deactivate it in the properties panel).

    with your script, on the little dialog panel, i don't see anything in that direction.. does this mean, once my object has been smoothed with your script, there is no way back ever? so if i want it unsmoothed i'd have to reload it again?

     

    thanks for the explanation! and i was actually really mixing up with the smoothing modifier that has collision. now i see better what this is for.

Sign In or Register to comment.