Blank visualizer (empty json file)

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Heiko Stark
Posts: 11
Joined: Tue Jan 05, 2016 6:59 am

Blank visualizer (empty json file)

Post by Heiko Stark » Tue Feb 23, 2021 12:58 am

Dear OpenSim team,

I get my model loaded in 3.3, 4.0, 4.1 and 4.2 and can make computations. Unfortunately the Visualizer from version 4.0 on does not show the model anymore. An error message is not displayed. After test removing single OBJ files, I got the Visualizer to work, apparently not depending on the file size of the OBJ files. An error message suggested this in the log file:

java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3332)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
at java.lang.StringBuffer.append(StringBuffer.java:270)
at java.io.StringWriter.write(StringWriter.java:101)
at org.json.simple.JSONValue.writeJSONString(JSONValue.java:112)
at org.json.simple.JSONArray.writeJSONString(JSONArray.java:53)
at org.json.simple.JSONArray.writeJSONString(JSONArray.java:59)
at org.json.simple.JSONValue.writeJSONString(JSONValue.java:135)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:67)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:73)
at org.json.simple.JSONValue.writeJSONString(JSONValue.java:135)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:67)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:73)
at org.json.simple.JSONValue.writeJSONString(JSONValue.java:135)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:67)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:73)
at org.json.simple.JSONValue.writeJSONString(JSONValue.java:135)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:67)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:73)
at org.json.simple.JSONValue.writeJSONString(JSONValue.java:135)
at org.json.simple.JSONArray.writeJSONString(JSONArray.java:53)
at org.json.simple.JSONArray.writeJSONString(JSONArray.java:59)
at org.json.simple.JSONValue.writeJSONString(JSONValue.java:135)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:67)
at org.json.simple.JSONObject.writeJSONString(JSONObject.java:73)
at org.opensim.threejs.JSONUtilities.writeJsonFile(JSONUtilities.java:125)
at org.opensim.view.pub.ViewDB.exportModelJsonToVisualizer(ViewDB.java:460)
at org.opensim.view.pub.ViewDB.update(ViewDB.java:399)
at java.util.Observable.notifyObservers(Observable.java:159)
at org.opensim.view.pub.OpenSimDB.addModel(OpenSimDB.java:153)
[catch] at org.opensim.view.pub.OpenSimDB.addModel(OpenSimDB.java:141)

Since a partial model is loaded, ThreeJS runs stable and also the individually removed OBJ files are loaded by ThreeJS, there seem to be problems with the generation of the Json file. These files are always empty with the full model, so ThreeJS cannot visualize anything (an error message would be helpful). Unfortunately, since there are no error messages when generating the JSON file, I'm getting no further with debugging. Also, I would like to know how to increase the Java heap memory within OpenSim.

I can provide the model on request.

Maybe related to:
viewtopicPhpbb.php?f=91&t=12917&p=37192&start=0&view=
viewtopicPhpbb.php?f=91&t=12790&p=36595&start=0&view=
viewtopicPhpbb.php?f=91&t=12702&p=36292&start=0&view=
viewtopicPhpbb.php?f=91&t=12564&p=35866&start=0&view=
viewtopicPhpbb.php?f=91&t=12414&p=35272&start=0&view=
viewtopicPhpbb.php?f=91&t=11975&p=33811&start=0&view=
viewtopicPhpbb.php?f=91&t=11769&p=33062&start=0&view=
viewtopicPhpbb.php?f=91&t=12917&p=0&start=0&view=

Doesn't help:
https://simtk-confluence.stanford.edu/d ... +Questions

Tags:

User avatar
Heiko Stark
Posts: 11
Joined: Tue Jan 05, 2016 6:59 am

Re: Blank visualizer (empty json file)

Post by Heiko Stark » Tue Feb 23, 2021 1:36 am

I can already answer one question myself. In the file:

C:\OpenSim 4.2-2021-01-09-fc62aad\etc\OpenSim.conf

you can change the -Xms and Xmx entry (OpenSim should better set it automatically according to the memory).

default_options="--branding opensim -J-Xms512m -J-Xmx4096m -J-Dsun.java2d.ddoffscreen=false -J-Dsun.java2d.gdiblit=false -J-Dsun.java2d.noddraw=true -J-Duser.language=en -J-Dopensim.buildnumber=4.2-2021-01-09-fc62aad"

Now a JSON file is generated (313.2M), but ThreeJS does not want to visualize it.

Attached also the ThreeJS file, available for one month.

https://upload.uni-jena.de/data/6034be6 ... 41506b.zip

Best regards,
Heiko

User avatar
Heiko Stark
Posts: 11
Joined: Tue Jan 05, 2016 6:59 am

Re: Blank visualizer (empty json file)

Post by Heiko Stark » Tue Feb 23, 2021 1:36 pm

The comparison of the problematic parts between opensim3 (PNG file) and opensim4 (PNG file) shows an incorrect import from OpenSim or ThreeJS. A problem part is attached, available for one month:

https://upload.uni-jena.de/data/6035660 ... bdomen.zip
Attachments
opensim4.png
opensim4.png (14.98 KiB) Viewed 1174 times
opemsim3.png
opemsim3.png (17.7 KiB) Viewed 1174 times

User avatar
Ayman Habib
Posts: 2244
Joined: Fri Apr 01, 2005 12:24 pm

Re: Blank visualizer (empty json file)

Post by Ayman Habib » Tue Feb 23, 2021 1:54 pm

Dear Heiko,

Thanks for reporting and for the investigation.

You can increase the memory used by the OpenSim application, as you found out, by editing the .conf file however you have do this manually since installers don't typically query the client machine (that would be a security concern that could be exploited by a malicious developer).

The main issue here is that the mesh is massive and extremely detailed. When we convert to json format to pass to the visualizer, the file gets too large, and likely even if you get around it, the visualizer runs out of memory/space, which we can't control since it's run as a separate process developed by third-party.

If you can share the model/mesh-files that would be great so we can look into it further, though my recommendation would be to use some third-party tools to reduce the mesh (e.g. MeshLab) as it's unlikely that this level of details on the mesh is of much use in modeling (as opposed to visualization). I also noted that the obj file in question contains multiple disconnected volumes, this has been dropped in version 4.0 due to using different parsers, so you'll need to split your file into multiple, each containing one volume.

Hope this helps,
-Ayman

User avatar
Heiko Stark
Posts: 11
Joined: Tue Jan 05, 2016 6:59 am

Re: Blank visualizer (empty json file)

Post by Heiko Stark » Wed Feb 24, 2021 1:32 am

Dear Ayman,

The idea with Meshlab worked.
I used the function "Filters/Remeshing.../Simplification: Clustering...". My experience is that OBJ files up to 6 MB work. But additionally an increase of the heap memory of Java is necessary for the whole model (see above).

However, more error messages would also be helpful.

Is there a possibility/API in the threejs editor (C:\OpenSim 4.1\OpenSim\threejs\editor\) to add the generated json file via the index.html? Thus, it would be possible to make the visualization available online..

Best regards,
Heiko

POST REPLY