Export to OBJ Precision?

Since its not in the “OBJ Export Options”, I’m guessing the answer is “no”, but is there any way to get SketchUp to export to obj with more floating point precision? It seems like it outputs 6 digits of precision total, so I get values like “684.274”, but I’d really like significantly more precision than that - something like “684.274318644”. If there any way to get this behavior? I’m using SketchUp Pro 2019, and at least for now, I’m just using the built-in File->Export->3D Model functionality…

If there’s no way to tell SKP to do this, is there a proven plugin that would allow this?

Thanks for your help!

what are your export option and unit precision set at?

with a millimetre export option I get values like this…

vn -0.448334 -1.24438e-16 0.893866

if you use model units option, set precision to 6 decimals…

john

I am exporting with units of mm. I don’t see anywhere to set the precision - are you saying that is a setting somewhere that I can control?

Just to be clear, I am looking for more precision than 6 digits… In your example, you have “-0.448334”, which is exactly 6 digits of precision, I’d like it to export something like “-0.448334187742”…

If you have a vertex value of something with 3 digits to the left of the decimal point, you only get 3 digits after, and I’d like to get more than that… I looked in the menus and didn’t see anywhere I could specify how many digits of precision to use.

the extra precision is the exponential part of my example…

1.524157875019 e + 16 , which means that the answer is 1.524157875019 times 10 raised to the sixteenth power (that is, multiplied by 10 sixteen times)

john

But remember that as far as SketchUp’s 1/1000" tolerance is concerned, a line that’s 6.543" long is regarded as being the same as one that’s 6.54321" long [same goes for 3dPoints’ XYZ values]

The exported OBJ file uses that 3 dp for v values [with trailing 0s as needed], for vt & vt values it uses up to ~8dp, rounding off as appropriate - sometimes using N.NNNNNe-NN notation for very tiny values ~0, it also uses 6dp for the ‘k’ values in the accompanying MTL file.

Why do you want these finer tolerances ?

Well, the exponential part isn’t really “precision”, its just expresses magnitude… if I could get the value that you shows in your example, that’d be great, but it won’t export “1.524157875019e+16” - it will export “1.524158e+16”.

I mean, if I have a “true” value of 46.00002mm, this would be exported at 46.0000.

You need to keep in mind that SketchUp is designed to model houses and buildings. It has an internal tolerance of one thousandth of an inch.

It makes no good sense to try to get minute vertex positions to a precision of picoinches, or to gargantuan positions of petainches (15782828.28 miles,) from such an application.

Perhaps model in SketchUp at a larger scale, and scale down in the external application?

Not saying you shouldn’t, just curious: what are you doing that needs atomic-scale precision?

I take the OBJ file exported from SKP and run some other programs on it… When I read in a vertex value from the (ASCII text) OBJ file, I only get up to 6 digits of precision… If I do a bunch of geometry calculations on it, that lack of precision is compounded significantly through the calculations, and causes things not to work for me…

For example, consider two values from the OBJ:
687.856 707.107 163.871
1375.71 0.0 327.741

if I calculate the dot product, I get:
999997.623171

now, if I were to have the more precise values of:
687.85648712 707.10737114 163.87129912
1375.7147121 0.0 327.74133781

I get a dot product of:
1000001.68794666

For my applications that kind of difference matters - especially as I do more and more calculations and the amount of error is compounded (i.e. really what I’m doing is “dot producting the vertex values”, but I’m computing vectors from one vertex to another, and then dot producting those vectors… So now the error involved in lack of precision has been compounded through multiple calculations and grows each time.

I’m modeling vehicles, so its not like I’m modeling subatomic particles or something… The point is valid though, if SketchUp isn’t really designed for this type of thing, I may need to move to a different tool.

Modeling at a larger scale doesn’t help, because I’m not concerned about scale, I’m concerned about precision… I went in to SKP and scaled this little test model I have by a scale factor of 10000… When I export to OBJ, the vertex that was originally:
v 687.856 707.107 163.871

is now reported as:
v 6.87856e+06 7.07107e+06 1.63871e+06

you can see that it didn’t buy me any precision at all, since there are still 6 digits of precision. If I went into my external application and divided by 10000, I’d be back to the exact same values I had in the original model before I scaled it…

Well, the exact application isn’t important I think, but I might want to do something like load up an OBJ model exported by SKP and find pairs of faces that are exactly 90 degrees from each other… Its well known in computing that floating point math requires tolerances, etc… That’s all fine, except that I am forced to make my tolerances waaaaay larger I normally would because I’m not just accounting for errors in the floating point precision within the computations, but also accounting for the lack of precision in the vertex locations that I read in from the OBJ file.

The OBJ step is a red-herring…
If you got the values out of the SKP model directly, without the export to OBJ, then the 3dp would still be there.
Where do you get your ‘more precise’ values from ?
687.856 v 687.85648712

Have you tried scaling up the model by x1000 and doing the export ?
687856.487 ??
The stepping back down in your ‘other programs’ x1/1000
To get 687.856487 before doing the dot-product calcs…
Or would the dot-product work OK without that step ?
Do you ‘normalize’ these vectors before processing ?

could export .dae for more decimal precision…

<float_array id="ID8" count="6">10.8938690 0.0000000 0.0000000 0.0000000 -0.0000000 0.0000000</float_array>

john

I am definitely starting to see your point about it being a red herring… I think I see why what I am asking for isn’t feasible in SKP…

Just to give you some of the info you asked about, the workflow might be something like this:

  1. Someone uses some non-SKP CAD package to build a nice precise model, and they hand me an exported OBJ that has values down to 10 digits of precision after the decimal point.
  2. I want to modify that model in some way, so I import it into SKP and modify away (because SKP is so nice and easy to use and intuitive for a non-modeler like myself)
  3. I export my nicely modified model out to OBJ and find that I’ve lost all that precision and am down to just 6 digits of total precision

Thanks to this discussion, I am now understanding that the “issue” (from my perspective) is in step 2. As soon as I bring it into SKP, I’ve lost that precision. I think the right answer for me might be to use Rhino or something like that… That’s sad for me because I really like the SKP interface and all of the inferences it does, etc…

I appreciate everyone’s patience with me in understanding the limitations and where the “issue” really lies…

As you can see from @john_drivenupthewall’s example, SketchUp does have greater precision internally. To me that implicates either the obj importer or exporter. You could do some tests via the Ruby Console to see whether the loss of resolution is during import or export.

It would be possible to extract the vertices’ XYZ to more precision using Ruby…
e.g. collect the faces and use

face.vertices.each{|v| p v.position.to_a }
[8.14765787525088, -0.984251968503937, 35.38721307726624]

etc…
But without knowing how you’ll use this a simple solution is not possible ?

If someone asked me to recommend a modeling application for automotive body design, I’d not point them towards SketchUp. It’s designed specifically for architectural design.

The people modeling vehicles are doing this for gaming content where precision is not an issue.


For organic surface or solid modeling an application that supports nurbs is probably better.

I’ve played a bit with Rhino, and it looks very powerful (but a steep learning curve.)

DesignSpark Mechanical is free, but rudimentary.
(It’s commercial big brother SpaceClaim is tremendously expense, but immensely powerful.)

The FormZ family is affordable. I’ve played with the free edition a bit. It interface is similar to SketchUp, but it’s workflow is more like DesignSpark, or Rhino.

There is also Blender, but it’s interface confuses me to no end.

Surely 15 decimal places of a mm requires some sort of scientific bio-mechanical software, a touch more detailed than vehicles normally need.

1 Like

Wow, well that’s great… So I guess I’m back to asking my original question, “Can SKP export to obj with that precision”? I guess the answer is “no, not as it stands now”. Maybe the SKP developers will consider making the precision be a configurable thing? Or maybe there’s a plugin someone else has written that does this already…

I suppose I could also consider writing my own export-to-obj plugin, that just seems like it ought to be unnecessary…

In the digital would units are just units, you can make them anything you want. I often 3d print models done in metres as mm.