是否只有a帧有receive shadow

Is there a receive shadow only in a-frame

我正在尝试创建一个将接收阴影但对相机不可见的平面,以便使 3d 模型看起来像浮动的

试图让material透明

     <!-- this is the shadow system -->
    <a-entity light="type: ambient; intensity: 0.5;"></a-entity>
     <a-entity light="type: directional;
               castShadow: true;
               intensity: 1;
               shadowCameraVisible: true;"
        position="0 0 5"></a-entity>
    <a-assets>

        <!-- the models -->
        <a-asset-item id="animated-asset" src="https://artshirtsonline.com/shanatova/models/test_lines.gltf"  ></a-asset-item>
    </a-assets>

        <a-marker id='animated-marker' type='pattern' preset='custom' url='https://artshirtsonline.com/shanatova/markers/pattern-qrcode2.patt'>

                   <a-entity animation-mixer="loop: repeat" gltf-model='#animated-asset' 
            scale="1 1 1"
            shadow="cast: true"
            rotation="-90 0 0"></a-entity>

        <a-circle id="ground" radius="7" rotation="-90 0 0" position="0 -2 0" shadow="receive: true"  ></a-circle>
    </a-marker>

    <a-entity camera ></a-entity>
    </a-scene>

我希望仅在表面上获得阴影

是的,这绝对是可能的,但你需要做一些 threejs 编程才能让它工作。

这里是一个用正常方式投射阴影的例子: https://glitch.com/~shadow-cast-basic.

注意一定要设置灯光投射阴影,而且一定要放置阴影组件 在阴影投射器和接收器上。您调整场景实体中阴影的质量。 <a-scene shadow="type: pcfsoft">

阴影清晰可见,平面不透明

要达到预期的效果(透明物体的可见阴影),您必须使用三个 js 阴影 material。 https://threejs.org/docs/#api/en/materials/ShadowMaterial

Aframe 不直接提供对此的访问,但您可以制作一个自定义组件来为您创建 material。这是一个例子。 https://glitch.com/~shadow-material

我 运行 几个月前为我正在从事的增强现实项目研究了这个问题,并最终创建了可以在我的 Github 上找到的现成组件,在以防有人遇到这个 post 并且不想花时间自己弄清楚。