pluginless web browser ogre embedding through emscripten

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
kkimlabs
Gnoblar
Posts: 1
Joined: Wed Jun 20, 2012 8:17 am

pluginless web browser ogre embedding through emscripten

Post by kkimlabs » Wed Jun 20, 2012 8:34 am

I recently discovered emscripten, and I think it's really cool. Maybe ogre3d can benefit from it.

https://github.com/kripken/emscripten/wiki
"Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode (which can be generated from C/C++ using Clang, or any other language that can be converted into LLVM bitcode) and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).

Using Emscripten, you can:
*Compile C and C++ code into JavaScript and run that on the web
*Run code in languages like Python as well, by compiling CPython from C to JavaScript and interpreting code in that on the web"

the most relevant demo(bullet+webgl) : http://www.syntensity.com/static/ammo.html


Cons:
web standard(unlike NaCl which is not likely to be supported other than the chromium browser family)
pluginless
incorporates LLVM; thus less modification is required.

Pros:
possibly slow speed (the bullet+webgl demo shows 60 fps on my machine but not sure for more complex scene)
needs webgl porting.
0 x

kripken
Gnoblar
Posts: 22
Joined: Thu May 15, 2008 8:07 am

Re: pluginless web browser ogre embedding through emscripten

Post by kripken » Mon Jul 02, 2012 7:18 pm

Hi, I'm an Emscripten dev. We've ported entire game engines, for example Cube 2/Sauerbraten,

http://www.syntensity.com/static/night8/ (warning: needs a development build of Firefox or Chrome)

so Ogre would definitely be possible. If someone is interested in doing this I would be happy to help on the Emscripten side.
0 x

jj
Halfling
Posts: 50
Joined: Thu Apr 03, 2008 1:33 am

Re: pluginless web browser ogre embedding through emscripten

Post by jj » Tue May 07, 2013 9:09 pm

Hi!

Any progress on this? It would just be amazing to be able to run Ogre on a browser without a plugin installation.... Would be the way to keep up with Three.js and the like engines.

Thanks!
jj
0 x

TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin

Re: pluginless web browser ogre embedding through emscripten

Post by TheSHEEEP » Wed May 08, 2013 8:23 am

jj wrote:Would be the way to keep up with Three.js and the like engines.
"Keep up" is definitely the wrong phrase here ;)

WebGL & JavaScript is by far not as grown up as many people claim it to be. Networking, audio, videos, etc. are still a pita (and there are many more shortcomings).
Give 'em some more years and we will see where they are then :)
0 x
My site! - Have a look :)
Also on Twitter - extra fluffy

kripken
Gnoblar
Posts: 22
Joined: Thu May 15, 2008 8:07 am

Re: pluginless web browser ogre embedding through emscripten

Post by kripken » Wed May 08, 2013 3:37 pm

I would say that full 3D on the web is pretty mature, as shown by Unreal Engine 3 being able to run in JS+WebGL,

http://www.unrealengine.com/html5/

Would be great if we could get Ogre there too.
0 x

jj
Halfling
Posts: 50
Joined: Thu Apr 03, 2008 1:33 am

Re: pluginless web browser ogre embedding through emscripten

Post by jj » Wed May 08, 2013 3:57 pm

"Keep up" is definitely the wrong phrase here
Totally right :) was not my intention to be rough. The reason why I say that is cause there is so much movement now towards graphics engines running on browsers plugin-less (the recent example that kripken put is the most amazing case) that I think Ogre3d should have an eye on it, specially with possibilities like Emscripten which make it seem like a viable option. It would be a solid reason to keep using and pushing Ogre in IMHO. But don't take me wrong, I love Ogre (and we're using it on this framework about to be released, where web support would be amazing next step but it is dependent on Ogre supporting it).
0 x

kripken
Gnoblar
Posts: 22
Joined: Thu May 15, 2008 8:07 am

Re: pluginless web browser ogre embedding through emscripten

Post by kripken » Thu May 09, 2013 3:16 am

The great thing with Ogre is that it's both powerful and open source. Things like Unreal Engine and others are now running on the web or soon will, but are closed source of course. three.js and other JS WebGL engines are open source and quite good in some ways, but not powerful like Ogre is.

The WebGL space is going to become very large very soon, especially now that apparently even Internet Explorer (11) will support WebGL. So it would be great if Ogre ran on the web too and there was a really solid open source option.

My offer still stands to help on the Emscripten side if the Ogre community is interested in doing this.
0 x

User avatar
Marc
Gremlin
Posts: 182
Joined: Tue Jan 25, 2005 7:56 am
Location: Germany
Contact:

Re: pluginless web browser ogre embedding through emscripten

Post by Marc » Fri May 10, 2013 3:59 am

Ogre working with emscripten would be awesome! :)

I'm not sure about the size of the generated html though. Might get huge.
0 x
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org

TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin

Re: pluginless web browser ogre embedding through emscripten

Post by TheSHEEEP » Fri May 10, 2013 10:43 am

Well, all JavaScript stuff is typically obfuscated (All variables having only a length of 1 character, no spaces, etc.).
So the size of the engine itself shouldn't be too big.

Assets are a much bigger problem in the browser.

I'm generally for everything that pushes OpenGL, and webGL does, so you have a +1 from me if you want to try your hand at Ogre + emscripten :D
0 x
My site! - Have a look :)
Also on Twitter - extra fluffy

User avatar
Marc
Gremlin
Posts: 182
Joined: Tue Jan 25, 2005 7:56 am
Location: Germany
Contact:

Re: pluginless web browser ogre embedding through emscripten

Post by Marc » Fri May 10, 2013 10:38 pm

emscripten generated big html files. the data, you'll always have when you bring 3d to the web no matter what you do. with emscripten, a natively compiled code that becomes 500kb is 2mb in emscripted generated html. Ogremain.dll has 6mb natively for me. So that alone might become 24mb in emscripten generated html/js ...

But still, maybe we can host it at a central location and browsers could cache it.
0 x
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org

TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin

Re: pluginless web browser ogre embedding through emscripten

Post by TheSHEEEP » Fri May 10, 2013 10:51 pm

Marc wrote:emscripten generated big html files. the data, you'll always have when you bring 3d to the web no matter what you do. with emscripten, a natively compiled code that becomes 200kb is 2mb in emscripted generated html. Ogremain.dll has 6mb natively for me. So that alone might become 60mb in emscripten generated html/js ...
Mhh... nope.
I mean, yes, if you are talking about unoptimized JS. Have a look at that developer post about file size: here.
That shows a 10x increase in size compared to object files, yes. But that is mainly because all the function and variable names remain unchanged.
But as any distributed JS code should be obfuscated and stripped of anything unnecessary anyway, it is more or less a non-issue. After that stripping down is done (in that post this is done with "Closure"), the file size is only around 2x bigger than the original object file.
That's pretty good if you take into account it is not in binary format.

Also, I don't know what HTML you are talking about. emscripten afaik creates only JS files. Besides creating a "test" HTML page for embedding the JS files, that is.
0 x
My site! - Have a look :)
Also on Twitter - extra fluffy

PhilipLB
Google Summer of Code Student
Google Summer of Code Student
Posts: 550
Joined: Thu Jun 04, 2009 5:07 pm
Location: Berlin

Re: pluginless web browser ogre embedding through emscripten

Post by PhilipLB » Fri May 10, 2013 11:05 pm

Just have a look at http://flohofwoe.blogspot.de/ , where major parts of the Nebula 3 engine are compiled via Emscripten.
0 x
Google Summer of Code 2012 Student
Topic: "Volume Rendering with LOD aimed at terrain"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Mattan Furst


Volume GFX, accepting donations.

User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am

Re: pluginless web browser ogre embedding through emscripten

Post by saejox » Fri May 10, 2013 11:36 pm

Unreal is 52mb of uncompressed js code.
Three.js is 0.9mb of uncompressed js.

Three.js compressed is 100kb. I couldn't compile unreal code. Closure finds lots of errors in it.
Assuming it's 5mb. That's still 50x more than hand written webgl code.

Unreal code is at this link: http://www.unrealengine.com/html5/UDKGa ... hipping.js

Not to devalue emscripten, i think it's awesome.
However, if i wanted to create a web game i wouldn't chose a C++ engine and port it to html.
0 x
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre

User avatar
Marc
Gremlin
Posts: 182
Joined: Tue Jan 25, 2005 7:56 am
Location: Germany
Contact:

Re: pluginless web browser ogre embedding through emscripten

Post by Marc » Sat May 11, 2013 2:21 pm

The values I posted are from my own experience just this week. And yes I enabled the optimizations. Emscripten does generate a html file with the generated js in it.

However, I assume that if ogre worked with emscripten, a lot of people will be interested in it. If several projects use it and we set up a central location to host it, download size wouldn't matter that much. It's like the unity web plugin then - without having to actually install it. Instead, it will run from the browser's cache once it is loaded.
0 x
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org

TheSHEEEP
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 972
Joined: Mon Jun 02, 2008 6:52 pm
Location: Berlin

Re: pluginless web browser ogre embedding through emscripten

Post by TheSHEEEP » Sun May 12, 2013 8:22 am

Plus, you can always have a loading bar ;)
0 x
My site! - Have a look :)
Also on Twitter - extra fluffy

User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France

Re: pluginless web browser ogre embedding through emscripten

Post by Mikachu » Wed May 15, 2013 10:03 pm

kripken wrote:I would say that full 3D on the web is pretty mature, as shown by Unreal Engine 3 being able to run in JS+WebGL,

http://www.unrealengine.com/html5/
This demo has a big "only runs in firefox" sign at the moment... so it's not what I would call mature.
I guess it must use asm.js, which is firefox only atm (even if it may change in the near future), which is as good as NaCl being chrome only...
Yes, it will probably become good in the future, but I wouldn't call it ready for production right now.
In fact, I would much prefer an officially supported Ogre browser plugin rather than an slower/hacky conversion to javascript. :roll:

Just my two cents, of course :)
0 x
OgreProcedural - Procedural Geometry for Ogre3D

User avatar
Marc
Gremlin
Posts: 182
Joined: Tue Jan 25, 2005 7:56 am
Location: Germany
Contact:

Re: pluginless web browser ogre embedding through emscripten

Post by Marc » Fri May 17, 2013 12:21 am

Mikachu wrote:
kripken wrote:I would say that full 3D on the web is pretty mature, as shown by Unreal Engine 3 being able to run in JS+WebGL,

http://www.unrealengine.com/html5/
This demo has a big "only runs in firefox" sign at the moment... so it's not what I would call mature.
I guess it must use asm.js, which is firefox only atm (even if it may change in the near future), which is as good as NaCl being chrome only...
Yes, it will probably become good in the future, but I wouldn't call it ready for production right now.
In fact, I would much prefer an officially supported Ogre browser plugin rather than an slower/hacky conversion to javascript. :roll:

Just my two cents, of course :)
I'm not sure about this but afaik is asm.js just a subset of javascript. Therefore, all asm.js stuff runs on all browsers that can run js. There is a special optimization implemented in firefox that makes asm.js compliant javascript code run faster. However, this is not yet in the normal stable build but only in the nightly build. So for now, that unreal demo should run approximately equally well in ff and chrome.

There is also a port of cube2 to the browser. Including networking. Runs surprisingly well: https://developer.cdn.mozilla.net/media ... index.html
0 x
Millenium Project Enterprises - Hobbyist Gamedev Group http://www.mpe-online.org

User avatar
Mikachu
Gnoll
Posts: 603
Joined: Thu Jul 28, 2005 4:11 pm
Location: Nice, France

Re: pluginless web browser ogre embedding through emscripten

Post by Mikachu » Fri May 17, 2013 9:47 am

Marc wrote:There is a special optimization implemented in firefox that makes asm.js compliant javascript code run faster. However, this is not yet in the normal stable build but only in the nightly build.
That's what I meant about not being mature :wink:

But it's true that at least, it's cross-browser...
0 x
OgreProcedural - Procedural Geometry for Ogre3D

Dernise
Gnoblar
Posts: 1
Joined: Mon Jun 03, 2013 1:38 pm

Re: pluginless web browser ogre embedding through emscripten

Post by Dernise » Mon Jun 03, 2013 1:41 pm

It would really be awesome if ogre3D was ported to emscripten. :)
0 x

joeyye
Gnoblar
Posts: 1
Joined: Wed Jan 22, 2014 12:59 pm

Re: pluginless web browser ogre embedding through emscripten

Post by joeyye » Wed Jan 22, 2014 1:15 pm

I made ogre work on emscripten, and it can support plugin. detail information visit
https://github.com/mview/summary/wiki/Summary

There is still a lot of work need be improved, I really appreciate if anyone can help me.
0 x

Post Reply