sample/assets/js/babylon.max.js
function (subMesh) {
                var mesh = subMesh.getRenderingMesh();
                if (_this._meshExcluded(mesh)) {
                    return;
                }
                var scene = mesh.getScene();
                var engine = scene.getEngine();
                // Culling
                engine.setState(subMesh.getMaterial().backFaceCulling);
                // Managing instances
                var batch = mesh._getInstancesRenderList(subMesh._id);
                if (batch.mustReturn) {
                    return;
                }
                var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);
                if (_this.isReady(subMesh, hardwareInstancedRendering)) {
                    var effect = _this._volumetricLightScatteringPass;
                    if (mesh === _this.mesh) {
                        if (subMesh.effect) {
                            effect = subMesh.effect;
                        }
                        else {
                            effect = subMesh.getMaterial().getEffect();
                        }
                    }
                    engine.enableEffect(effect);
                    mesh._bind(subMesh, effect, BABYLON.Material.TriangleFillMode);
                    if (mesh === _this.mesh) {
                        subMesh.getMaterial().bind(mesh.getWorldMatrix(), mesh);
                    }
                    else {
                        var material = subMesh.getMaterial();
                        _this._volumetricLightScatteringPass.setMatrix("viewProjection", scene.getTransformMatrix());
                        // Alpha test
                        if (material && material.needAlphaTesting()) {
                            var alphaTexture = material.getAlphaTestTexture();
                            _this._volumetricLightScatteringPass.setTexture("diffuseSampler", alphaTexture);
                            if (alphaTexture) {
                                _this._volumetricLightScatteringPass.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
                            }
                        }
                        // Bones
                        if (mesh.useBones && mesh.computeBonesUsingShaders) {
                            _this._volumetricLightScatteringPass.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
                        }
                    }
                    // Draw
                    mesh._processRendering(subMesh, _this._volumetricLightScatteringPass, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return effect.setMatrix("world", world); });
                }
            }
function (subMesh) {
                var mesh = subMesh.getRenderingMesh();
                if (_this._meshExcluded(mesh)) {
                    return;
                }
                var scene = mesh.getScene();
                var engine = scene.getEngine();
                // Culling
                engine.setState(subMesh.getMaterial().backFaceCulling);
                // Managing instances
                var batch = mesh._getInstancesRenderList(subMesh._id);
                if (batch.mustReturn) {
                    return;
                }
                var hardwareInstancedRendering = (engine.getCaps().instancedArrays) && (batch.visibleInstances[subMesh._id] !== null);
                if (_this.isReady(subMesh, hardwareInstancedRendering)) {
                    var effect = _this._volumetricLightScatteringPass;
                    if (mesh === _this.mesh) {
                        if (subMesh.effect) {
                            effect = subMesh.effect;
                        }
                        else {
                            effect = subMesh.getMaterial().getEffect();
                        }
                    }
                    engine.enableEffect(effect);
                    mesh._bind(subMesh, effect, BABYLON.Material.TriangleFillMode);
                    if (mesh === _this.mesh) {
                        subMesh.getMaterial().bind(mesh.getWorldMatrix(), mesh);
                    }
                    else {
                        var material = subMesh.getMaterial();
                        _this._volumetricLightScatteringPass.setMatrix("viewProjection", scene.getTransformMatrix());
                        // Alpha test
                        if (material && material.needAlphaTesting()) {
                            var alphaTexture = material.getAlphaTestTexture();
                            _this._volumetricLightScatteringPass.setTexture("diffuseSampler", alphaTexture);
                            if (alphaTexture) {
                                _this._volumetricLightScatteringPass.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
                            }
                        }
                        // Bones
                        if (mesh.useBones && mesh.computeBonesUsingShaders) {
                            _this._volumetricLightScatteringPass.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
                        }
                    }
                    // Draw
                    mesh._processRendering(subMesh, _this._volumetricLightScatteringPass, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return effect.setMatrix("world", world); });
                }
            }
function ( subMesh ) { var mesh = subMesh . getRenderingMesh ( ) ; if ( _this . _meshExcluded ( mesh ) ) { return ; } var scene = mesh . getScene ( ) ; var engine = scene . getEngine ( ) ; // Culling engine . setState ( subMesh . getMaterial ( ) . backFaceCulling ) ; // Managing instances var batch = mesh . _getInstancesRenderList ( subMesh . _id ) ; if ( batch . mustReturn ) { return ; } var hardwareInstancedRendering = ( engine . getCaps ( ) . instancedArrays ) && ( batch . visibleInstances [ subMesh . _id ] !== null ) ; if ( _this . isReady ( subMesh , hardwareInstancedRendering ) ) { var effect = _this . _volumetricLightScatteringPass ; if ( mesh === _this . mesh ) { if ( subMesh . effect ) { effect = subMesh . effect ; } else { effect = subMesh . getMaterial ( ) . getEffect ( ) ; } } engine . enableEffect ( effect ) ; mesh . _bind ( subMesh , effect , BABYLON . Material . TriangleFillMode ) ; if ( mesh === _this . mesh ) { subMesh . getMaterial ( ) . bind ( mesh . getWorldMatrix ( ) , mesh ) ; } else { var material = subMesh . getMaterial ( ) ; _this . _volumetricLightScatteringPass . setMatrix ( "viewProjection" , scene . getTransformMatrix ( ) ) ; // Alpha test if ( material && material . needAlphaTesting ( ) ) { var alphaTexture = material . getAlphaTestTexture ( ) ; _this . _volumetricLightScatteringPass . setTexture ( "diffuseSampler" , alphaTexture ) ; if ( alphaTexture ) { _this . _volumetricLightScatteringPass . setMatrix ( "diffuseMatrix" , alphaTexture . getTextureMatrix ( ) ) ; } } // Bones if ( mesh . useBones && mesh . computeBonesUsingShaders ) { _this . _volumetricLightScatteringPass . setMatrices ( "mBones" , mesh . skeleton . getTransformMatrices ( mesh ) ) ; } } // Draw mesh . _processRendering ( subMesh , _this . _volumetricLightScatteringPass , BABYLON . Material . TriangleFillMode , batch , hardwareInstancedRendering , function ( isInstance , world ) { return effect . setMatrix ( "world" , world ) ; } ) ; } }
Custom render function for submeshes
Custom render function for submeshes