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!
User avatar
r-frank
Veteran
Posts: 2180
Joined: Thu Jan 24, 2013 6:26 pm
Location: Möckmühl, Germany
Contact:

Re: WebGL export

Post by r-frank »

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
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: WebGL export

Post by paullee »

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
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

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

Post by ehb »

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
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: WebGL export

Post by paullee »

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 4757 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
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

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
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: WebGL export

Post by paullee »

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
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: WebGL export

Post by paullee »

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
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

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 4327 times
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: WebGL export

Post by triplus »

I guess this is it for today:
Exploded.png
Exploded.png (23.5 KiB) Viewed 4312 times
As the thing exploded in the tests. I guess back to the drawing board. ;)
Post Reply