如何将 "Projection Camera Mapping" 视频模拟到多个 BabylonJS 网格上?

How to simulate "Projection Camera Mapping" of video on to a multiple BabylonJS Mesh?

问题:

如何将 "Projection Camera Mapping" 视频模拟到多个 BabylonJS Mesh 上?

细分:

我正在寻找的结果是视频将更多地用作网格的颜色渐变,或者另一方面视频本身的失真。

希望这是有道理的,我附上了一张来自 cinema 4d 的简化图像,说明我正在考虑的概念。

代码:

 var ToPi = 2*Math.PI;
    var points = [];
    var incrementer = 0.025;
    var x, y, z = 0;

    // -------------------------------------------------------------
    // Here begins a function that we will 'call' just after it's built
    var createScene = function () {
        // Now create a basic Babylon Scene object
        var scene = new BABYLON.Scene(engine);
        // Change the scene background color to green.
        scene.clearColor = new BABYLON.Color3(255/255,27/255,78/255);
        // This creates and positions a free camera
        var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
        // This targets the camera to scene origin
        camera.setTarget(BABYLON.Vector3.Zero());
        // This attaches the camera to the canvas
        camera.attachControl(canvas, false);
        // This creates a light, aiming 0,1,0 - to the sky.
        var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene);
        // Dim the light a small amount
        light.intensity = .5;
        // Let's try our built-in 'sphere' shape. Params: name, subdivisions, size, scene
        var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene);
        // Move the sphere upward 1/2 its height
        sphere.position.y = 1;



        for (var u = 0; u <= ToPi; u += incrementer){
            for( var v = 0; v <= ToPi; v += incrementer){

                points.push(new BABYLON.Vector3(
                        Math.sin(u)*10*(Math.cos(v)),
                        Math.sin(v)+Math.cos(u)*10*(Math.cos(v)),
                        Math.cos(v)+10*(Math.sin(v))*Math.sin(u))
                )
            }
        }

        var shape = BABYLON.Mesh.CreateLines('Shape', points, scene, true);
        shape.color = new BABYLON.Color3(0,0.5,0.5);

        var scaleIncrement = 0.01;

        scene.registerBeforeRender(function () {
            if (shape.scaling.x > 1.5 || shape.scaling.x < 0.5) {
                scaleIncrement *= -1;
            }

            shape.scaling.x += scaleIncrement;
            shape.scaling.y += scaleIncrement;
            shape.scaling.z += scaleIncrement;

        });
        return scene;
    }; // End of createScene function

我猜你可以在标准 material:

上使用投影映射

http://www.babylonjs-playground.com/#203BJM#2