LDraw.org Discussion Forums
WebGL renderer - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: WebGL renderer (/thread-6835.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


WebGL renderer - Nicola - 2012-11-16

Hello! I'm playing with LDraw a lot lately, and i decided to implement something to display models with WebGL.
Here's the experimental results and some more information:

http://www.lugato.net/ldraw/page.html
new url: http://www.lugato.net/brigl/index.html

I think a WebGL renderer would be great to show off models on the web. No plugin, no downloads, etc.
It's very crude but it already show some models

Ideas and feedbacks are welcome Smile


Re: WebGL renderer - Michael Heidemann - 2012-11-16

Due to my low level grafik card I am unable to use WebGL at all. I fear there are many people out there with the same problem. But I am sure one day I am able to see your work Smile


Re: WebGL renderer - Philippe Hurbain - 2012-11-16

Looks rather nice for something "very crude" Wink


Re: WebGL renderer - Tim Gould - 2012-11-16

That is awesome.

Tim


Re: WebGL renderer - Steffen - 2012-11-17

AWESOME! AWESOME!

But I ask myself why you need a server-side piece of software to achieve that.
The LDRAW syntax is so simple that JavaScript _itself_ could parse it and produce the data for the WebGL render...

An implementation like that is exactly what I had in mind when writing this:
http://forums.ldraw.org/showthread.php?tid=1963&pid=1963#pid1963


Re: WebGL renderer - Nicola - 2012-11-17

Thank you Smile
Just to clarify, there are no server-side software, the "conversion" program runs offline and produces a javascript file with all the model vertices etc. You can see it here. The js is included in the html and then everything run off the client.

The reason i decided not to do even the parsing in javascript is becouse, while the ldraw format is easy to read, it is quite tricky to work with. And also, if you implement the parsing in javascript, you must have some way to load part files ad needed, and that mean having a web server with all the library loaded (i don't know, maybe one exists?). Given that, probably it could work!

Now i want to try to integrate the program with a better 3d library such as Three.js


Re: WebGL renderer - Steffen - 2012-11-17

Hmm, well, such webserver exists: ldraw.org ;-),
however, it probably would be more practical to keep a .zip with the latest parts update on YOUR server,
to avoid all the traffic to ldraw.org.
I really would suggest to implement parsing etc. in JavaScript, full on client side,
it is very easy to do, and as long as you have a .zip available with the latest parts update,
you can display any model a user likes.
You can download the .zip do the browser cache of the client.
And put an input control onto a page, so a user can browse for a model (*.ldr or *.mpd file)
to display OR specify the URL to it.
Then you would parse it by JavaScript, use the .zip library I just mentioned, and - voila - send it to WebGL.


Re: WebGL renderer - Tim Gould - 2012-11-17

I disagree that parsing ldraw files is easy. It's actually quite annoying in many ways. Not a difficult problem, but with enough quirks to make it painful.

Tim


Re: WebGL renderer - Travis Cobbs - 2012-11-18

Given that the current complete.zip is 19.1MB, I'm not sure that's the best way to work things. Every time it gets out of the browser cache, it would have to be reloaded in its entirety, plus any casual user that just looks at one file would have to wait for the 19.1MB download before anything would happen.

Having said that, while ldraw.org does in fact host all of the official (and unofficial) part files on its web server in a fashion that would allow automatic download, ldraw.org is also fairly slow, and getting the parts from there would probably be quite slow. Also, the last time I checked (which was admittedly years ago when implementing automatic download in LDView), gzip compression was wasn't enabled on ldraw.org, so downloading parts actually transfers all the bytes, even though part files compress extremely well, and gzip compression is standard in http 1.1.


Re: WebGL renderer - Nicola - 2012-11-18

Yeah, there are some really weird stuff, such as the conditional lines, ccw vs cw faces, inversion of subpart, etc .. i spent quite a lot to get that right Tongue