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
Very impressed with what you've got there.

Recently thought i'd give WebGL a go my self. Mainly to replace the ancient LDraw cad software i made about 8 years ago: http://news.lugnet.com/cad/?n=11299 It's still available from that link if your interested.

Looks like your about two months ahead of me in dev. I have models loading and showing with nice normal's etc but it's all server side gen. Will let you know when i get mine up on a server.
Much rougher than yours atm. But here is my WebGL LDraw project.
The parts list on my server is a cut down one, so most models won't work yet.
http://mr-bucket.co.uk/TestWebGL.aspx
I would like to use this on my website. Can't wait!!
I just tested again with the same file, but unfortunately it still does not work Sad
If I can be of any help please let me know.
yeah i still havn't solved the bug.. i'll look into it asap Smile
Daniel B Wrote:Much rougher than yours atm. But here is my WebGL LDraw project.
The parts list on my server is a cut down one, so most models won't work yet.
http://mr-bucket.co.uk/TestWebGL.aspx

That's great Smile An online editing tool would be nice!
Thanks Smile Well if you want to use it you can do that already. All sources are up and installing should be straightforward but if you need help just ask. I'm already using it in a project of mine
I had also an eye on that, but for me it was not "straight forward" Sad so I pushed it away that day.
Maybe you can write some lines how to make it work. Smile
maybe I am tooooo stupid.
ok i verified the problem. There's a line that breaks everything:

1 117313504 -125 -208 -400 0 0 1 0 1 0 -1 0 0 3941.DAT

The color number is clearly off and javascript chokes. Replacing with the following will work.

1 14 -125 -208 -400 0 0 1 0 1 0 -1 0 0 3941.DAT

Note that the other problem is still there. Also i noticed that the file use spaces in internal file names, i think brigl don't like that either.
I've attached the cleaned file. Here's how it render:

[Image: tTV6b.png]
The colour number is not off, it's an custom one.

See also this recent thread:

http://forums.ldraw.org/showthread.php?t...60#pid7660
ohh thanks! that was the same model too.
i think i'll pass this one
Thanks for the update.

Regarding filenames with spaces I found no limitation in our specs that they are not allowed. Even more in the spec for OMR the delimiter for set number and set description is " - " (whitespace, dash, whitespace). So your parser *needs* to support whitespace in filenames.
I am sure you will find a solution Smile
yes it currently support single space separators but nothing else (no double spaces etc) Smile it needs to be fixed
Yes, some instructions would be nice, as well as a zip file with everything we need in it.
Michael Horvath Wrote:Yes, some instructions would be nice, as well as a zip file with everything we need in it.

Ok, i'll write something. The hardest part is preparing the part library: pieces must be spread in different folders becouse servers tipically don't like 7000+ files in a single folder (btw this is something LDraw could consider too, that is not a good thing in general).
I'll write a little utility to do that.
This can be fixed using an alternative filesystem or different formatting parameters for ext3/4
i think this is something we should leave to the underlying filesystem:
from the perspective of the ldraw library, "parts" are in a, or better, in one "folder".
if this number of files is big and the filesystem internally wants to spread this, it can do.
outside, to the user, it should still be a single folder.
i do not want to search multiple folders for parts, and i especially don't want to do this different on different os' es...
While I'm not advocating splitting things up, it's definitely not up to the file system. The whole stated problem is that some file systems have problems when there are a large number of files in one directory. To be honest, I don't think the 6000+ files we have now is causing problems, but the file system can't internally spread them out, because that would redefine the meaning of a directory.

As for searching, do you do your searches against the actual files on the disk, or using tools based on LDraw? Any change to the folder structure would require updating all tools to support the change, which is why I don't think it will ever (or even should ever) happen. But since the tools would have to be updated anyway, a change in the underlying structure wouldn't change the user experience for people using the tools.
Hey Nicola,

your Brigl renderer is really awesome. I gave it a try and it works great for my concerns.

I hope it is still ok for you if I use it on a webpage (e.g. http://www.digital-bricks.de/en/index.php?site=flp)?

Thanks for sharing.
Rolf
Of course it is, that's why i made it Smile
Question is: Is there a way to use it here on the forums in some ways? For example generating pics of models or parts people just submit as .ldr or .dat and a pic of the content is added to the post?

w.
Yes, that shouldn't be hard. What you need to run it is loading the part library to some folder on the same origin as the page running it. I think Ldraw should already have it avaiable. The rest is standard javascript fiddling (include JS files, add some snippet of code, etc).

Here's a more detailed howto.

You can take a look at the simplest example here.
Rebrickable is also using brigl on their part detail page.
WOW; that would be AWESOME...

EVEN the parts tracker could show the PARTS this way...

imagine a 3D object there, interacting with your mouse...
Hey Nicola,

indeed, the LDraw site should have the complete library online (can somebody confirm that?).
I think the biggest challange is, that your renderer needs the complete library in a special
folder structure (one folder or your suggested subfolder structure).

I have almost no skills in JavaScript, but I had a closer look into your code, tried some
changes and used copy and past to generate the following code snippet (the paths are
hardcoded):

Code:
asyncReq: function(partName, callback)
{
  var purl = "../parts/"+partName;
  purl = purl.replace(/\\/gi,"/");
  this.asyncnum++;
  new Ajax.Request(purl, {
    method:'get',

    onSuccess: (function(transport) {
      var res = transport.responseText;
      this.asyncnum--;
      callback(res);
    }).bind(this),

    onFailure: (function() {
      purl = "../p/"+partName;
      new Ajax.Request(purl, {
        method:'get',
        
        onSuccess: (function(transport) {
          var res = transport.responseText;
          this.asyncnum--;
          callback(res);
        }).bind(this),
  
        onFailure: (function() {
          this.asyncnum--;
          alert( 'Something went wrong loading: '+purl);
        }).bind(this)
      });
    }).bind(this)
  });
},

Due to my missing knowledge of JavaSkript, I have no idea if my code causes deadlocks or
dead threads or ... whatever. But it seems to work with the standart folder structure: http://www.digital-bricks.de/en/index.ph...&part=3005

I would really like to see your Brigl renderer used at the parts tracker and / or in this forum.

Rolf
This is in the works. I just want to make sure it "fails gracefully" on unsupported browsers/hardware
YAY! hurray!
I'm having trouble implementing the viewer.
Everything seems to be working fine. The log messages are displaying but the viewer doesn't appear.

I think this might be a file path issue. I'm using:
Code:
var builder = new BRIGL.Builder("parts/",{dontUseSubfolders:true});

What should the library path I pass to the viewer be relative to? The html file containing the viewer code? Absolute for the webserver?
Hey Orion,

for the digital-bricks.de website, I use the following line:

Code:
var builder = new BRIGL.Builder("../parts/", {dontUseSubfolders:"true"});

I use the relative path from the html file containing the viewer code. When your parts folder and this file are in the same folder you may try "./parts/".

Rolf
Ok. It was a path and permissions problem with my local server. Hopefully I fixed it and can have this up soon on the forums.
Still getting a 403 forbidden error code even though I've set the parts directory to global read/write. Any ideas?
This is totally on my end and in no way related to the brigl software. I'l have to troubleshoot some more.
Ok, I've worked out the bugs. Now clean up the viewport code and implement fallback code.
Orion Pobursky Wrote:Ok, I've worked out the bugs. Now clean up the viewport code and implement fallback code.

Hello there! Sorry, for some reasons i didn't received notifications and missed these new posts!
Let me know if you still need help with it. I'm planning to resume working on brigl soon and finally get the smoothing right and upgrading to the last version of Three.js
I am still dreaming of seeing brigl being used for the parts display on the Parts Tracker
and of files posted here in the forum...
that'll just be *awesome*
As usually happens when I'm near in completion of a project, real life got in the way. Hopefully I'll have some free time during the holidays to finish up the half a dozen little LDraw items I've been working on.
Big Grin
Hi everybody,

I have download all sources and parts, upload them on my server.
Implement the viewer, but nothing appear !!!!

http://www.brickmarket.fr/gui/webGL3D/web/simple2.html

I just try to see the part 3005.dat.

Model loaded successfully
Generating geometry
Loading 4-4disc.dat
Loading 4-4cyli.dat
Loading 4-4edge.dat
Loading stud.dat
Loading box5.dat
Loading ../parts/3005.dat
Creating ../parts/3005.dat...
Initializing...

Could you help me ?
I still wonder if this is doable - Orion?

w.
+1

if BrickSet can do it,
then why shouldn't we be using it in the forums and the PT?
I have no control over the file system. I just rent space from a web hosting company.
Hey there Nicola,

Been playing around with Brigl and must say I love it.

Is there any way to revise or enable LDraw's standard parts directory listing instead of the parsing your JS proposes or the no subdir option (which forces everything into a single directory)?

Thank you.
Nathanel Titane Wrote:Is there any way to revise or enable LDraw's standard parts directory listing instead of the parsing your JS proposes or the no subdir option (which forces everything into a single directory)?

Hey Nathanel,

it is some time ago now, but I once wrote this post. I think this is exactly what you are looking for?

Rolf
Hey Rolf, thanks for posting the reply Smile - where would I append the code to enable it? I am litterally |-----| << this close to getting it to work on my blog Smile
brigl does not seem to support the mpd file format...

is there any way to have it parse it properly?
Rolf, I fixed the hardcoding:

asyncReq: function(partName, callback) {
var purl = this.partsUrl + partName;
purl = purl.replace(/\\/gi, "/");
this.asyncnum++;
new Ajax.Request(purl, {
method: 'get',
onSuccess: (function(transport) {
var res = transport.responseText;
this.asyncnum--;
callback(res);
}).bind(this),
onFailure: (function() {
purl = this.partsUrl + /p/ + partName;
new Ajax.Request(purl, {
method: 'get',
onSuccess: (function(transport) {
var res = transport.responseText;
this.asyncnum--;
callback(res);
}).bind(this),
onFailure: (function() {
this.asyncnum--;
alert('Something went wrong loading: ' + purl);
}).bind(this)
});
}).bind(this)
});
},
Nicola, any way to add touch event listenenrs to brigl?
Well, my friends, here is what I've got so far: http://nathaneltitane.blogspot.ca/p/test_6.html
Nathanel Titane Wrote:Hey there Nicola,

Been playing around with Brigl and must say I love it.

Is there any way to revise or enable LDraw's standard parts directory listing instead of the parsing your JS proposes or the no subdir option (which forces everything into a single directory)?

Thank you.

Thanks Smile the nosubdir option actually use the standard part directory listing, it is not that it require a single flat directory. Just use the option and plug your library as is, it should work.

Nathanel Titane Wrote:Nicola, any way to add touch event listenenrs to brigl?

Actually that is Threejs stuff. Brigl basically create a Threejs object, and then you can do whatever you want with it. I included the BriglContainer code that will create a very basic Threejs scene, but that's just for convenience.
Brigl already support mouse event, so i guess you need touch events such as from tablets or smartphones?

Let me know if you need more help Smile
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
Pages: 1 2 3 4