WebGL export

Info about new implemented features, classes, modules or APIs. Might get technical!
User avatar
r-frank
Posts: 2067
Joined: Thu Jan 24, 2013 6:26 pm
Location: Möckmühl, Germany
Contact:

Re: WebGL export

Postby r-frank » Wed Jun 22, 2016 9:39 am

triplus wrote:
Few days back i found this project:
http://www.babylonjs.com/
http://www.babylonjs-playground.com/
And it looks good. Produced models are of good quality and the performance is great. Maybe we could use it in FreeCAD in the future to get better results.


Nice find triplus, thanks for sharing.
Bookmarked (study material for rainy sunday afternoons ... :D )

Roland
Deutsche FreeCAD Tutorials auf Youtube
My GrabCAD FreeCAD-Projects
FreeCAD lessons for beginners in english

Native german speaker - so apologies for my english, no offense intended :)
paullee
Posts: 121
Joined: Wed May 04, 2016 3:58 pm

Re: WebGL export

Postby paullee » Wed Jun 22, 2016 11:19 pm

Thanks for sharing. There are quite a few similar projects but haven't tried to work with FreeCAD.

Do you export to obj or otherwise to this project?

It would be great if FreeCAD can export webgl with good setting to show the models in sharp images (FreeCAD export issues afterall?)



triplus wrote:@paullee

Sorry i can’t help out. I guess current WebGL support in FreeCAD is rather basic and without substantial effort put into it this won't change.

Few days back i found this project:

http://www.babylonjs.com/

http://www.babylonjs-playground.com/

And it looks good. Produced models are of good quality and the performance is great. Maybe we could use it in FreeCAD in the future to get better results.
triplus
Posts: 5013
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Postby triplus » Thu Jun 23, 2016 2:23 am

r-frank wrote:Nice find triplus, thanks for sharing.


You're welcome.

paullee wrote:Thanks for sharing. There are quite a few similar projects but haven't tried to work with FreeCAD.

Do you export to obj or otherwise to this project?

It would be great if FreeCAD can export webgl with good setting to show the models in sharp images (FreeCAD export issues afterall?)


Note that it looks like Microsoft is behind this library. I don't see any issues due to the licence it uses but still i decided to mentioned this. ;)

There is OBJ and STL "loader" available. But i read better results are achieved when using Blender exporter. I didn't do much tests but it does look like something that has potential and can be useful in its current form!
ehb
Posts: 17
Joined: Sat May 16, 2015 8:54 pm

Re: WebGL export

Postby ehb » Mon Jun 27, 2016 6:52 pm

BabylonJS looks awesome!

In light of the "3D in browser thing" I'd like to mention http://www.x3dom.org, hope it's not too off-topic.
What's nice about it is that you can access the elements in a X3D file (XML 3D) via your regular HTML DOM. So changing the attributes of a 3D object becomes as easy as anything else you'd do with JS.
A fun introduction to X3DOM (in this case, combined with jQuery) can be found here: http://math.nist.gov/~SRessler/x3dom/re ... ryTut.html

I found the learning curve quite lower than with WebGL, however, it's been a couple years...

I'd love direct X3D export in FreeCAD though, as to not have to go via VRML first.
paullee
Posts: 121
Joined: Wed May 04, 2016 3:58 pm

Re: WebGL export

Postby paullee » Tue Jun 28, 2016 6:28 pm

Got the model on webgl, but found some patches of colour and lines not rendered exactly match the shapes.


Screenshot from 2016-06-29 02-14-51 _crop.jpg
Screenshot from 2016-06-29 02-14-51 _crop.jpg (214.99 KiB) Viewed 876 times


triplus wrote:
r-frank wrote:Nice find triplus, thanks for sharing.


You're welcome.

paullee wrote:Thanks for sharing. There are quite a few similar projects but haven't tried to work with FreeCAD.

Do you export to obj or otherwise to this project?

It would be great if FreeCAD can export webgl with good setting to show the models in sharp images (FreeCAD export issues afterall?)


Note that it looks like Microsoft is behind this library. I don't see any issues due to the licence it uses but still i decided to mentioned this. ;)

There is OBJ and STL "loader" available. But i read better results are achieved when using Blender exporter. I didn't do much tests but it does look like something that has potential and can be useful in its current form!
triplus
Posts: 5013
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Postby triplus » Tue Jun 28, 2016 9:42 pm

Nice. This is the result you got by using Babylon.js?

If yes what approach did you use in the end? Did you try out the FreeCAD to Blender option and after using Blender exporter?

https://doc.babylonjs.com/exporters/Ins ... n_Exporter
paullee
Posts: 121
Joined: Wed May 04, 2016 3:58 pm

Re: WebGL export

Postby paullee » Thu Jun 30, 2016 4:41 pm

This is only exported from FreeCAD. I have yet to explore other available alternative.


triplus wrote:Nice. This is the result you got by using Babylon.js?

If yes what approach did you use in the end? Did you try out the FreeCAD to Blender option and after using Blender exporter?

https://doc.babylonjs.com/exporters/Ins ... n_Exporter
paullee
Posts: 121
Joined: Wed May 04, 2016 3:58 pm

Re: WebGL export

Postby paullee » Sun Jul 10, 2016 3:56 am

Still unable to fix the rendering problems - the part of model further away from the camera, the worse is the rendering. You can see there are 'bleeding' through lines, many tiny patches of colour not supposedly on that faces etc.

Seems three.js or webgl issues? Anybody have similar problems?


paullee wrote:Got the model on webgl, but found some patches of colour and lines not rendered exactly match the shapes.


Screenshot from 2016-06-29 02-14-51 _crop.jpg

triplus wrote:
r-frank wrote:Nice find triplus, thanks for sharing.


You're welcome.

paullee wrote:Thanks for sharing. There are quite a few similar projects but haven't tried to work with FreeCAD.

Do you export to obj or otherwise to this project?

It would be great if FreeCAD can export webgl with good setting to show the models in sharp images (FreeCAD export issues afterall?)


Note that it looks like Microsoft is behind this library. I don't see any issues due to the licence it uses but still i decided to mentioned this. ;)

There is OBJ and STL "loader" available. But i read better results are achieved when using Blender exporter. I didn't do much tests but it does look like something that has potential and can be useful in its current form!
triplus
Posts: 5013
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Postby triplus » Mon Dec 05, 2016 4:10 pm

I will try to improve WebGL exporter a bit. Things like better camera and interaction support. Maybe to offer some possibility what geometry to export. As exporting lines/edges substantially inflates the file:

viewtopic.php?f=3&t=16473&start=70#p147616

Maybe there will be improved color support. I can't be sure yet.

P.S. Lines will likely look a bit better on default settings:

Lines.png
Lines.png (12.58 KiB) Viewed 446 times
triplus
Posts: 5013
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Postby triplus » Mon Dec 05, 2016 5:07 pm

I guess this is it for today:

Exploded.png
Exploded.png (23.5 KiB) Viewed 431 times


As the thing exploded in the tests. I guess back to the drawing board. ;)