LDraw.org Discussion Forums

Full Version: LDraw Model Viewer and Online Tools
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A model viewer has been added to the LDraw.org website. This new tool will allow you to upload a model and view it in your browser. It's fairly basic at the moment but functionality will continue to be added.

It can be found in the Tools menu on the LDraw.org main site (click the red brick logo above) or directly here:
https://www.ldraw.org/tools/ldraw-model-viewer.html

This new feature is a continuation of an effort started with the LDCad PBG Generator to bring a series of useful tools to the LDraw.org website. Future plans include an model OMRizer and a part error checker.

As always, feature requests and improvements can be posted in the Website Suggestions forums.
(2020-07-01, 16:22)Orion Pobursky Wrote: [ -> ]A model viewer has been added to the LDraw.org website. This new tool will allow you to upload a model and view it in your browser. It's fairly basic at the moment but functionality will continue to be added.

It can be found in the Tools menu on the LDraw.org main site (click the red brick logo above) or directly here:
https://www.ldraw.org/tools/ldraw-model-viewer.html

This new feature is a continuation of an effort started with the LDCad PBG Generator to bring a series of useful tools to the LDraw.org website. Future plans include an model OMRizer and a part error checker.

As always, feature requests and improvements can be posted in the Website Suggestions forums.

OK, nice! Works quite smoothly.
What happens to the files you submit? Are they kept or temporary and deleted after viewing?
One suggestion if possible would be to adjust the lighting.
(2020-07-01, 18:01)Jaco van der Molen Wrote: [ -> ]What happens to the files you submit? Are they kept or temporary and deleted after viewing?

Nothing. Everything is handled in browser and it never leaves your computer.

This may change slightly in the future. For the PT, I send the part number to be displayed to the server and it sends back a list of the parts and primitives used in the file. This helps speed the processing of the file since the viewer doesn't need to ping 2/3/4 separate address to figure out where the part data is (official/unofficial parts/p/textures). For models, the script used will get the model data but it won't be saved anywhere, only used internally by the script.
(2020-07-01, 19:27)Orion Pobursky Wrote: [ -> ]Nothing. Everything is handled in browser and it never leaves your computer.

This may change slightly in the future. For the PT, I send the part number to be displayed to the server and it sends back a list of the parts and primitives used in the file. This helps speed the processing of the file since the viewer doesn't need to ping 2/3/4 separate address to figure out where the part data is (official/unofficial parts/p/textures). For models, the script used will get the model data but it won't be saved anywhere, only used internally by the script.

Really looks nice, and I like the way it is construction the model.

But is it loading unofficial Parts properly? I tried a model using part 24121 (unoff), it did not show this part.


PS: On the main page, the part images don't show
(2020-07-01, 20:30)Gerald Lasser Wrote: [ -> ]But is it loading unofficial Parts properly? I tried a model using part 24121 (unoff), it did not show this part.

It's not scanning for unofficial parts at all right now. That would slow down loading even more. Once I implement the script I mention above, it will.
It works really smoothly. Well done. You can get stud logos if you include the texture loading. The default textures are fairly small for performance, but I can generate some that are larger if you think that would be worth the effort.
(2020-07-01, 19:27)Orion Pobursky Wrote: [ -> ]This may change slightly in the future. For the PT, I send the part number to be displayed to the server and it sends back a list of the parts and primitives used in the file. This helps speed the processing of the file since the viewer doesn't need to ping 2/3/4 separate address to figure out where the part data is (official/unofficial parts/p/textures). For models, the script used will get the model data but it won't be saved anywhere, only used internally by the script.

Scratch all this. The way I'm going to implement will not require sending model data to the server. Therefore any model you use will never go anywhere but your browser.
(2020-07-01, 22:08)Lasse Deleuran Wrote: [ -> ]You can get stud logos if you include the texture loading..

I basically copied your sample code so if that doesn't load textures then the model viewer won't either. 
As for logos, this is the bug I reported. When I do stud logos, the loader want 3-4disc but never actually tries to load it.
(2020-07-01, 22:35)Orion Pobursky Wrote: [ -> ]I basically copied your sample code so if that doesn't load textures then the model viewer won't either. 
As for logos, this is the bug I reported. When I do stud logos, the loader want 3-4disc but never actually tries to load it.
I see. I have fixed the bug so that 3-4disc is loaded using Generator. Or rather. You fixed it in your bug report and I just verified and applied it.
I've updated the model viewer. It now pulls unofficial parts If they're not included in the model. Additionally, I've implemented a part path prefetch (like is used on the PT) to speed up loading. There is a note about how the model data is used at the bottom of the page.
(2020-07-01, 16:22)Orion Pobursky Wrote: [ -> ]A model viewer has been added to the LDraw.org website. This new tool will allow you to upload a model and view it in your browser. It's fairly basic at the moment but functionality will continue to be added.

It can be found in the Tools menu on the LDraw.org main site (click the red brick logo above) or directly here:
https://www.ldraw.org/tools/ldraw-model-viewer.html

This new feature is a continuation of an effort started with the LDCad PBG Generator to bring a series of useful tools to the LDraw.org website. Future plans include an model OMRizer and a part error checker.

As always, feature requests and improvements can be posted in the Website Suggestions forums.

Model viewer has been update to add:
- The ability to change the background color
- The ability to switch between the cell shaded view and the photo render style
- Also added a bunch of under the hood improvements.
I am trying to submit and view a model that does not load.
The process stalls at loading 3-16cyls.dat?
Another model that has kind of the same bricks does load.
At least, I think it also has 3-16cyls.dat in a brick somewhere, because I briefly see it loading.

What could cause this?
(2021-06-03, 10:52)Jaco van der Molen Wrote: [ -> ]I am trying to submit and view a model that does not load.
The process stalls at loading 3-16cyls.dat?
Another model that has kind of the same bricks does load.
At least, I think it also has 3-16cyls.dat in a brick somewhere, because I briefly see it loading.

What could cause this?

Sorry for the delay.  Can you post or PM the model  in question so can test it?
(2021-06-07, 23:27)Orion Pobursky Wrote: [ -> ]Sorry for the delay.  Can you post or PM the model  in question so can test it?

Np

I have PMd you.
(2021-06-08, 5:45)Jaco van der Molen Wrote: [ -> ]Np

I have PMd you.

This report has uncovered a much deeper bug. Some models load, others don't.  There doesn't seem to be any discernible pattern. Apparently all my test files didn't have whatever problem is causing buildinginstructions.js to crash but figuring out what that is will take some more digging.
(2021-06-09, 15:43)Orion Pobursky Wrote: [ -> ]This report has uncovered a much deeper bug. Some models load, others don't.  There doesn't seem to be any discernible pattern. Apparently all my test files didn't have whatever problem is causing buildinginstructions.js to crash but figuring out what that is will take some more digging.

OK, strange. But good luck bughunting. I'm afraid I cannot help you with that, but if you need any testing done, let me know!
(2021-06-09, 18:06)Jaco van der Molen Wrote: [ -> ]OK, strange. But good luck bughunting. I'm afraid I cannot help you with that, but if you need any testing done, let me know!

I think I've fixed the issue. I'm still not sure what the problem was but my fix bypasses all the issues (I think) by totally regenerating the model object. I did find another bug involving changing background color but that doesn't affect the rendering of the model.
(2021-06-11, 3:01)Orion Pobursky Wrote: [ -> ]I think I've fixed the issue. I'm still not sure what the problem was but my fix bypasses all the issues (I think) by totally regenerating the model object. I did find another bug involving changing background color but that doesn't affect the rendering of the model.

Great. I have tested with my model and it works like a charm. Even on my iPhone! Very fast and smooth! TNX
Hey @Orion Pobursky,

I would like to use the Viewer for a small university webpage for a lego lab (a lego lab made with school children, only for educational purpose).

We have a few own models (as .ldr files, converted from Lego Studio .io) and we would only need a basic simple viewer to show/zoom/rotate the 3D models as a motivation for the kids how the final model looks like.

Is there a copyright?

Or did you just used the ldraw viewer docs from ThreeJS for building it ?

Any code you would like to share (basic functionality around ldraw viewer) ?
(2023-10-09, 14:30)Eduard Wrote: [ -> ]Hey @Orion Pobursky,

I would like to use the Viewer for a small university webpage for a lego lab (a lego lab made with school children, only for educational purpose).

We have a few own models (as .ldr files, converted from Lego Studio .io) and we would only need a basic simple viewer to show/zoom/rotate the 3D models as a motivation for the kids how the final model looks like.

Is there a copyright?

Or did you just used the ldraw viewer docs from ThreeJS for building it ?

Any code you would like to share (basic functionality around ldraw viewer) ?

Hi Eduard,

We are using buildinginstructions.js (which in turn is using ThreeJS) found here:
https://github.com/LasseD/buildinginstructions.js

There is some custom code involved but that's just to make things easier on the back end. Lasse's instructions can be used as is.

Our code can be found here:
https://github.com/ldraw-org/ldraworg-li...js/ldbi.js
https://github.com/ldraw-org/ldraworg-li...rgscene.js