~ aFalcon: Deep~Dives

@Necips what kind of helmet is your avatar?

Hi @aFalcon, I’m impressed with your dedication and energy.

In case it may come in handy, here is another possible Fibonacci method you could try:

const fibonacci = (n: number): number => {
  const term1 = Math.sqrt(5)
  const term2 = ((1 + term1) * 0.5) ** n
  const term3 = ((1 - term1) * 0.5) ** n

  return (term2 - term3) / term1
}

Would an implementation of a Kochanek-Bartels spline help solve your crumpled extrusions, or was that fixed?

1 Like

Yes, Crumpled Extrusions was solved!

It was an awesome problem… and the research was valuable.

The primary solution was to spread out the points. Easy.

They were too close and that caused the crumple!

The creation algorithm placed them too close.

One of the good surprises (above) was for a “low-pass-filter” to smooth the angles.

A generic Low-Pass-Filter is very useful!

to your suggestions:

“Kochanek-Bartels” spline… looking…

and Math.sqrt(5) !!! That looks awesome!

I like that Fib algorithm. I’d have to step-debug it. term2 and term3 look interesting. : )

Fibonacci was also solved. BUT ended up not using it (again - just want to use fib one time!).

Because it turned out that the ideal curve for a halfpipe curving into space was technically-feasible - but not FUN! Imagine that! Because of the uniformity.

So we went with CorkScrew! lol… Much more fun.

AND to get the perfect curve. We COMBINED THE TWO SOLUTIONS above.

A POINT EDITOR… with smoothed curves.

Nice to meet you allen-woods. : )

UPDATE: the space-half-pipe is surfing perfectly!

For comparison, here is the “FIB Factory” I arrived at…

function fibFactory(fib){ //EXAMPLE: fibFactory({lastNum,thisNum})//1,2,3,5,8
    var nextFib = fib.lastFib + fib.thisFib + fib.curveNoise;
    return {thisFib:nextFib,lastFib:fib.thisFib,curveNoise:fib.curveNoise,fibLength:fib.fibLength};
} 

The ‘curveNoise’ … scales the FIB. And it uses Factory Pattern.

I like. Thought about it for a while.

Do these number oddities show up as examples in nature or other places?

For example:

image

These are just straight rays. But there is a repeating pattern of “arcs over lines”.

The arcs should not be there. But I’ve seen them in other places.

They are a nice looking effect and so I wonder what they are.

And I wonder if anyone knows at all.

The most surprising was in a screenshot, of BJS work, but not the original screen rendering… only in the screenshot was the pattern enhanced. That is what got me wondering about “arcs over lines”.

It looks like these:

and

image

Wondering if these “arcs on straight lines” have a name. If the effect is known.

And if they visualize math patterns like @Necips describes.

It would be cool to visualize Math PATTERN oddities in BABYLON - to see how they exist in 3D.

1 Like

@Necips just noticed the images above, the pattern implies, two infinities.
Unspecified smallness and unspecified largeness.
With fibonacci … @jerome remarked (pretty sure) …

“the problem with using fibonacci in babylon is that it scales up so darn fast”

loose quote. Apologies if it was someone else.

Central Point: is this a visualization of that?

lol…

back to wurk.

Current Status: avoiding the “has all the assets loaded yet, and ready to render?” problem.

solved using promise with callbacks checking off a manifest. But… idk.


FIB-FACTORY STATUS:

Someday hope to use FIB-FACTORY somewhere, anywhere - but it does go from small to super big really quick. So having small bits in a range was best. AND why the curveNoise.

Dont need that very often. Accept in building worlds.

The Sunflower Solution: was to spiral and then reverse the curve. For interesting intersections.

Also want to try SphereClouds.

Surprisingly - it made a tornado! Didnt expect that.

Who wouldn’t want - the free time - to build a great 3D tornado?

Saw a really good 3D tornado vid somewhere… included tornado physics… that would pull any mesh in at the bottom and shoot them out the top! :grin:

L8r

The only log aFalcon gets to use is console.log

From now on: for every console.log( ); Math.log(something)!

But yeah… log could be useful for tornado shooting objects out… thanks!

You talking is like deciphering a encrypted codex.

I love it

1 Like

PROBLEM:

When are all the Dynamic Assets Loaded? And scene Ready to Render?

SOLUTION:

Master Manifest - Dynamic Asset Loading System - (pub/sub)

/********************-MASTER-MANIFEST-*****************\
PURPOSE: when are all the assets loaded? Dynamically at runtime-.
DESIGN: pub/sub callback resolves modular asset loading-. 
NOTE: The last item finishes/resets load by calling back the array of callbacks.
CONTEXT: Promise modules each containing BABYLON.SceneLoaders and AssetManager's
EXAMPLE USE in asset modules:
   getMasterManifest(function(){ module.init(); });//get await spot in line on manifest to loading-count.
   setMasterManifest(); //after assetLoad, signal asset arrived-.
EXTEND: initEpisode() override to point to each dynamically loaded episode init-. 
\*****************************************************************************************************************/
manifestIDX = 0;
readyRender = [];
getMasterManifest = function(readyFn){ readyRender.push(readyFn); } //get await spot in line on manifest to load-count.
setMasterManifest = function(){ //set await arrival from loaded asset
    manifestIDX++;
    if(manifestIDX===readyRender.length){ //all packages arrive-. Load at episode and reset-.
        for(var i=0; i < readyRender.length; i++){  readyRender[i](); } //callback-.
        initEpisode();
        readyRender = [];
        manifestIDX = 0; //reset-ready-renderer-.
    }
}

//The module loading PROMISE using ES6 Dynamic file loader (experimental)
    Promise.all([
        load.js('../../lib/babylon/babylon.3.0.2-alpha.max.js'), /*working bjs from sps scene 8 */
        load.js('../../lib/babylon/hand.min-1.2.js') ,
        load.css('../../lib/font-awesome/font-awesome-4.7.0/css/font-awesome.min.css')
      ]).then(function() {
        load.js('../../lib/babylon/materials/babylon.gridMaterial.min.js')
        //load.js('./nx/templateModule1.js') 
        load.js('./nx/modSmartCamz.js') 
       //...
     });

//Each module subscribes with Master-Manifest, notifies on asset complete. 
//Until count is reached, which is the same as the length of subscribers-.

We’ve been working diligently on BABYLON.EPISODE. Because we are making BABYLON.MOVIE, as many of you know, and we encourage you to try the same. Because it works very well. To that goal, the Master-Manifest component is a key concept. You probably encounter a similar “chicken-or-egg” problem. When are all the assets loaded? What if we dynamically load many scenes? To that problem, this was how we solved it. Hope it helps someone with dynamic asset loading and making movies (cinematics) in BABYLON.

NO :heart: because no reads - or because no thinks it possible…? :grin:

UPDATE: huge lazy-loading-module benefit…

getMasterManifest(function readyRender (){ //Ready-Renderer-.
    createMasterPipeEditor();              //load pipe-.
});                                       //schedule in manifest for ready callback-.
setMasterManifest();                      //signal success and await-.

That code says: load module, let manifest know it is here, wait for all other modules, when everything is ready go, render the space-half-pipe-. :eagle:

Thank you for likes @Wingnut. Because of you there are a few “chronicles”. :sunny:

someday more…

1 Like

The real challenge is bringing something NEW.

To be original we have to adapt.


Discouragement of new, exists at every angle, but that doesn’t make it right.
And just because the wurld has no reply, doesn’t mean we should give up. We should try.

If nothing else the goal is to help others up.


Narnia - had nothing to do with collaborative mentorship.

What we can admire… was the adaptation.

This wurld needs it. Needs someone to choose that. For the good of all people.

If the use of a word is stealing - you stole - every - word ever. That is not right.


For every one you help to learn BABYLON. Thanks.

That is not what I want to focus on.

Deep~Dives is for technical exploration - and LEARNING BABYLON.

Next up: FINISHED HALF-PIPE (with rail slides).

CURRENT STATUS - optimizing lasers.

Honestly I wanted to talk to you about something here falcon, you should message me when you have some free time.

1 Like

BABYLON.LASERS!

Wrestling with a OPTIMIZATION QUESTION on LinesMesh

Too complicated to PG (atm, sorry). with jQuery, v3.2, dynamic-modules, namespace

and lazy-loading behaviors, frozen in 2yrs of code, etc.

Working example.

But OPTIMIZATION attempt is to NOT call LinesMesh.dispose()

  • re-draw LinesMesh in new position (easy part) (last parameter instance)

  • getting previous line path and sending to a new position… (hard part) (dynamic moving TGTs)

  • attempted twice, stopped before, revision attempt gets undefined in the pathArray,

  • that comes back from getVerticesData(BABYLON.VertexBuffer.PositionKind)), on subsequent iterations only…

  • would like to avoid having to convert back to Vector3 in anmLoop

  • if someone has optimization tip, for drawing many lines in rapid succession, cool… (LineSystem?)

  • but I think I just realized what I was doing wrong (late night)…

oh that’s it!

I’ll clean and post the solution: “TRACKING-LASER”.

SOLUTION: BABYLON.TRACKING-LASER:
image

60FPS. 1 line fix.

  • Re-descovered that the replacement approach… needs to call dispose anyway?

  • I must mis-understand the last instance parameter.

  • But LineMesh replacement draw wasn’t the solution anyway…


  1. SIMPLE~LOOP~DAMPER:
if(++scanDamperAlpha%2===0||scanDamperAlpha%3===0||scanDamperAlpha%5===0||scanDamperAlpha%7===0){return}
  • Exit on an alpha to slow it down. Nice random noise. Determined by modulus. Result: multi-purpose Loop~Damper.

  • Double-Win: Damper, optimized performance, AND resulted in desirable separation effect of a red and blue laser.


  1. “Twinkling” red and blue laser settings:
            nx.rayLines1[0].alpha = 0.6            
            nx.rayLines1[1].alpha = 0.3    //blue twinkle effect, 0.4 is too much.
            nx.rayLines1[2].alpha = 0.3    //fade-out-.        

            rayLines1[0].color.r = 1
            rayLines1[0].color.g = rayLines1[0].color.b = 0
            rayLines1[1].color.b = 1     //blue laser 
            rayLines1[1].color.g = rayLines1[1].color.r = 0
            rayLines1[2].color.r = 1;    //spotted red laser
            rayLines1[2].color.g = rayLines1[2].color.b = 0;       
  • UX-NOTE: green laser not good, blue laser made eyes dizzy. gr8 purple. 0.3 just right.

  1. TERNARY-ITERATORS-.
  • Second optimization (in prior post), was to realize it only needed to reset 1 Line per Loop (not 3).

  • Which inspired a tiny one-liner: TERNARY-TRIAD-ITERATOR-.

scanTgtAlpha = (++scanTgtAlpha>2)?0:scanTgtAlpha; //triad-iterator: 0,1,2;

//USAGE:
    disposeRay = rayLines1[scanTgtAlpha]; //0,1,2... wish for way to remove the disposeRay var.
    rayLines1[scanTgtAlpha] = BABYLON.Mesh.CreateLines("dynoray", [global_position_origin, 
    laserTgtSphere.position], scene, rayLines1[scanTgtAlpha]);
    disposeRay.dispose();

All in all, the FPS is back with nice effect. Also did not have to use arrayPath, etc. STILL OPEN to TIPS on DIFFERNT APPROACH. But way behind schedule. Can’t use. Gotta run. Ping me if you want unothodox laser tracking code…

Next up: Space~Half~Pipe scales up…

image

How to build SPACE~HALF~PIPE-.

Decrumpler…

var spliceSpacePipe = function(arrayPath, num){  //loop arrayPath reduce points on modulus-.
    var product = [];
    for(var i=0; i<arrayPath.length; i++){
        if(i && i%num===0){continue;}
        else{ product.push(arrayPath[i]) }
    }
    return product;
}
spacepipe7 = spliceSpacePipe(spacepipe6,2);

UPDATE: used polyrubber to build a spaceplatform…

Lasers - creating and disposing is too heavy.

Will try LineSystem of hidden lines with sequential show and hide.

2 Likes

UPDATE: aFalcon makes short movie in babylon.

Do they need to bounce? Are you pre calculating the path? If you have precaulated Paths EZPZ, but if you are trying to do it with raycasting and bounces you might be limited on how many you can spawn at once.

1 Like

Here is the function for laserScanANM:

nx.botz.laserScanAnm = function(config){
    var scanDamperAlpha = 0
    var curScan, tgtScan;
    curScan = (config.mesh.scanDirToggle)? 
    config.mesh.laserBumperLft.position:config.mesh.laserBumperRgt.position;
    tgtScan = (config.mesh.scanDirToggle)? 
    config.mesh.laserBumperRgt.position:config.mesh.laserBumperLft.position;
    config.mesh.scanTgtAlpha = 0;
    config.mesh.disposeRay = null;
    $({x:curScan.x,y:curScan.y,z:curScan.z}) //-----------LASER-SCAN-SWEEP-ANM-.
    .animate({x:tgtScan.x,y:tgtScan.y,z:tgtScan.z},{queue:false,duration:2000,easing:'swing',
    step: function(now) {          
if(++scanDamperAlpha%2===0||scanDamperAlpha%3===0||scanDamperAlpha%5===0||scanDamperAlpha%7===0){return}
            config.mesh.laserTgtSphere.position.x = this.x;
            config.mesh.laserTgtSphere.position.y = this.y; 
            config.mesh.laserTgtSphere.position.z = this.z;
            //LOCAL_POSITION to WORLD_POSITION
            config.mesh.computeWorldMatrix();
            nx.botz.anmMatrix1 = config.mesh.getWorldMatrix();
BABYLON.Vector3.TransformCoordinates(config.mesh.laserTgtSphere.position, nx.botz.anmMatrix1);             nx.botz.global_position_tgt = BABYLON.Vector3.TransformCoordinates(config.mesh.laserTgtSphere.position, nx.botz.anmMatrix1);             BABYLON.Vector3.TransformCoordinates(config.mesh.laserTgtSphere.position, matrix);             config.mesh.laserTgtSphere.position.copyFrom(nx.botz.global_position_tgt);
            nx.botz.global_position_origin = BABYLON.Vector3.TransformCoordinates(config.mesh.laserOriginSphere.position, nx.botz.anmMatrix1); 
           if(config.mesh.rayLines.length!=3){ //INIT-
               //LOCAL_POSITION to WORLD_POSITION
                config.mesh.computeWorldMatrix();
                nx.botz.anmMatrix1 = config.mesh.getWorldMatrix();
                nx.botz.global_position_origin = BABYLON.Vector3.TransformCoordinates(config.mesh.laserOriginSphere.position, nx.botz.anmMatrix1); 
                config.mesh.rayLines= [];
                config.mesh.rayLines[0] = BABYLON.Mesh.CreateLines("ray1", [nx.botz.global_position_origin, config.mesh.laserTgtSphere.position], nx.scene, config.mesh.rayLines[0]);
                config.mesh.rayLines[0].alpha = 0.8;//Math.cos(alpha2);//0.8
                config.mesh.rayLines[1] = BABYLON.Mesh.CreateLines("ray2", [nx.botz.global_position_origin, config.mesh.laserTgtSphere.position], nx.scene, config.mesh.rayLines[1]);
                config.mesh.rayLines[1].alpha = 0.8;//Math.cos(alpha2);//0.8
                config.mesh.rayLines[2] = BABYLON.Mesh.CreateLines("ray3", [nx.botz.global_position_origin, config.mesh.laserTgtSphere.position], nx.scene, config.mesh.rayLines[2]);
                config.mesh.rayLines[2].alpha = 0.8;//Math.cos(alpha2);//0.8
            }else{ //REPLACEMENT-POS.
                //FOR EACH ALPHA - PLACE AT A NEW POINT-.
                config.mesh.disposeRay = config.mesh.rayLines[config.mesh.scanTgtAlpha]; 
                config.mesh.rayLines[config.mesh.scanTgtAlpha] = BABYLON.Mesh.CreateLines("dynoray", [nx.botz.global_position_origin, config.mesh.laserTgtSphere.position], nx.scene, config.mesh.rayLines[config.mesh.scanTgtAlpha]);
                config.mesh.disposeRay.dispose();
                config.mesh.rayLines[config.mesh.scanTgtAlpha]);
            }
            config.mesh.scanTgtAlpha = (++config.mesh.scanTgtAlpha>2)?0:config.mesh.scanTgtAlpha; //TERNARY-TRIAD-ITERATOR-.
            config.mesh.rayLines[0].alpha = 0.6            
            config.mesh.rayLines[1].alpha = 0.3    //fade-out-.        
            config.mesh.rayLines[2].alpha = 0.3    //fade-out-.        
            config.mesh.rayLines[0].color.r = 1;//Math.cos(alpha1);//1;
            config.mesh.rayLines[0].color.g = config.mesh.rayLines[0].color.b = 0
            config.mesh.rayLines[1].color.b = 1;//Math.cos(alpha1);//1;
            config.mesh.rayLines[1].color.g = config.mesh.rayLines[1].color.r = 0
            config.mesh.rayLines[2].color.r = 1;//Math.cos(alpha1);//1;
            config.mesh.rayLines[2].color.g = config.mesh.rayLines[2].color.b = 0;        //spotted red laser
            if (nx.orbyMesh && config.mesh.rayLines[0].intersectsMesh(nx.orbyMesh)) {                        //intersection
                config.mesh.targeting = 1;
                config.mesh.searching = 0;
                $(this).stop(true);
            }
        }, complete:function(){ //  BOUNCE-.
            config.mesh.scanDirToggle = !config.mesh.scanDirToggle;
            config.mesh.searching=1; return; 
        } //NEXT-SUB-SEQUENCE-. 
    });
}

Three lines drawn in a loop. R,B,R.
Animated between two invisible points.
Parented to Origin Rig.
Interpolation.
with frameDamper optimization.