[LayaAirIDE 2.0]3D的点光源或者聚光灯的光源会穿透模型

        let scene_: Laya.Scene3D = new Laya.Scene3D();
        let camera_: Laya.Camera = new Laya.Camera();
        let spotLight_: Laya.SpotLight = new Laya.SpotLight();
        let cube_: Laya.MeshSprite3D = new Laya.MeshSprite3D(Laya.PrimitiveMesh.createBox(1, 1, 1));
        let cube_2 = cube_.clone() as Laya.MeshSprite3D;
        scene_.addChild(cube_2);
        cube_2.transform.translate(new Laya.Vector3(0,0,-5));
        scene_.addChild(spotLight_);
        scene_.addChild(camera_);
        scene_.addChild(cube_);
        Laya.stage.addChild(scene_);
        cube_.transform.translate(new Laya.Vector3(0, 0, -3));
        spotLight_.transform.translate(new Laya.Vector3(0, 0, 3));
        spotLight_.color = new Laya.Vector3(1, 0, 0);
        spotLight_.intensity = 50;
        camera_.transform.translate(new Laya.Vector3(0, 3, 0));
        camera_.transform.rotate(new Laya.Vector3(-45, 0, 0), true, false);
Snipaste_2020-05-06_11-07-36.png
已邀请:

155*****646

赞同来自:

遇到相同问题,给光源添加了shadowMode 也没有效果

NilZ

赞同来自:

这个是由光照的实现原理导致的,光照在计算过程中是不考虑其他物体的遮挡的,这是业界普遍存在的现象(可以参考unity)。可以使用阴影功能来增加真实感。

要回复问题请先

商务合作
商务合作