LDraw.org Discussion Forums

Full Version: WebGL renderer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Hazen Babcock Wrote:Hello Nicola,

I've been hacking on this a bit as I was interested in something that would work on a tablet. I've added touch event handling (one finger to rotate, two to zoom / translate). I've also updated it to use three.js r74, tried to improve the centering and some other minor changes. If you are interested, my work is here:

https://github.com/HazenBabcock/brigl

Is your brigl project on bitbucket still active? Can I send you a patch with these changes?

best,
-Hazen

Hi, very interesting, expecially the update of three.js. Have you adjusted the smoothing algorithm too? I remember that newer version of Three.js didn't have Quads anymore, and that broke my smoothing algorithm.

I'm not developing brigl anymore, but if i have the time i can try to merge your stuff.
Yes I did adjust the smoothing algorithm for the lack of quads. It is a little more complicated but it still (seems) to work..
My e-mail address is on my github page if you want to contact me directly.

best,
-Hazen
I've tried using your new version on the OMR website and I'm still having the same problem as before your updated version: the log shows it's loading all parts (which I indeed see being downloaded in the browser), then the log shows "Model loaded successfully", but there's just nothing. No model, no error. Just that message.

Mind you: this is on my localhost and not on the 'real' omr server of course, but still... Everything seems to be working, except the actual webgl viewer. Am I just being overlooking something completely obvious?
Does it work on either of these sites?
http://www.lugato.net/brigl/index.html
http://hazenbabcock.github.io/brigl/index.html

Can you send me the file? I can try it to see if it works for me.

Another thing that can be very useful (and maybe you are already aware of?) is that many browsers have "Developer Tools", which you can use to follow exactly what is going on. Most browsers will silently ignore javascript errors, which is fine for general use but can make it very hard to figure out what the issue is when you have a problem like yours. With the developer tools running you can now see any error messages, the console log, etc.

-Hazen
Yes, it works perfectly fine on those websites and yes, I know about the development tools. Wink
That's the annoying thing; there are no errors in there...

Here's an example generated webpage (please save the file, I've uploaded it temporarily). Note that I've been moving the javascript files a bit and tried different versions, so that might be a bit messy. It still didn't work though.
I looked at this doc and my guess is that maybe it is a resizing issue. What is the initial size of the model_container div element? BRIGL won't resize the element, it will just draw it at whatever the current size is. Also, BRIGL doesn't handle resize events so the element has to already have the correct final size before rendering.

Is there a publicly accessible version somewhere that I could try and load in my browser?

-Hazen
Oh my god, you're right! I completely missed the fact that the div element needs to be set at a certain size manually. I was expecting Brigl to... just put the viewer in there. Well, not really expectingin, I didn't even think about either way. Actually, now I think of it, it's quite logical that it doesn't set its own size (I mean, it doesn't know what size it should be).

Maybe you can include it in the HOWTO.txt?

Ah well, it's working now. Thanks a lot! Smile
I'd like to include this in the omr website. However, I have 2 feature requests that would make it a little better for the omr site:
  • The LDraw files are saved with their 'OMR filename'. That means that sometimes, the loadByUrl receives a url like this:

    /media/LDraw_files/Pharaoh's%20Quest/30091/30091%20-%20Desert%20Rover.mpd

    It doesn't have any problems with the %20, but the ' (which is transformed into 'Wink seems to be a problem.
    That doesn't work. Is it possible to add support for those links?
  • It would be nice if Brigl would detect a large model (e.g. models with more than 1500 parts) and if it detects one, it doesn't load the model without the user's 'permission' (e.g. a button).

Those are 2 things I can think of at the moment to make it more suitable for the OMR.
It is good to hear that it is working now.

Thank you for the suggestion, I added a note to HOWTO.txt and a warning message to BriglContainer.

-Hazen
Does Brigl still require all parts in separated directories?
No. You can also use 1 folder with all parts. Altough you do need to combine all p and parts folders of both official and unoffical in 1 huge folder.
Or you can have a look at this variation: http://forums.ldraw.org/showthread.php?t...53#pid9953

Rolf
Hmm, I need to follow this topic.
No further comments, but this is great.
I just copy/pasted a model and it looks very nice!
That's still less than ideal to the point where I wouldn't really want to use it.
(2016-03-06, 18:33)Merlijn Wissink Wrote: [ -> ]I'd like to include this in the omr website. However, I have 2 feature requests that would make it a little better for the omr site:
  • The LDraw files are saved with their 'OMR filename'. That means that sometimes, the loadByUrl receives a url like this:

    /media/LDraw_files/Pharaoh's%20Quest/30091/30091%20-%20Desert%20Rover.mpd

    It doesn't have any problems with the %20, but the ' (which is transformed into ') seems to be a problem.
    That doesn't work. Is it possible to add support for those links?
  • It would be nice if Brigl would detect a large model (e.g. models with more than 1500 parts) and if it detects one, it doesn't load the model without the user's 'permission' (e.g. a button).

Those are 2 things I can think of at the moment to make it more suitable for the OMR.

1) How is this URL generated? I don't think brigl has any trouble with an un-escaped URL, as this works for me:

builder.loadModelByUrl("/media/Pharaoh's Quest/30091 - Desert Rover.mpd", ..)

As long as I actually have a file with that name in the correct location.


2) This might be better done with some sort of wrapper rather than brigl itself? The code that is generating these web-pages could perhaps insert a button for large models?

(2016-03-07, 10:39)Rolf Osterthun Wrote: [ -> ]Or you can have a look at this variation: http://forums.ldraw.org/showthread.php?t...53#pid9953

Rolf

This link appears to be broken.

Anyway maybe you'd be interested in forking the project and creating a pull request for this change?

-Hazen
Could someone write a tutorial on getting this to work on one's own site? The brigl site does not have instructions. Thanks.
(2016-07-28, 10:20)Michael Horvath Wrote: [ -> ]Could someone write a tutorial on getting this to work on one's own site? The brigl site does not have instructions. Thanks.

I'm on vacation now so I am not at my good old desktop (and internet) to give a full explanation, but I believe the included readme explains (although relatively basic) how to use it. I believe it boils down to adding links to all the necesary javascript files and placing the LDra library somewhere on your webserver.
(2016-07-31, 8:23)Merlijn Wissink Wrote: [ -> ]
(2016-07-28, 10:20)Michael Horvath Wrote: [ -> ]Could someone write a tutorial on getting this to work on one's own site? The brigl site does not have instructions. Thanks.

I'm on vacation now so I am not at my good old desktop (and internet) to give a full explanation, but I believe the included readme explains (although relatively basic) how to use it. I believe it boils down to adding links to all the necesary javascript files and placing the LDra library somewhere on your webserver.

Where is the readme? I can't even find a download link on the Brigl site.
It's this HOWTO.txt file I was referring to.
Okay thanks. I did not realize it was on github.
Does anyone know how to write a Windows batch file that sorts the parts library into sub-folders based on the first letter in the file name? The docs say that this should be done for performance reasons. Thanks.

[edit]

Never mind. I was able to move everything manually.

It is weird that your models need to go in the parts directory. I'd rather put them in a "models" directory next to "parts". Could this be changed in the future? Thanks.

[edit]

Here is my first model that I got working:

http://isometricland.net/lego/brigl/ldr_androbot.php

I tried enabling the "dontCenter" option because I want the script to use the model's coordinate system, but this placed the camera directly at the robot's feet. I could not zoom out any further.
Feedback:

1. One problem I noticed is that the viewer doesn't detect when the mouse leaves the display window. As a result, if you are holding a mouse button down when the cursor goes off screen, the viewer still thinks it is pressed when returning to the screen, even though you are likely to have released the button by then.
2. It would be nice to change the background color. I use a gray color normally in LDView.
3. How should we advertise for Brigl? Just link to the github page?
4. I would like to turn studs off to speed up rendering. Overall, performance is not as great as LDView.
5. Large models take a while to load. A better indication of loading using a GIF animation would be good.
6. Moving the scene using the middle mouse button is slow. You have to do it over and over again to make progress.
7. I added a border "border:3px double #888;" to the container, but the display overlaps this border to the bottom and right.

[edit]

This model crashes Chrome for some reason, and results in a black screen in IE.

http://isometricland.net/lego/brigl/ldr_...ehouse.php

Not sure why. The others work. Lack of memory?
If you are using the Github version of Brigl and you'd like some help, or you've found a problem, please open an issue on the Github project page. For reasons unclear to me, even though I think I'm subscribed to this thread I never get any e-mail notices about new posts.

best,
-Hazen
(2018-02-19, 22:59)Hazen Babcock Wrote: [ -> ]If you are using the Github version of Brigl and you'd like some help, or you've found a problem, please open an issue on the Github project page. For reasons unclear to me, even though I think I'm subscribed to this thread I never get any e-mail notices about new posts.

best,
-Hazen

I think I fixed the issue. Not sure.
(2018-02-20, 1:36)Orion Pobursky Wrote: [ -> ]
(2018-02-19, 22:59)Hazen Babcock Wrote: [ -> ]If you are using the Github version of Brigl and you'd like some help, or you've found a problem, please open an issue on the Github project page. For reasons unclear to me, even though I think I'm subscribed to this thread I never get any e-mail notices about new posts.

best,
-Hazen

I think I fixed the issue. Not sure.

Thanks! I'm getting the e-mail notices now.
For what it is worth: loading stops at "Loading 3-4ndis.dat" in Firefox.

This one loads fine http://isometricland.net/lego/brigl/ldr_androbot.php
(2018-02-20, 12:01)Jaco van der Molen Wrote: [ -> ]For what it is worth: loading stops at "Loading 3-4ndis.dat" in Firefox.

This one loads fine http://isometricland.net/lego/brigl/ldr_androbot.php

Sorry, loading of what?

I just checked simple with Firefox 58.0.2 (64-bit) and it loaded correctly.
(2018-02-20, 12:34)Hazen Babcock Wrote: [ -> ]
(2018-02-20, 12:01)Jaco van der Molen Wrote: [ -> ]For what it is worth: loading stops at "Loading 3-4ndis.dat" in Firefox.

This one loads fine http://isometricland.net/lego/brigl/ldr_androbot.php

Sorry, loading of what?

I just checked simple with Firefox 58.0.2 (64-bit) and it loaded correctly.

That simple loads fine with me too.
It is this one that stops loading like stated in this thread:
http://isometricland.net/lego/brigl/ldr_...ehouse.php

It is loading many dat files but stops at "Loading 3-4ndis.dat"
(2018-02-20, 14:22)Jaco van der Molen Wrote: [ -> ]
(2018-02-20, 12:34)Hazen Babcock Wrote: [ -> ]Sorry, loading of what?

I just checked simple with Firefox 58.0.2 (64-bit) and it loaded correctly.

That simple loads fine with me too.
It is this one that stops loading like stated in this thread:
http://isometricland.net/lego/brigl/ldr_...ehouse.php

It is loading many dat files but stops at "Loading 3-4ndis.dat"

There seem to be two problems here. The first is that this model requires two files 'm6666.ldr' and 'm6643.ldr' which are not found on this server. The missing file problem then triggers a call to an error callback function which has a bug, causing an exception and stopping the model loading process. I think the bug is fixed in the current version of BRIGL, but there is not much I can do about the missing files.
(2018-02-19, 22:59)Hazen Babcock Wrote: [ -> ]If you are using the Github version of Brigl and you'd like some help, or you've found a problem, please open an issue on the Github project page. For reasons unclear to me, even though I think I'm subscribed to this thread I never get any e-mail notices about new posts.

best,
-Hazen

FYI

https://github.com/HazenBabcock/brigl/issues/8

I installed the latest GitHub version. My first model loads eventually, but there are dozens of 404 errors in Chrome's Developer Tools.

http://isometricland.net/brigl/ldr_redrockracer.php

If I try a larger model, it does not load properly, and eventually results in my whole website becoming unresponsive for 15 minutes or thereabout.

http://isometricland.net/brigl/ldr_carriagehouse.php
I updated BRIGL on my web server. Works okay, but some parts have issues. For instance, look at these heads:

http://isometricland.net/brigl/ldr_headsgrid.php
(2019-06-28, 6:57)Michael Horvath Wrote: [ -> ]I updated BRIGL on my web server. Works okay, but some parts have issues. For instance, look at these heads:

http://isometricland.net/brigl/ldr_headsgrid.php

To me it looks like your library have issues.
I see two broken heads that I know have been reworked and corrected. They used an old obsolete subfile, and wasn't correctly bfc'd. They are corrected, but right now I don't know their status, official or unofficial.
(2019-06-28, 6:57)Michael Horvath Wrote: [ -> ]I updated BRIGL on my web server. Works okay, but some parts have issues. For instance, look at these heads:

http://isometricland.net/brigl/ldr_headsgrid.php

The OMR brigl points to an always up to date version of the library. If there’s an OMR model that uses the parts in question then you can check.
(2019-06-28, 15:41)Orion Pobursky Wrote: [ -> ]The OMR brigl points to an always up to date version of the library. If there’s an OMR model that uses the parts in question then you can check.

What is "OMR brigl"? Thanks.
I can confirm that brigl works correctly in conjunction with LDBoxer parts.

https://github.com/Jeremy1980/LDBoxer

These parts likely will improve performance, though I have not done any benchmarking.

Here is an example:

http://isometricland.net/brigl/ldr_carriagehouse.php

This model may take several minutes to fully load. It may seem as if the loading has become "stuck" and has stopped advancing. (This is my #1 major annoyance with brigl.) Just be patient and let the browser tab alone for a while.
(2019-06-28, 15:32)Magnus Forsberg Wrote: [ -> ]To me it looks like your library have issues.
I see two broken heads that I know have been reworked and corrected. They used an old obsolete subfile, and wasn't correctly bfc'd. They are corrected, but right now I don't know their status, official or unofficial.

My complete.zip is dated 2018/12/27. Is there a newer one?
(2019-06-28, 18:52)Michael Horvath Wrote: [ -> ]What is "OMR brigl"? Thanks.

The OMR uses Brigl to display models and uses the official, always up to date, library on the LDraw server. If there's a model currently in the OMR that uses the parts in question then you can use it to see if the problem recurs there.
(2019-06-28, 19:02)Orion Pobursky Wrote: [ -> ]The OMR uses Brigl to display models and uses the official, always up to date, library on the LDraw server. If there's a model currently in the OMR that uses the parts in question then you can use it to see if the problem recurs there.

There is a note on the OMR Brigl page that some models might cause Brigl to crash. Do you happen to remember which ones in particular are problematic?
(2019-06-29, 16:00)Hazen Babcock Wrote: [ -> ]There is a note on the OMR Brigl page that some models might cause Brigl to crash. Do you happen to remember which ones in particular are problematic?

I think it's less of a model problem and more of a problem with model size and horsepower of the rendering machine.  Example: 10030 crashes the tab on my iPhone but loads perfectly fine on my desktop.
(2019-06-29, 16:17)Orion Pobursky Wrote: [ -> ]I think it's less of a model problem and more of a problem with model size and horsepower of the rendering machine.  Example: 10030 crashes the tab on my iPhone but loads perfectly fine on my desktop.
Maybe there is some way for Brigl to be more aware of the limitations of the browser that it is operating in. I'll look into this.
(2019-06-28, 18:53)Michael Horvath Wrote: [ -> ]I can confirm that brigl works correctly in conjunction with LDBoxer parts.

https://github.com/Jeremy1980/LDBoxer

These parts likely will improve performance, though I have not done any benchmarking.

Here is an example:

http://isometricland.net/brigl/ldr_carriagehouse.php

This model may take several minutes to fully load. It may seem as if the loading has become "stuck" and has stopped advancing. (This is my #1 major annoyance with brigl.) Just be patient and let the browser tab alone for a while.
It seems to be mostly caused by the latency between discovering and fetching parts. By optimizing this process it should become much quicker to load. I have uploaded it here on a page where the server pre-fetches parts you need and it loads much quicker - click "View 3D" to load the 3D model (and please tell me if you want me to delete the entry again - it is just uploaded as a demo)

By the way. This model is a wonderful test model. The use of "0 Name:" lines and naming with ".dat" is completely unexpected, so I will have to change my algorithm to properly detect this use case.
(2019-06-28, 15:32)Magnus Forsberg Wrote: [ -> ]To me it looks like your library have issues.
I see two broken heads that I know have been reworked and corrected. They used an old obsolete subfile, and wasn't correctly bfc'd. They are corrected, but right now I don't know their status, official or unofficial.

I updated my parts library to the one released a few days ago, but the problem persists. I wonder why the recently "fixed" versions weren't pushed to the official release.
(2019-06-29, 16:36)Lasse Deleuran Wrote: [ -> ]It seems to be mostly caused by the latency between discovering and fetching parts. By optimizing this process it should become much quicker to load. I have uploaded it here on a page where the server pre-fetches parts you need and it loads much quicker - click "View 3D" to load the 3D model (and please tell me if you want me to delete the entry again - it is just uploaded as a demo)

By the way. This model is a wonderful test model. The use of "0 Name:" lines and naming with ".dat" is completely unexpected, so I will have to change my algorithm to properly detect this use case.

Interesting. I have some (outdated I'm sure) JavaScript experience, but none with AJAX or WebGL.

I'm not sure "0 Name" is an official LDraw comment type. I think MLCad did add it to the model, however. Also, the ".dat" extension is there because this model is nearly 20 years old. (It is also outdated, as am I.)

Wink

Yes, you may keep the model up.
(2019-06-29, 16:17)Orion Pobursky Wrote: [ -> ]I think it's less of a model problem and more of a problem with model size and horsepower of the rendering machine.  Example: 10030 crashes the tab on my iPhone but loads perfectly fine on my desktop.
I'd suggest using the "dontSmooth:true" option for the larger models. For example I tried to render 101341-1 (Y-wing Attack Starfighter) and after spending several minutes working on smoothing my browser timed out.
(2019-06-29, 16:36)Lasse Deleuran Wrote: [ -> ]It seems to be mostly caused by the latency between discovering and fetching parts. By optimizing this process it should become much quicker to load. I have uploaded it here on a page where the server pre-fetches parts you need and it loads much quicker - click "View 3D" to load the 3D model (and please tell me if you want me to delete the entry again - it is just uploaded as a demo)

Does this BrickHub page use BRIGL or some other renderer?
(2019-07-07, 6:51)Michael Horvath Wrote: [ -> ]Does this BrickHub page use BRIGL or some other renderer?

It uses buildinginstructions.js: https://github.com/LasseD/buildinginstructions.js

I am currently looking into OMR compliance and optimization of indexedDB, but different renders are in the pipeline.
(2019-07-07, 12:18)Lasse Deleuran Wrote: [ -> ]It uses buildinginstructions.js: https://github.com/LasseD/buildinginstructions.js

I am currently looking into OMR compliance and optimization of indexedDB, but different renders are in the pipeline.

Do the sample files work offline too?
(2019-07-10, 22:28)Michael Horvath Wrote: [ -> ]
Do the sample files work offline too?

They do, but files are fetched asynchroneously, so opening the sample files in your browser might not work out of the box due to default security settings. To get around this you can either host the files on a local server or disable the browser checks. As an example, Chrome can be started with the following parameters in order to disable these security settings:


--disable-web-security --user-data-dir=some_directory_where_it_is_ok_that_chrome_saves_a_lot_of_files


Personally, I run a simple Python web server: "python -m SimpleHTTPServer" in the root folder of the project.
(2019-07-07, 12:18)Lasse Deleuran Wrote: [ -> ]It uses buildinginstructions.js: https://github.com/LasseD/buildinginstructions.js

I am currently looking into OMR compliance and optimization of indexedDB, but different renders are in the pipeline.

I just wanted to share this other online 3D webGL LDraw viewer that also uses bi.js: it adds the possibility to change the background and export the image as png: https://beta.makerbrane.com/tools/ldraw-viewer/ 

Hope this helps Smile
(2019-07-18, 15:02)caesar Wrote: [ -> ]I just wanted to share this other online 3D webGL LDraw viewer that also uses bi.js: it adds the possibility to change the background and export the image as png: https://beta.makerbrane.com/tools/ldraw-viewer/ 

Hope this helps Smile
That website works super smoothly. Very nicely done!
Pages: 1 2 3 4