Deltakosh

What's next?

Recommended Posts

On 11/25/2017 at 3:44 PM, adam said:

I think that @Tomm Huth is referring to a non global import like:

import { Scene, ArcRotateCamera, MeshBuilder } from 'babylonjs'

With the current babylonjs structure webpack is unable to tree-shake explicit imports (as indicated at the end of the NPM page) and will take everything.  I don't think that's an unreasonable thing to have on a wish list!  I am honestly super happy with the progress to get the current NPM support, but agree this would be nice to have.  As @Sebavan said the custom builds would work, but are not as convenient.

Share this post


Link to post
Share on other sites

@brianzinn you're totally right. Also I don't understand how plugins could possibly work in a npm workflow, if they all require a global export. 

Building your own version is really only a viable solution as long as you don't use NPM. I did manage to get my own build working, but ended up having to strip out the extra Oimo plugin (500kb extra for no reason if using Cannonjs), and also fixing a problem with the export at the bottom:

(function universalModuleDefinition(root, factory) {
    var f = factory();

    if (root && root["BABYLON"]) {
        return;
    }

    var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
    globalObject["BABYLON"] = f;

    if (typeof exports === 'object' && typeof module === 'object')
        module.exports = f;
    else if (typeof define === 'function' && define.amd)
        define(["BABYLON"], factory);
    else if (typeof exports === 'object')
        exports["BABYLON"] = f;
    else {
        root["BABYLON"] = f;
    }
})(this, function () {
    return BABYLON;
}); 

For some reason Heroku chokes on this, complaining it can't find BABYLON export 

ERROR in ./node_modules/babylonjs/dist/preview release/babylon.max.js
Module not found: Error: Can't resolve 'BABYLON' in '/tmp/build_2f05ec3c0854af6ba703385c4238bd5e/tommhuth-stacky-4c50f39/node_modules/babylonjs/dist/preview release'

This is not a problem for me locally, and Heroku could not find a reason why this should happen. The solution to get this to work was to simply:

module.exports = BABYLON

For a pretty simple game (http://stacky-game.herokuapp.com/) i saved around 3mb unminified by building my own version -- on the web EVERY KB counts. The downside is that I have to manually edit the generated file and commit generated code to my repo :/

There's lots of great stuff in Babylonjs, so there is no reason why it can't also be more in line with a modern JS workflow. :)

Share this post


Link to post
Share on other sites

My wish list is basically the continued improvements for webvr:

(Pardon me if it's already covered in 3.1)

- Controller support for Gear VR, and possibly the upcoming Vive Focus and Oculus Go

- Gaze events, along the line of onGaze{Enter|Leave|Move|Xxx}Observables

- Api for dragging/dropping and rotating object using the controller. (so people don't have to reinvent the wheels on their own)

- Custom controller gltf image and behaviors

Share this post


Link to post
Share on other sites

 

Second the zinnman.... @brianzinn on AR support as a package.

 

1) More AR explorations +1.

      AR-STATUS-UPDATE:

       BABYLON works fine on AR. But caveats: wasm heavy , AR.js needs refactoring to package, and suggestion for ARToolkit is promising for review.

      No cycles here until February for AR. Plugin probably deserves (team) or someone more expert than afalcon.

      -->AR-Board-Games<-- in babylon. Cat out of the bag...woosh! :)!?!

      Very interesting...      

 

2) Interpolation.

       RESEARCH: "time-based-animations  different than frame-based-animations" ~ T. Parisi.

       - And where question pops up. BABYLON has great frame-based-animation on static-type-attributes. .animation(type, f(){keys, frames)...

       QUESTION: does BABYLON have time-based-animation? With dynamic types? Looking, not finding... maybe afalcon missed this?

       Wishing for support of single-line-dynamic-time-based-interpolation syntax like similar 'inbetweening' originally from pixar (not 3):

BABYLON.interpolate.from({x:0}).to({x:10}, time).onFrame(f()).onDone(f()).begin();

       Unique names for BABYLON, but release the "chains" ...

       Instead, Object Configuration Pattern... to rescue, configurable and unique:

BABYLON.interpolate({from:{x:0},to:{x:10),time:1000,onFrame:f(),onDone:f()},ease:'inout').begin();

        Why? --> Ideal for animators making cinematics that queue dynamically off JSON scripts. CONSIDER:

anim = {...
,cam:{cur:{"x":0,"y":8,"z":-28},tgt:{x:0,y:8,z:-20}, tar:{"x":0,"y":6,"z":0}, dur:1000},
...}

      :)  Enables an Animation Factory Pattern... (almost).

 

3) MeshEditing... what???

          Why would anyone ever...? You might think: Mesh-Editing is massive.We have great importers. There are advanced vendors. glTF, etc, etc....

          Ah. Yeah, all true. But wait! It is a total-thrill-ride to edit mesh directly inside of BABYLON at run-time! 

          1) Save to beautiful native arrays of numbers and awesome complex custom components (like @JCPalmer shows). And edit assets after import(!)

          2) Similar to awesome terrain editors,  extended build... to buildings, cities, and all kinds of low-poly-props. e.g. Skateparks. With simplified 3D Pipeline. 

          3) hover-editing concept from @Wingnut and @Arte, promising. And "quad-state-vertex-click-editor" where rgb === xyz,  & drags on axis... till click!

                     Countless questions: Might it extrude?  Select All/Deselect? Drop-In Shapes? Materials ectera...  Trail goes forever. Inspired by :) Wingnut.

           4) "Creative Mode"...  heard it is popular with kids.

          Hover-Editing:

           http://www.html5gamedevs.com/topic/34452-select-mesh-edges-and-vertices-on-mouse-over/?page=2

           Moving stuff around (real-time) in BABYLON:

 

 

4) ~ Plugins:

          With JCP on a bunch of things... including -->keeping size down<--.

          Suggestions above - as plugins. 

           afalcon does not know how to make plugins. Looked into great ones... @Dad72

           Happy to build plugins... not sure where to start.  

 

 <jokes-removed/>

Thank you @Deltakosh. This community is the best.

Share this post


Link to post
Share on other sites

Hello. I think we need a direct dae loader.

The reason is file size, and first loading time on page.

As example:

I have a static dae object around 7mb, export bynary file from 3dsMax around 13mb. :(

With optimize vertices checked on export.

Share this post


Link to post
Share on other sites
On 12/19/2017 at 2:19 PM, MarianG said:

Hello. I think we need a direct dae loader.

The reason is file size, and first loading time on page.

As example:

I have a static dae object around 7mb, export bynary file from 3dsMax around 13mb. :(

With optimize vertices checked on export.

My experience with Collada / DAE going from MakeHuman has not been good with regard to skeletons.  If you implement this, pay attention to skeletons for sure.

Last time I looked at 3dsMax exporter, several years ago (I cannot really read c#), I thought the text version was exporting 8 decimals.  I am only doing 4 decimals for Blender.  This reduces file size greatly, without anyone really able to tell.

This would not directly help a binary, but rounding prior to optimization could yield much better results.  5.78324897 & 5.78324366 both round to 5.7832.  For my implementation of morph targets, I go even further allowing a tolerance after rounding for detecting a vertex change using:

def similar_vertex(vertA, vertB, tolerance = 0.00015):
    if vertA is None or vertB is None: return False

    if (abs(vertA.x - vertB.x) > tolerance or
        abs(vertA.y - vertB.y) > tolerance or
        abs(vertA.z - vertB.z) > tolerance ):
        return False

    return True

This has no effect for BJS morph targets, since a morph target cannot be a sub-mesh.  I have thought about using this for the optimization of initial vertices too, but have postponed until I allow for changing the number of significant digits.  I use decimeters for units in my scenes, but some might use meters.

For Tower of Babel, I use a whole host of additional optimizations.  The simplest is lead zeros are not printed.  leading zeros are about 10% of the entire file. Unfortunately, JSON rules do not allow this so .babylon format cannot use this.

Share this post


Link to post
Share on other sites

My needs are really for avatar handling.  Stuff that you'd use for 3rd-person games.

What I think would be cool to have is

  • root-motion (so root bone of skeleton can permanently move the body)
  • morphing that also includes texture morphing and can read those textures from a texture atlas
  • combining animations (so character can run AND shoot)
  • better animation merging (something looks strange when one animation merges into another)
  • be able to export shape-keys and animation from Blender

Share this post


Link to post
Share on other sites

suggestion : a Scene Manager

something to link scenes, to orchestrate their succession, etc

example : scene1 = menu, scene2 = gameParameters, scene3 = level1, scene4 = level2, scene5 = level end, scene6 = game end, scene7 = introGame, scene8 = introLevel1, scene9 = introLevel2, etc

 How can I define the game graph to link all these scenes, what conditions trigger one or the other start after some given scene, etc 

Share this post


Link to post
Share on other sites

I can do that Jerome,  I was helping Dad out with some stuff and realized I had all the structure put together for it to do what you are asking.

I would need some help converting it to TS though.

Share this post


Link to post
Share on other sites
13 hours ago, Deltakosh said:

"Better animation merging (something looks strange when one animation merges into another)": Can you repro this one?

Actually I have this exact same problem as this one

When my avatar is flying and transitions from horizontal to vertical the body gets warped during the blend.

Share this post


Link to post
Share on other sites

Scene Animations,

       A good pattern to use is: array of configuration objects with action-callbacks.

Action-Callback Pattern:

script = [ {},{},{},{},{ $act: action type, action:function(){}, ext...  },{} ];

scene = script[4].action();

Good to go.

~

Share this post


Link to post
Share on other sites

@aFalcon, yeah should not be to hard to script up a system like that.

I would have the callbacks wrapped in an object that you can have a complete variable stored on, then have a "action" stack or a array that checks the first element in the array if its not been fired, mark it as fired and then run it, then after the function is done have it set the parents variable of done so the action stack knows and then splice that action out and proceed to the next one.

Share this post


Link to post
Share on other sites

Hi!

I now know that you can freeze dynamic shadows with this setup.

shadowGenerator.getShadowMap().refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE;


However, there are still a few movable objects in my scene, can you add a similar one in the future, such as mesh. ShadowRefreshRate=60 setting, to set the shadow matrix calculation of some mesh.

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.