WebGL export

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

WebGL export

Post by yorik »

The Arch module now features WebGL export. It uses the famous Three.js library, by downloading a packed version of that library and embedding it in the exported file at export time. The result is a standalone HTML file that can be viewed with any WebGL-capable web browser.

There are still many caveats, mainly:

- I still couldn't think of a nice scheme for the camera position (currently it more or less adopts the position of the camera from the freecad viewport), and ideally there should be controls to rotate the camera around the objects
- Materials and lights should be implemented better (currently only uses a dumb basic material)

I hope some webgl specialist arises and helps me with that!
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: WebGL export

Post by jriegel »

Thats really cool!

I did some research some years ago on WebGL. But now it seams its getting much more mature!
But it seams there is still no good Viewer with mouse interaction out there...
Stop whining - start coding!
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: WebGL export

Post by yorik »

Actually yesterday I played a bit with Dan Falck about that... I'll try to have a basic viewer soon (mouse rotate + zoom).
Ideal would be something like this: http://carvisualizer.plus360degrees.com/threejs/
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: WebGL export

Post by jriegel »

Did you have a look on http://scenejs.org/ ?

They seem to have some selection methode:
http://www.youtube.com/watch?v=PV1LDgVCU6E
Stop whining - start coding!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

I hope this topic inspired you at least a bit:

viewtopic.php?f=10&t=2397&start=0

Great indeed. I think stuff like WebGL, HTML5, JavaScript, SVG ... represent challenges but it's ideal for FOSS projects because having any modern web browser acting as viewer for FreeCAD models/files is cutting edge and if there will be something like part database in the future preview with web browser could be implemented too...
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: WebGL export

Post by yorik »

Ah yes, scene.js is the concurrent of three.js... I think both are very similar...
That bim surfer is pretty cool, I had seen it already... it works with the http://www.bimserver.org which is also cool (I'll make a plugin for it in freecad one day, when we have IFC export done)
I just committed a new version of the webgl exporter, now it has mouse controls (LMB to rotate, MMB to zoom, RMB to pan), and the rendering window occupies the whole available space. I also added wireframe rendering so it's easier to see your stuff...
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: WebGL export

Post by NormandC »

triplus wrote:I hope this topic inspired you at least a bit:
LOL, triplus vindicated at last. ;)

You guys are aware of Shapesmith right? A web-based modeler that was based on OCC. Turns out the developer will abandon OCC in v2.0 because it brings too much complexity. He only wants it to generate models for 3D printing, so STL output doesn't really require a real CAD kernel. Not sure what library he uses to render.

A web viewer able to directly view FCStd files would be awesome, but I guess that would require some background conversion from FCStd to mesh. And I still say that the cloud is not the answer to all things. ;)
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: WebGL export

Post by yorik »

normandc wrote:A web viewer able to directly view FCStd files would be awesome
You'll be happy then, try the latest version...
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

And I still say that the cloud is not the answer to all things. ;)
The problem one year back was it was just ideas now there is something anybody can actually test. In the future there will probably be some (local/online) repository anybody will be able to upload/download it's models/parts. This will represent cloud for storing/retrieving parts and this first step Yorik did is basically adding support to be able to preview the part with web browser or opening FreeCAD and having search box on the start page or in Assembly Workbench where you can actually browse and view parts before you choose the ones you will use... There is nothing wrong with cloud like that in my opinion if you can host your local copy if you want.

This is the feature bigger CAD companies will copy in the future and FreeCAD was there/here first! ;)
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: WebGL export

Post by NormandC »

triplus wrote:There is nothing wrong with cloud like that in my opinion if you can host your local copy if you want.
That I can agree with. :)

IMO we are too trusting of big corporations and their forced cloud solutions. After all the philosophy of FOSS is control over your programs and your own data.

Just an example of how the cloud can screw you: Tinkercad was a very popular and user-friendly free online modeling program. You could only save your projects on their server, or export to STL. Well they announced they are shutting down everything by end of April, with only one month notice. I'm sure people who somehow didn't get the news will have a bad surprise when they attempt to get to their projects after next month.

OK, sorry for the off topic... Stepping down the soap box now. ;)
Post Reply