完整版BedrockWiki镜像!
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
---
|
||||
title: Remove Entity Shadows
|
||||
title: 移除实体阴影
|
||||
tags:
|
||||
- intermediate
|
||||
category:
|
||||
- Tutorials
|
||||
- 中级
|
||||
category: 巧思案例
|
||||
mentions:
|
||||
- SirLich
|
||||
- solvedDev
|
||||
@@ -13,28 +12,50 @@ mentions:
|
||||
- ThomasOrs
|
||||
---
|
||||
|
||||
There are quite a few ways to remove shadows from entities, and nearly all of them have undesirable effects. There is no foolproof way to perfectly remove shadows from specific entities, without causing side effects.
|
||||
# 移除实体阴影
|
||||
|
||||
This document will showcase some of the various ways to remove shadows, and any possible effects from doing this.
|
||||
<!--@include: @/wiki/bedrock-wiki-mirror.md-->
|
||||
|
||||
## Small Collision Box
|
||||
移除实体阴影存在多种方法,但几乎所有方法都会产生副作用。目前没有完美无缺的方法能在不引发副作用的情况下完全移除特定实体的阴影。
|
||||
|
||||
One possibility is to make the size of the collision component very small. This will make it hard to interact/hit the entity, but it will make the shadow disappear!
|
||||
本文档将展示几种不同的移除阴影方法及其可能产生的效果。
|
||||
|
||||
<CodeHeader></CodeHeader>
|
||||
## 缩小碰撞箱
|
||||
|
||||
```json
|
||||
通过将碰撞箱组件(collision box)设置为极小尺寸,可以使实体阴影消失。但副作用是难以与实体进行交互/攻击。
|
||||
|
||||
::: code-group
|
||||
```json [BP]
|
||||
"minecraft:collision_box": {
|
||||
"width": 0.1,
|
||||
"height": 0.1
|
||||
}
|
||||
```
|
||||
|
||||
You can also add the [custom hit test component](https://bedrock.dev/docs/stable/Entities#minecraft:custom_hit_test). The `custom_hit_test` component will allow you to hit the entity, although you will not be able to interact with it. The `custom_hit_test` will not create a shadow.
|
||||
```json [原始CodeHeader的值]
|
||||
"minecraft:collision_box": {
|
||||
"width": 0.1,
|
||||
"height": 0.1
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
<CodeHeader></CodeHeader>
|
||||
可配合[自定义碰撞测试组件](https://bedrock.dev/docs/stable/Entities#minecraft:custom_hit_test)使用。`custom_hit_test`组件允许玩家攻击实体(但无法交互),且该组件不会生成阴影。
|
||||
|
||||
```json
|
||||
::: code-group
|
||||
```json [BP]
|
||||
"minecraft:custom_hit_test": {
|
||||
"hitboxes": [
|
||||
{
|
||||
"pivot": [0, 0.5, 0], // 这是碰撞箱的位置,可调整X/Y/Z坐标
|
||||
"width": 0.8,
|
||||
"height": 0.7
|
||||
} // 可在"hitboxes"数组中复制粘贴多个碰撞箱定义
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```json [原始CodeHeader的值]
|
||||
"minecraft:custom_hit_test": {
|
||||
"hitboxes": [
|
||||
{
|
||||
@@ -45,33 +66,33 @@ You can also add the [custom hit test component](https://bedrock.dev/docs/stable
|
||||
]
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
## Teleport underground
|
||||
## 地下传送
|
||||
|
||||
If you have a dummy entity (invisible) that you need to interact with, you can teleport like `/teleport @x ~ ~-0.01 ~`. This will slightly insert the entity into the ground, and stop shadows from showing.
|
||||
对于需要交互的隐形实体,可使用指令`/teleport @x ~ ~-0.01 ~`将实体略微嵌入地面以消除阴影。
|
||||
|
||||
## Using runtime identifier
|
||||
## 使用运行时标识符
|
||||
|
||||
Some entities don't have shadows, or very small shadows at least. By using the runtime identifier of these entities, we can remove the shadows. The downside is taking on that entities hard-coded behaviors, which can sometimes be very problematic. See the [runtime identifiers document](/entities/runtime-identifier) for more information.
|
||||
某些实体(如盔甲架)本身没有阴影或仅有极小的阴影。通过继承其运行时标识符(runtime identifier)可移除阴影,但会继承该实体的硬编码行为特性,可能引发其他问题。详细信息请参阅[运行时标识符文档](/wiki/entities/runtime-identifier)。
|
||||
|
||||
## Using Materials
|
||||
## 材质覆盖法
|
||||
|
||||
:::danger
|
||||
This method is no longer supported. With the advent of render-dragon, materials like this no longer function. Please do not attempt to use this code in a serious way, and definitely do not attempt it on a marketplace map.
|
||||
此方法已失效。随着Render Dragon引擎的应用,此类材质方案不再生效。请勿在正式项目中使用,尤其避免在商城地图中尝试。
|
||||
:::
|
||||
|
||||
:::warning
|
||||
- This folder is NOT included in the vanilla RP Pack examples and must be exported from a APK files or added by hand.
|
||||
- This has not been tested for blocks and has only been verified for entities. If you find it works on blocks too please let us know so we can add that in.
|
||||
- 此文件夹未包含在原生资源包示例中,需从APK文件导出或手动创建
|
||||
- 该方法仅验证适用于实体,尚未测试方块效果。如有相关发现欢迎反馈
|
||||
:::
|
||||
|
||||
<Spoiler title="Removing shadows via Materials.">
|
||||
<Spoiler title="通过材质移除阴影">
|
||||
|
||||
#### Working shadow code: Shadows for ALL entities:
|
||||
#### 全实体阴影显示配置:
|
||||
|
||||
<CodeHeader>RP/materials/shadows.material</CodeHeader>
|
||||
|
||||
```json
|
||||
::: code-group
|
||||
```json [RP/materials/shadows.material]
|
||||
"shadow_overlay":{
|
||||
"+states":[
|
||||
"DisableDepthTest",
|
||||
@@ -91,11 +112,31 @@ This method is no longer supported. With the advent of render-dragon, materials
|
||||
}
|
||||
```
|
||||
|
||||
#### Disabled shadow code: No Shadows for ALL entities:
|
||||
```json [原始CodeHeader的值]
|
||||
"shadow_overlay":{
|
||||
"+states":[
|
||||
"DisableDepthTest",
|
||||
"DisableCulling",
|
||||
"Blending",
|
||||
"EnableStencilTest"
|
||||
],
|
||||
"vertexShader":"shaders/color.vertex",
|
||||
"vrGeometryShader":"shaders/color.geometry",
|
||||
"fragmentShader":"shaders/shadow_stencil_overlay.fragment",
|
||||
"blendSrc":"DestColor",
|
||||
"blendDst":"Zero",
|
||||
"frontFace":{
|
||||
"stencilFunc":"Equal",
|
||||
"stencilPass":"Replace"
|
||||
}
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
<CodeHeader></CodeHeader>
|
||||
#### 全实体阴影禁用配置:
|
||||
|
||||
```json
|
||||
::: code-group
|
||||
```json [RP/materials/shadows.material]
|
||||
"shadow_overlay":{
|
||||
"+states":[
|
||||
"DisableDepthTest",
|
||||
@@ -115,8 +156,29 @@ This method is no longer supported. With the advent of render-dragon, materials
|
||||
}
|
||||
```
|
||||
|
||||
```json [原始CodeHeader的值]
|
||||
"shadow_overlay":{
|
||||
"+states":[
|
||||
"DisableDepthTest",
|
||||
"DisableCulling",
|
||||
"Blending",
|
||||
"EnableStencilTest"
|
||||
],
|
||||
"vertexShader":"",
|
||||
"vrGeometryShader":"",
|
||||
"fragmentShader":"",
|
||||
"blendSrc":"DestColor",
|
||||
"blendDst":"Zero",
|
||||
"frontFace":{
|
||||
"stencilFunc":"Equal",
|
||||
"stencilPass":"Replace"
|
||||
}
|
||||
}
|
||||
```
|
||||
:::
|
||||
|
||||
</Spoiler>
|
||||
|
||||
#### Geometry + Materials Workaround
|
||||
#### 几何模型+材质解决方案
|
||||
|
||||
You can hide entity shadows if you apply a model on your entity to cover the shadow and use `"banner_pole"` material.
|
||||
通过为实体应用覆盖阴影的模型,并使用`"banner_pole"`材质可实现阴影隐藏。
|
||||
Reference in New Issue
Block a user