Jump to content

New Physics Engine Progress


MackeyK24
 Share

Recommended Posts

  • 3 weeks later...
  • 3 weeks later...

Hi, 

Few news about energyJS, It's still in dev. Here is a quick very alpha  preview with examples. This is not a bjs plugin version. @RaananW worked one year ago on the plugin. We need to talk about that, For the moment it reproduces more the c inteface of ODE c++ project(http:// www.ode.org). It's quite usefull, ODE documentation is really good, and I kept all the method name.  Energyjs is port of Open dynamic engine to JS with EMSscripten (http://kripken.github.io/emscripten-site/) . 

Tuto1_friction

Tuto2_friction2

Tuto3_bounce

Tuto4_rolling_friction

Tuto5_rolling_friction2

Tuto6_contact_cfm_erp

Tuto7_contact_cfm_erp2

Tuto8_motion

Tuto1_auto_disable_body

WoodMachine

BallJoint

Trimeshes

Vehicle   (maybe you need to refresh the html page - loading is async and I forgot to fix that,, same for v+trailers)

Vehicle+trailers (arrow key to control the vehicle, d to flip the vehicle)

 

It's only cpu dependent, maybe a little more faster than oimo and canon. Really well documented on ODE's part. You may have a TOTAL_MEMORY bug, search '167108864' in js/energy.js and increased this value.  This is just a start. I will publish this week the the typescript dev commented on github . 

 

Link to comment
Share on other sites

@Deltakosh , I'm going to work on a doc page this week. 

Another thing, I ported  energy.js to webAssembly, it works pretty well : file size is half than the asm.js version, performances are 5-10% better in FF or Chrome. Edge (40.15063.0.0) is far behind, (still alpha support of webAssembly ?).

Edit : about Edge, I test the new release in Preview build 16299 , performances are equivalent to ff and chrome.

Asm.js version runs almost equally in the 3 browsers.

Here is 2 perf tests, asm.js and webassembly. Launch the page clic on the scene and press S, You have to wait all red boxes become gray. Its about 21000ms on my i3 for asm.js and 19000ms for webAssembly.

asm.js test   

webAssembly test

Can someone test those demos and confirm webassembly is faster than asm in this particular test ?

 

sam

 

 

Edited by Samuel Girardin
Link to comment
Share on other sites

I only use emscripten to produce asm or wasm. The workflow ia exactly the same. I just have to add a specific flag to the compiler to emit asm or wasm. For the moment webassembly was just a test case. About your link, could be useful for heavy math calculation, but Javascript vm are more and more optimized.. Webaasembly is really useful to port existing c++ library to browsers. @Jerome

 

Link to comment
Share on other sites

actually wasm is more widely supported than asm :

http://caniuse.com/#feat=asmjs

http://caniuse.com/#feat=wasm

As wasm is also standardized, I supposed it's the way to go now (although asm is easier to write by hand directly without any compilation)

[EDIT] and that's the reason why I wish the AssemblyScript project could get reliable and mature soon. It would allow us to translate some parts of the existing TS code (maths, matrix computations, for instance) at almost no cost (just by checking we specify the right types)  directly to WASM.

 

[EDIT 2] just found this site showing some live gain (or not) about image processing with WASM vs JS : https://d2jta7o2zej4pf.cloudfront.net/

 

[EDIT 3] I just discovered that AssemblyScript (ASC) guys are already working on the next version of ASC, called NEXT : https://github.com/AssemblyScript/next

They need to decouple ASC from the current TS compiler to be able to compile the ASC compiler itself directly in WASM instead of in TS. Complex, but makes sense.

Link to comment
Share on other sites

That said, ASM.js is still great, can be written by hand, is legal JS and brings immediate real gain.

Example (open your console) : http://playground.babylonjs.com/#DH683D#2

This PG just sets a big array with a float value (no maths or complex things here). The "normal" time is the JS classical array assignement, the "asm" time is the same done by the asm loop function.

 

 

mmmhh... having an idea to make an asm test with the SPS experiment, not sure this will work

Link to comment
Share on other sites

On 07/10/2017 at 12:58 AM, Deltakosh said:

Huge!!!!!!

We should work on a doc page to reference all your great samples!

@Deltakosh

I ve started that : 

https://github.com/samuelgirardin/Documentation/blob/master/content/extensions/EnergyJS/EnergyJS.md

I m not sure where you want to put it ?

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...