Weekly Video: Introducing the Mystery Demo Tutorial Series

https://playground.babylonjs.com/#JEI1D9#5 Another playground… various wingy tweaks/mods, commented. We can talk about it, but PM me or start a thread somewhere. I am trying to reduce my yapping within the Announcements sub-forum. It’s really not intended for in-depth PG whackin’/talkin’.

634 console.log outputs in that PG… per run. Where do THEY come from? console.clear() at scene.isReady doesn’t wipe… cuz the ‘dump’ happens late… via a Promise or something.

No more 125 kb of NME code in playground. Yay. (see wingy’s earlier-in-thread playgrounds, when he was in a hurry to get NME code into working playgrounds). Now it’s easier…

BABYLON.NodeMaterial.ParseFromSnippetAsync("QHB2ME#4", scene).then...

How cool is THAT? NME-code drinking straw… slurpin’-up the slushy goodness. :slight_smile: Nice.

Thx PJC, thx Thom, thx to everyone involved.

1 Like

So frustrating, I haven’t take the time to go further than the first tut for now, so I have to prevent myself clicking on new videos or reading this thread to not break the mystery :zipper_mouth_face:

3 Likes

I just want to take this time to appreciate all the good works put into babylon.js, we love you!!

4 Likes

Thanks you @waverider404, @Wingnut and @SpikeSpiegel for your kind words for the team and PirateJC!!! @Vinc3r: we are trying to limit the spoiling at the maximum :smiley:

The pace is accelerating (OMG tomorrow we’ll be 7 days away from the 4.1 release :hugs:) and we are today releasing the part 7 of the Mystery Demo Tutorial Series! In this video we continue to build on the work from previous videos, and unravel the FEELING of the demo!

Pick up where we left off in part 6:
https://playground.babylonjs.com/#JEI1D9

Check out the other videos in this series:
Part 1: https://youtu.be/JqMxTZ2q4Nw
Part 2: https://youtu.be/ffUUq_3TCFk
Part 3: https://youtu.be/CKgswRix_Wk
Part 4: https://youtu.be/ko0DrgTrH3Q
Part 5: https://youtu.be/ZkYOtKYU5bI
Part 6: https://youtu.be/TJBk3G4mMMo

Sprite Texture used in this video: https://raw.githubusercontent.com/PatrickRyanMS/BabylonJStextures/master/Demos/underwater/assets/volumetricLight.png

The final state from this video:
https://playground.babylonjs.com/#JEI1D9#1

7 Likes

Hey All! I’m back from doing “field research” :rofl:

Huge thanks to @thomlucc for keeping the video content flowing!

The end is in sight folks! Part 8 is here and you get your first glimpse of final assets for the demo!

Pick up where we left off in part 7:
https://playground.babylonjs.com/#JEI1D9#1

Ground asset link: https://raw.githubusercontent.com/PirateJC/assets/master/underWaterDemo/ground/

Textures:


The final state from this video:
https://playground.babylonjs.com/#JEI1D9#2

Fantastic Lighting Tutorials with NME:


3 Likes

Great video, as usual!

It seems there’s a caching problem with the PG of this video.

Sometimes when I click on the link I get this:

Note how the text is all black and is not colored according to javascript syntax.

The end of this code is:

    BABYLON.SceneLoader.ImportMesh("", "https://raw.githubusercontent.com/PirateJC/assets/master/underWaterDemo/ground/", "underwaterGround.glb", scene, function(newMeshes){
        newMeshes[0].name = "underWaterGround";
        var childMeshes = newMeshes[0].getChildMeshes(false);
        for (var i = 0; i {
            nodeMaterial.name = "groundMaterial";
            scene.getMeshByName("ground").material = nodeMaterial;    
        })
    });

which does not match the code in the video.

Some other times, clicking the link is ok and I do have the right code, with color formatting.

1 Like

We think this is actually a caching problem with the playground all-up, not isolated to this particular playground. I’ve been running into this same issue on other playgrounds as well today and it seems like clearing your cache on a playground, then restarting the browser seems to work? Or at least it seems to have worked for me.

At first I thought it did fix the problem, but after clicking something like 15/20 times on the link, I finally got the wrong file!

Uh oh! That’s not good! Sounds like maybe a bug?

Let’s ping the master to see what he thinks.

Pinging @Deltakosh

I clicked the link a single time and it just happened again.

For the record and in case it may help, here’s the full code that is displayed in black:

var createScene = function () {

    // This creates a basic Babylon Scene object (non-mesh)
    var scene = new BABYLON.Scene(engine);

    scene.debugLayer.show({
        embedMode:true
    });

    var backgroundCube = new BABYLON.MeshBuilder.CreateBox("backgroundCube", {
        size:60,
        sideOrientation:2
    }, scene);

    scene.fogMode = BABYLON.Scene.FOGMODE_LINEAR;
    scene.fogStart = 5;
    scene.fogEnd = 25;
    scene.fogColor = new BABYLON.Color3(0.1, 0.08, 0.25);
    scene.fogDensity = 0.1;

    var mainCamera = new BABYLON.ArcRotateCamera("mainCamera", BABYLON.Tools.ToRadians(100), BABYLON.Tools.ToRadians(85), 10, new BABYLON.Vector3(-0.25, 1, 0), scene);
    mainCamera.layerMask = 1;

    // This attaches the camera to the canvas
    mainCamera.attachControl(canvas, true);

    var textureCamera = new BABYLON.ArcRotateCamera("textureCamera", 0, 0, 190, BABYLON.Vector3.Zero(), scene);
    textureCamera.layerMask = 2;
    textureCamera.mode = 1;
    textureCamera.orthoBottom = -7;
    textureCamera.orthoLeft = -7;
    textureCamera.orthoRight = 7;
    textureCamera.orthoTop = 7;

    var waterPlane = new BABYLON.Mesh.CreateGround("waterPlane", 15, 15, 400);
    waterPlane.layerMask = 2;

    var waterShader = BABYLON.NodeMaterial.ParseFromSnippetAsync("7X2PUH", scene).then(nodeMaterial => {
        nodeMaterial.name = "causticMaterial";
        waterPlane.material = nodeMaterial;
    });

    var volumetricEmitter = new BABYLON.AbstractMesh("volumetricEmitter", scene);
    var numberCells;

    var setupAnimationSheet = function(system, texture, width, height, numSpritesWidth, numSpritesHeight, animationSpeed, isRandom){
        system.isAnimationSheetEnabled = true;
        system.particleTexture = new BABYLON.Texture(texture, scene, false, false, BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
        system.particleTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
        system.particleTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
        system.spriteCellWidth = width / numSpritesWidth;
        system.spriteCellHeight = height / numSpritesHeight;
        numberCells = numSpritesWidth * numSpritesHeight;
        system.startSpriteCellID = 0;
        system.endSpriteCellID = numberCells - 1;
        system.spriteCellChangeSpeed = animationSpeed;
        system.spriteRandomStartCell = isRandom;
        system.updateSpeed = 1/30;
    };

    var volumetricSystem = new BABYLON.ParticleSystem("volumetricSystem", 100, scene, null, true);
    setupAnimationSheet(volumetricSystem, "https://raw.githubusercontent.com/PatrickRyanMS/BabylonJStextures/master/Demos/underwater/assets/volumetricLight.png", 1024, 1024, 4, 1, 0, true);
    volumetricSystem.emitter = volumetricEmitter.position;
    var boxEmitter = volumetricSystem.createBoxEmitter(new BABYLON.Vector3(-1,0,0), new BABYLON.Vector3(1,0,0), new BABYLON.Vector3(-5, 5, -3), new BABYLON.Vector3(5,5,3));
    boxEmitter.radiusRange = 0;
    volumetricSystem.minInitialRotation = 0;
    volumetricSystem.maxInitialRotation = 0;
    volumetricSystem.minScaleX = 6;
    volumetricSystem.maxScaleX = 10;
    volumetricSystem.minScaleY = 30;
    volumetricSystem.maxScaleY = 50;
    volumetricSystem.minLifeTime = 6;
    volumetricSystem.maxLifeTime = 9;
    volumetricSystem.emitRate = 15;
    volumetricSystem.minEmitPower = 0.05;
    volumetricSystem.maxEmitPower = 0.1;
    volumetricSystem.minSize = 0.1;
    volumetricSystem.maxSize = 0.2;
    volumetricSystem.addColorGradient(0, new BABYLON.Color4(0,0,0,0));
    volumetricSystem.addColorGradient(0.5, new BABYLON.Color4(0.25, 0.25, 0.3, 0.2));
    volumetricSystem.addColorGradient(1, new BABYLON.Color4(0,0,0,0));
    volumetricSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ADD;
    volumetricSystem.start();


    var renderTarget = new BABYLON.RenderTargetTexture("RTT", 1024, scene);
    renderTarget.activeCamera = textureCamera;
    scene.customRenderTargets.push(renderTarget);
    renderTarget.renderList.push(waterPlane);

    var light = new BABYLON.SpotLight("spotLight", new BABYLON.Vector3(0, 30, 0), BABYLON.Vector3.Down(), BABYLON.Tools.ToRadians(50), 8, scene);
    light.intensity = 1;
    light.projectionTexture = renderTarget;

    var blurAmount = 70;
    var standardPipeline = new BABYLON.PostProcessRenderPipeline(engine, "standardPipeline");
    var horizontalBlur = new BABYLON.BlurPostProcess("horizontalBlur", new BABYLON.Vector2(1, 0), blurAmount, 1, null, null, engine, false);
    var verticalBlur = new BABYLON.BlurPostProcess("verticalBlur", new BABYLON.Vector2(0, 1), blurAmount, 1, null, null, engine, false);
    var blackAndWhiteThenBlur = new BABYLON.PostProcessRenderEffect(engine, "blackAndWhiteThenBlur", function(){return [horizontalBlur, verticalBlur]});
    standardPipeline.addEffect(blackAndWhiteThenBlur);
    scene.postProcessRenderPipelineManager.addPipeline(standardPipeline);
    scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline("standardPipeline", textureCamera);

    BABYLON.SceneLoader.ImportMesh("", "https://raw.githubusercontent.com/PirateJC/assets/master/underWaterDemo/ground/", "underwaterGround.glb", scene, function(newMeshes){
        newMeshes[0].name = "underWaterGround";
        var childMeshes = newMeshes[0].getChildMeshes(false);
        for (var i = 0; i {
            nodeMaterial.name = "groundMaterial";
            scene.getMeshByName("ground").material = nodeMaterial;    
        })
    });














    return scene;

};

[EDIT]
I also reproduce the problem by hitting F5 several times when the source code is ok: after a number of times, I have the wrong code.
[/EDIT]

Adding @RaananW as I think it is related to CDN changes

Is there a console error? it seems like the editor doesnt starts

No, no error in the console. It also happened quite a few times with others PG. Hitting F5 corrects the problem.

when that happen - could you please share the console output and your network tab?

I just can’t seem to reproduce that, but I want to understand the cause.

I saw it several times today so we definitely have an issue :slight_smile:

I have it F5 until I got the problem with this link: https://playground.babylonjs.com/#JEI1D9#2

Text content of the PG:

var createScene = function () {

    // This creates a basic Babylon Scene object (non-mesh)
    var scene = new BABYLON.Scene(engine);

    scene.debugLayer.show({
        embedMode:true
    });

    var backgroundCube = new BABYLON.MeshBuilder.CreateBox("backgroundCube", {
        size:60,
        sideOrientation:2
    }, scene);

    scene.fogMode = BABYLON.Scene.FOGMODE_LINEAR;
    scene.fogStart = 5;
    scene.fogEnd = 25;
    scene.fogColor = new BABYLON.Color3(0.1, 0.08, 0.25);
    scene.fogDensity = 0.1;

    var mainCamera = new BABYLON.ArcRotateCamera("mainCamera", BABYLON.Tools.ToRadians(100), BABYLON.Tools.ToRadians(85), 10, new BABYLON.Vector3(-0.25, 1, 0), scene);
    mainCamera.layerMask = 1;

    // This attaches the camera to the canvas
    mainCamera.attachControl(canvas, true);

    var textureCamera = new BABYLON.ArcRotateCamera("textureCamera", 0, 0, 190, BABYLON.Vector3.Zero(), scene);
    textureCamera.layerMask = 2;
    textureCamera.mode = 1;
    textureCamera.orthoBottom = -7;
    textureCamera.orthoLeft = -7;
    textureCamera.orthoRight = 7;
    textureCamera.orthoTop = 7;

    var waterPlane = new BABYLON.Mesh.CreateGround("waterPlane", 15, 15, 400);
    waterPlane.layerMask = 2;

    var waterShader = BABYLON.NodeMaterial.ParseFromSnippetAsync("7X2PUH", scene).then(nodeMaterial => {
        nodeMaterial.name = "causticMaterial";
        waterPlane.material = nodeMaterial;
    });

    var volumetricEmitter = new BABYLON.AbstractMesh("volumetricEmitter", scene);
    var numberCells;

    var setupAnimationSheet = function(system, texture, width, height, numSpritesWidth, numSpritesHeight, animationSpeed, isRandom){
        system.isAnimationSheetEnabled = true;
        system.particleTexture = new BABYLON.Texture(texture, scene, false, false, BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
        system.particleTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
        system.particleTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
        system.spriteCellWidth = width / numSpritesWidth;
        system.spriteCellHeight = height / numSpritesHeight;
        numberCells = numSpritesWidth * numSpritesHeight;
        system.startSpriteCellID = 0;
        system.endSpriteCellID = numberCells - 1;
        system.spriteCellChangeSpeed = animationSpeed;
        system.spriteRandomStartCell = isRandom;
        system.updateSpeed = 1/30;
    };

    var volumetricSystem = new BABYLON.ParticleSystem("volumetricSystem", 100, scene, null, true);
    setupAnimationSheet(volumetricSystem, "https://raw.githubusercontent.com/PatrickRyanMS/BabylonJStextures/master/Demos/underwater/assets/volumetricLight.png", 1024, 1024, 4, 1, 0, true);
    volumetricSystem.emitter = volumetricEmitter.position;
    var boxEmitter = volumetricSystem.createBoxEmitter(new BABYLON.Vector3(-1,0,0), new BABYLON.Vector3(1,0,0), new BABYLON.Vector3(-5, 5, -3), new BABYLON.Vector3(5,5,3));
    boxEmitter.radiusRange = 0;
    volumetricSystem.minInitialRotation = 0;
    volumetricSystem.maxInitialRotation = 0;
    volumetricSystem.minScaleX = 6;
    volumetricSystem.maxScaleX = 10;
    volumetricSystem.minScaleY = 30;
    volumetricSystem.maxScaleY = 50;
    volumetricSystem.minLifeTime = 6;
    volumetricSystem.maxLifeTime = 9;
    volumetricSystem.emitRate = 15;
    volumetricSystem.minEmitPower = 0.05;
    volumetricSystem.maxEmitPower = 0.1;
    volumetricSystem.minSize = 0.1;
    volumetricSystem.maxSize = 0.2;
    volumetricSystem.addColorGradient(0, new BABYLON.Color4(0,0,0,0));
    volumetricSystem.addColorGradient(0.5, new BABYLON.Color4(0.25, 0.25, 0.3, 0.2));
    volumetricSystem.addColorGradient(1, new BABYLON.Color4(0,0,0,0));
    volumetricSystem.blendMode = BABYLON.ParticleSystem.BLENDMODE_ADD;
    volumetricSystem.start();


    var renderTarget = new BABYLON.RenderTargetTexture("RTT", 1024, scene);
    renderTarget.activeCamera = textureCamera;
    scene.customRenderTargets.push(renderTarget);
    renderTarget.renderList.push(waterPlane);

    var light = new BABYLON.SpotLight("spotLight", new BABYLON.Vector3(0, 30, 0), BABYLON.Vector3.Down(), BABYLON.Tools.ToRadians(50), 8, scene);
    light.intensity = 1;
    light.projectionTexture = renderTarget;

    var blurAmount = 70;
    var standardPipeline = new BABYLON.PostProcessRenderPipeline(engine, "standardPipeline");
    var horizontalBlur = new BABYLON.BlurPostProcess("horizontalBlur", new BABYLON.Vector2(1, 0), blurAmount, 1, null, null, engine, false);
    var verticalBlur = new BABYLON.BlurPostProcess("verticalBlur", new BABYLON.Vector2(0, 1), blurAmount, 1, null, null, engine, false);
    var blackAndWhiteThenBlur = new BABYLON.PostProcessRenderEffect(engine, "blackAndWhiteThenBlur", function(){return [horizontalBlur, verticalBlur]});
    standardPipeline.addEffect(blackAndWhiteThenBlur);
    scene.postProcessRenderPipelineManager.addPipeline(standardPipeline);
    scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline("standardPipeline", textureCamera);

    BABYLON.SceneLoader.ImportMesh("", "https://raw.githubusercontent.com/PirateJC/assets/master/underWaterDemo/ground/", "underwaterGround.glb", scene, function(newMeshes){
        newMeshes[0].name = "underWaterGround";
        var childMeshes = newMeshes[0].getChildMeshes(false);
        for (var i = 0; i {
            nodeMaterial.name = "groundMaterial";
            scene.getMeshByName("ground").material = nodeMaterial;    
        })
    });














    return scene;

};
Filter
Please select an entity in the scene explorer.
Forum Sandbox Documentation Search

=> I have done CTRL+A to select everything, then I have pasted here. Note that I got the 3 last lines you can see above by doing this, but those lines were not visible in the PG editor.

Chrome Console content: https://popov72.github.io/BabylonDev/temp/playground.babylonjs.com-1582581450108.log

=> last line is truncated because there were too many lines. This was displayed at the end: “Show more (69.7 KB) Copy”.

Chrome Network tab content: Babylon.js Playground

thanks, will check and fix it :slight_smile:

I just start video part 2, and it seems the nme link in the description isn’t exactly the same as in the tut’:

[edit: erf, I think I get it, default model is Cube instead of Plane, 'could be an enhancement of the nme to save assigned model. However, waves aren’t exactly the same when switching to Plane:

edit2: actually it’s just the wind direction which is [1,0] on the nme link but [.5,.5] and the tutorial

1 Like

Oof sorry about that. Good catch!

The Final Piece is here!!! Part 9!!!

I can’t believe it’s here. We’ve officially reached the end of the Mystery Demo Tutorial Series! Together, we get to find out what the mystery actually is…what we’ve been building together this entire time.I am SOOOO excited!

I want to take a quick moment to say thanks! This has been a BIG undertaking and the encouragement along the way has been simply overwhelming. Thanks to each of you who have suffered through my attempts at creating something educational and entertaining. I sincerely hope this has brought you some degree of joy, help, laughter, or inspiration. Above all though, I hope this series gets you even more pumped about this amazing tool that we all get to create together!

My most genuine gratitude to all!

-Your loving swasbuckler,
PirateJC

7 Likes