1. #1
    Senior Member Follow User Gallery
    Join Date
    Jun 2011
    Location
    Cape Town
    Posts
    145

    Default Q: scene scale and unify zbrush

    Hi (Marcus)

    Zbrush has a scale master plugin I think Joseph made not sure?

    I am trying to understand the math behind what the "zbrush scale unify" button is doing, yeah my primitive brain is a little like what!?

    The way I see it is:

    You look at all the objects sizes in the scene
    The biggest subtool/mesh will then be reduced so that it will fit inside a 2 x 2 x 2 unit or volume.
    The amount that you had to use to get the subtool to that size you will use on all the other subtools.
    Then you need to use the inverse of that amount on the export settings to maintain the size of the subtool.

    Mmmm right if I haven't lost you yet, I might of lost myself.

    The equation for this and my math is so rusty and embarrassing I get this:

    If a 1 unit cube needs to be 2 units, we need to multiply it by 2
    That means export setting will be divided by 2 to maintain the size of the subtool.

    1x = 2
    x = 2

    If a 3 unit cube needs to be 2 units, we need to divide it by something to get it by 2, I know its 1.5.
    Also the export needs to be than miltiplied by 1.5

    3/x = 2 (no idea how to make this into code haha)
    3/1.5 =2 (but this is true)

    So my first question is, am I on the right track?
    Second question, how would I translate this into good old code. If you know and you think I should try it first am also OK with that

    Thanks in advance

  2. #2
    New Member Follow User Gallery
    Join Date
    Nov 2018
    Posts
    9

    Default

    Hi!

    Instead of using 2 formulas, you could use the format of the first formula(1x = 2) to solve any X.
    So let us make it to this one, ax = 2
    Where a is the constant that represents the original unit. You need to always divide both sides by the value of a. So using your examples, let us try it.

    Sample 1
    --->>> 1x = 2
    --->>> 1x / 1 = 2 / 1
    --->>> x = 2 (Substitute it to check, 1 * 2 = 2)

    Sample 2
    --->>> 3x = 2
    --->>> 3x/3 = 2/3
    --->>> x = 2/3
    --->>> x =
    .66666666666
    (Substitute it to check, 3 * .66666666666 = 2)

    ^^ Using the formula, you could solve any x whether the original unit is smaller or bigger than 2.


    To write this in code is simple. Since we know that the left side is always gonna be x, we just need to divide the right side by the original unit.

    // Use vardef if you need to access their values outside your button's function. Use varset if you need them for computation only.
    [VarDef, origUnit, [IGet, "Tool:Geometry:XYZ Size"]]

    [VarDef, theX , (2 / #
    origUnit)]

  3. #3
    Senior Member Follow User Gallery
    Join Date
    Jun 2011
    Location
    Cape Town
    Posts
    145

    Default

    Thanks JRoC

    I will give that a try!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •