engine icon indicating copy to clipboard operation
engine copied to clipboard

WebAssembly Support

Open udhos opened this issue 6 years ago • 14 comments

Would it be hard to use g3n engine with GoMobile?

https://github.com/golang/go/wiki/Mobile

I could not find a 3D engine for GoMobile. Maybe it could be a target for g3n as well?

udhos avatar Feb 28 '19 15:02 udhos

Hi, I've ported g3n to gomobile on my own runtime (using dedicated plugin). Also on WebGL, here is a demo of what this great engine does on browsers (mouse wheel must be fixed) : http://tge-demo.thommil.com/

For the authors, as your engine is well written, you can target GLES3 (Android 5+, WebGL2), don't bother with older versions. Have a look at my OpenGL wrapper if you want here : https://github.com/thommil/tge-gl which can be easily integrated to your gls package. I can't propose a PR as my fork is based on plugin approach for my runtime.

gomobile must be forked to target GLES3 too and some optimisations must be made to avoid allocations in draw calls.

Don't hesitate to contact be if you want to port your engine to Mobile&Web.

Thommil avatar Mar 05 '19 10:03 Thommil

That's awesome! We definitely want to target web and mobile! @leonsal and I will start working on targeting web using wasm first.

danaugrs avatar Mar 05 '19 20:03 danaugrs

If it works in browser environment, it would be so awesome !!! For example, This engine can be used to render 3d graphic editor program like Figma used Webassembly for their web editor engine in browser much faster than webgl which is indirect api of opengl (GLSL) that is why webgl has performance lack compared to native opengl binding. So, I am excited to use this engine soon for the better web experience in 3D.

maxn0d3x avatar Mar 12 '19 02:03 maxn0d3x

don't bother with older versions.

Maybe not right away, but it would be useful to have support for older versions too. There are a lot of Raspberry Pi's and similar hardware out in the wild... :smile:

justinclift avatar Mar 13 '19 07:03 justinclift

@leonsal and I will start working on targeting web using wasm first.

Guess that's the new wasm branch? :smile:

    https://github.com/g3n/engine/tree/wasm

justinclift avatar Mar 13 '19 07:03 justinclift

For GLes2, I think that a soft emulation of VAO and few changes in shaders can do the job to avoid refactoring, branching and evolutions issues. I'm not sure but it's worth a try.

Thommil avatar Mar 13 '19 07:03 Thommil

@udhos @NiNJAD3vel0per @justinclift @Thommil @amyadzuki Things are starting to work in the browser!

Also, here's a sneak peek of... something else that is in the works 😉 😄

image

danaugrs avatar Mar 13 '19 22:03 danaugrs

Oh... play.g3n.rocks. That's a good concept. :smile:

Probably especially useful if it allows people to pull .obj files (etc) from online sources. Probably need to add a caching layer then, but that could come later. :smile:

justinclift avatar Mar 14 '19 01:03 justinclift

There is a fantastic golang wasm CDN project with a playground.

https://github.com/dave/jsgo

Should help alot

ghost avatar Jun 14 '19 11:06 ghost

TinyGo added a working garbage collector for wasm a few days ago, and a reasonable subset of Go seems to be functional now. eg 2D canvas stuff can be made to work:

    https://justinclift.github.io/tinygo_canvas2/

That wasm driving that is only 45kB, uncompressed. When it's gz compressed (aka GitHub Pages, manually, or whatever), it's 19.55kB. eg 2-3% of the size of mainline Go wasm files.

This TinyGo thing has potential. :wink:

justinclift avatar Jun 23 '19 18:06 justinclift

Mobile support is now being tracked by https://github.com/g3n/engine/issues/42. I'll re-title this thread to be about WebAssembly support since that's what has been mostly discussed here.

WebAssembly support is 90% in place, only missing asset loading and audio!

danaugrs avatar Sep 09 '19 19:09 danaugrs

Hi there, Is there any new progress on this or plans ?

amine605 avatar Aug 04 '21 11:08 amine605

Hi @amine605 ! Dev is current paused as I don't have the bandwidth, but as mentioned, support it's almost done. IIRC you can comment audio imports and do some other minor changes and compilation to WASM should work. Pull requests welcome!

danaugrs avatar Aug 09 '21 13:08 danaugrs

Hi! I'm a bit late to the party but this looks very interesting! I'm willing to play with g3n soon.

ronoaldo avatar May 03 '22 15:05 ronoaldo