Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebAssembly Support #114

Open
udhos opened this issue Feb 28, 2019 · 14 comments
Open

WebAssembly Support #114

udhos opened this issue Feb 28, 2019 · 14 comments

Comments

@udhos
Copy link

udhos commented Feb 28, 2019

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?

@Thommil
Copy link

Thommil commented Mar 5, 2019

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.

@danaugrs
Copy link
Member

danaugrs commented Mar 5, 2019

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

@NiNJAD3vel0per
Copy link

NiNJAD3vel0per commented Mar 12, 2019

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.

@justinclift
Copy link
Contributor

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... 😄

@justinclift
Copy link
Contributor

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

Guess that's the new wasm branch? 😄

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

@Thommil
Copy link

Thommil commented Mar 13, 2019

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.

@danaugrs
Copy link
Member

@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

@justinclift
Copy link
Contributor

Oh... play.g3n.rocks. That's a good concept. 😄

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. 😄

@ghost
Copy link

ghost commented Jun 14, 2019

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

https://github.com/dave/jsgo

Should help alot

@justinclift
Copy link
Contributor

justinclift commented Jun 23, 2019

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. 😉

This was referenced Sep 6, 2019
@danaugrs danaugrs added the mobile label Sep 6, 2019
@danaugrs
Copy link
Member

danaugrs commented Sep 9, 2019

Mobile support is now being tracked by #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 danaugrs changed the title Can GoMobile be supported? WebAssembly Support Sep 9, 2019
@danaugrs danaugrs added the wasm label Sep 9, 2019
@amine605
Copy link

amine605 commented Aug 4, 2021

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

@danaugrs
Copy link
Member

danaugrs commented Aug 9, 2021

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 danaugrs pinned this issue Aug 30, 2021
@ronoaldo
Copy link

ronoaldo commented May 3, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants