透明遮光物体
我想渲染一个地板+屋顶向一侧开放的房间。房间包含一个点光源,它的“外部”由环境光(太阳)照亮。还有一项附加要求:用户应该能够查看房间内部以了解发生了什么。但我不能简单地拆掉屋顶,因为这样房间就会被环境光完全照亮。
我认为我的问题可以通过让透明的 3D 物体仍然阻挡光线来解决。
为了让您了解我当前的场景,它是这样的:
灰色的东西是我房间的墙。黑色的东西是房间的地板。绿色的东西是场景的地面。该房间包含一个点光源。
我目前正在使用两个场景(请参阅从定向/环境照明中排除区域)因为我希望房间内部不受环境光的影响。但现在我的灯光只能影响房间内部(点光源)或外部(环境光),但不能同时影响两者。
我的场景的可运行示例可以在这里找到:
https: //codesandbox.io/s/confident-worker-64kg7m?file=/src/index.js
再说一次:我认为我的问题可以通过使用仍然阻挡光线的透明物体来解决。如果我有的话,我会简单地在我的房间顶部(作为屋顶)放置一个 3d 平面并使其透明......它会阻挡房间内部的光线(但如果房间是开放的,仍然让它进入外面) )并且它还会阻挡环境光(部分 - 如果房间是开放的)......
也许还有另一种我没有看到的解决方案。
I want to render a room with a floor + roof that is open to one side. The room contains a point light and the "outside" it lit by an ambient light (the sun). There is one additional requirement: The user should be able to look inside the room to see whats going on. But I cannot simply remove the roof because then the room is fully lit by the ambient light.
I think my problem could be solved by having 3d objects that are transparent by still are blocking the light.
To give you an idea about my current scene, this is how it looks like:
The grey thing is the wall of my room. The black thing is the floor of the room. The green thing is the ground of the scene. The room contains a point light.
I am currently using two scenes (see Exclude Area from Directional/Ambient Lighting) because I wanted the inside of the room to be unaffected by the ambient light. But now my lights can only affect either the inside of my room (the point light) OR the outside (the ambient light) but not both.
A runnable sample of my scene can be found here:
https://codesandbox.io/s/confident-worker-64kg7m?file=/src/index.js
Again: I think that my problem could be solved by having transparent objects that still block the light. If I had that I would simply have a 3d plane on top of my room (as the roof) and make it transparent... It would block the light that is inside of the (but still let it go outside if the room is open) and it would also block the ambient light (partially - if the room is open)...
Maybe there is also another solution that I am not seeing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需使用一个场景而不是两个场景,然后在相关网格上启用阴影,这样光线就不会从内部穿过到外部。一旦您仅使用一个场景,演示中要采取的步骤是:
side: THREE.BackSide
。这只会渲染网格的背面,这意味着从上方看不到它,但它仍然会投射阴影。请参阅此处获取演示的工作副本:
https://codesandbox.io/s/stupefied-williams -qd7jmi?file=/src/index.js
Just use one scene instead of two, then enable shadows across the relevant meshes so a light doesn't cross from inside to outside. Once you're using only one scene, the steps to take in your demo are:
side: THREE.BackSide
. This will only render the back side of the Mesh, which means it won't be visible from above, but it will still cast shadows.See here for a working copy of your demo:
https://codesandbox.io/s/stupefied-williams-qd7jmi?file=/src/index.js
我会为房间分配一个平坦的发射材料。或者深度梯度(如果它变成地形)。由于 环境光 不会投射阴影。它节省了光线和额外的几何图形或组。再加上网络模型查看器可能会渲染得更好。如果您要进行显示过渡,请使用剪辑平面或纹理 alpha 蒙版。
这取决于表示形式与输出格式。它还取决于最终平面图的复杂程度。如果您的过程很简单,它将在 Raspberry Voxel 上运行 Sims Lite。
I would assign a flat, emissive material to the room. Or a depth gradient if it becomes terrain. Since ambient light doesn't cast shadow. It saves a light and extra geometry or groups. Plus web model viewer(s) would probably render it better. If you're doing a reveal transition, use a clip plane or texture alpha mask.
It depends on the presentation versus the output format. Also it depends on the complexity of the final floorplan. If your process is simple it will run Sims Lite on a Raspberry Voxel.