Import and scale model?

Hello,

I’m looking for a way to import a Wavefront OBJ model, then scale it’s vertices.

I’ve managed to import it, but the scaling part doesn’t work. While in Edit Mode, I call this:

[IPress, Transform:Scale] [ISet, Transform:Info:X Component, 0.01] [ISet, Transform:Info:Y Component, 0.01] [ISet, Transform:Info:Z Component, 0.01]

The Transform->Scale button gets activated, but my model doesn’t get scaled.
I’m not even sure if this is the correct way to do it or not.

I’ve also noticed that if you click Zplugin -> ScaleMaster -> Set Scene Scale, it gives the correct “generic size units” of the imported model. I want to scale the model down by 100, so Scale Master reports that the “generic size units” has also been scaled down by 100.

In other words, I want to scale down the model’s raw vertices. Is this possible? Thanks.

you have different options for scale the model

  1. you can edit the tool:import:scale factor
  2. you can use the tool:deformation:Size
  3. you can scale the model from Tool:geometry:Size with XYZ Size, or independently with x/y/z sliders.

Thanks, scaling the model prior to import is exactly what I’m looking for. But, I get this error.

My script:
[ISet, Tool:Import:Scale Factor, 0.01]


ZScript Note: Interface item could not be found.

SCRIPT: import_obj.txt

ERROR: Tool:Import:ScaleFactor
IN: [ISet,Tool:Import:ScaleFactor,0.01]

OK

Running ZBrush 4R8.

Is the Tool:Import interface documented somewhere, with all its methods listed?

Found this page:
http://docs.pixologic.com/reference-guide/tool/polymesh/import/

But nothing there mentions a ScaleFactor member.

Hi samsonite,

f​:slight_smile:celess has made a mistake. :slight_smile:

You need to use Tool:Export:Scale. This is the slider in the Tool>Export sub-palette. Its value controls scaling of the model on export, so you need to set the inverse value on import. A value of 10 will give a model a tenth of the size.
If the slider is set to 0, ZBrush will auto-scale to its default size of 2 generic units.

Thanks for the info. If I needed the bounding box values to set the XYZ scale sizes myself, I would probably have to create my own DLL to get them?

yeah i point to a interface item which do not exists :slight_smile:
why there is no scale possible at the import ? instead of rescale the mesh after it had been loaded, a scale factor would have been just the perfect way to do that. currently we have to rescale the model based on the boundary box.
no don’t need a dll for that, if you know the exact size of your model in another 3d software, the biggest value will become the reference of the scaling in Zbrush.
another detail which make everything to be confuse, is that Zbrush scale is 2 not 1.
if you have a mesh of XYZ = 3m1m1m
3m become the references to compute the boundary box and zbrush XYZscale and Xscale and will be equal to 2.000 because X is the biggest value.
other value like the Y Scale and Z scale are just proportionally equal to this ratio.
3=13 so Y and Z should be 0.3332
The scale of a mesh of 3m1m1m should give you this as result 2.0000.6660.666
It would simply the understanding, if zbrush jsut rescale at 1.000 instead of 2.000

As I said, you can scale on import by setting the Tool:Export:Scale appropriately. A basic workflow would be:

  1. Select the PolyMesh3D Star.
  2. Set the Tool:Export:Scale to what you want.
  3. Import the OBJ.

For the Polymesh3D Star, the default setting of the Tool:Export:Scale is zero. ZBrush will then auto-scale a model on import so that it fits in a cube of 2 generic units.* This is the best size for working with ZBrush’s sculpting tools. The Tool:Export:Scale slider will be set by ZBrush so that on export the model is reset to its original size.

But if you set the slider before import then the model is scaled based on the slider value. So a setting of 1 will mean the model is imported at its original size.

For the bounding box, the simplest way is to get the values of the Tool>Geometry>Size X Y Z sliders.

*OBJ files have only generic units. How these are interpreted depends on the software and its settings. They might be interpreted as inches or meters but the OBJ doesn’t store this information.