three-base 2.0.172 → 2.0.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FPScontrol.d.ts +15 -24
- package/FPScontrol.js +63 -87
- package/FPScontrol.ts +64 -88
- package/Ground1/Ground1.d.ts +4 -2
- package/Ground1/Ground1.js +77 -57
- package/Ground1/Ground1.ts +77 -57
- package/Mirror.js +0 -4
- package/Mirror.ts +0 -4
- package/MktMesh/MktMesh.d.ts +3 -2
- package/MktMesh/MktMesh.js +27 -8
- package/MktMesh/MktMesh.ts +24 -8
- package/MktMesh/boxLine2.d.ts +42 -0
- package/MktMesh/boxLine2.js +185 -0
- package/MktMesh/boxLine2.ts +222 -0
- package/MktMesh/imagePlane.d.ts +60 -0
- package/MktMesh/imagePlane.js +158 -0
- package/MktMesh/imagePlane.ts +203 -0
- package/MktMesh/imageTileLoader.d.ts +19 -0
- package/MktMesh/imageTileLoader.js +55 -0
- package/MktMesh/imageTileLoader.ts +64 -0
- package/MktMesh/mktMappingShader.d.ts +6 -5
- package/MktMesh/mktMappingShader.js +26 -19
- package/MktMesh/mktMappingShader.ts +28 -19
- package/MktMesh/mktShader.d.ts +127 -58
- package/MktMesh/mktShader.js +192 -117
- package/MktMesh/mktShader.ts +251 -127
- package/MktMesh/modelSlot.d.ts +123 -0
- package/MktMesh/modelSlot.js +339 -0
- package/MktMesh/modelSlot.ts +383 -0
- package/MktMesh/panoSlotRoster.d.ts +2 -2
- package/MktMesh/panoSlotRoster.js +9 -7
- package/MktMesh/panoSlotRoster.ts +9 -7
- package/MktMesh/panoTileStitcher.d.ts +20 -13
- package/MktMesh/panoTileStitcher.js +97 -76
- package/MktMesh/panoTileStitcher.ts +119 -90
- package/PipeMesh/PipeJoint.d.ts +22 -0
- package/PipeMesh/PipeJoint.js +33 -0
- package/PipeMesh/PipeJoint.ts +38 -0
- package/PipeMesh/PipeMesh.d.ts +94 -22
- package/PipeMesh/PipeMesh.js +192 -53
- package/PipeMesh/PipeMesh.ts +223 -76
- package/PipeMesh/PipeStraight.d.ts +19 -0
- package/PipeMesh/PipeStraight.js +34 -0
- package/PipeMesh/PipeStraight.ts +45 -0
- package/PipeMesh/axisSnap.d.ts +52 -0
- package/PipeMesh/axisSnap.js +52 -0
- package/PipeMesh/axisSnap.ts +93 -0
- package/PipeMesh/directRoute.d.ts +85 -0
- package/PipeMesh/directRoute.js +126 -0
- package/PipeMesh/directRoute.ts +190 -0
- package/PipeMesh/index.d.ts +6 -0
- package/PipeMesh/index.js +6 -0
- package/PipeMesh/index.ts +7 -1
- package/PipeMesh/pipeMaterial.d.ts +16 -0
- package/PipeMesh/pipeMaterial.js +23 -0
- package/PipeMesh/pipeMaterial.ts +26 -0
- package/ThreeBase.d.ts +1 -39
- package/ThreeBase.js +38 -147
- package/ThreeBase.ts +1176 -1302
- package/instanced/InstancedBatch.d.ts +14 -1
- package/instanced/InstancedBatch.js +53 -3
- package/instanced/InstancedBatch.ts +62 -3
- package/instanced/InstancedChild.d.ts +24 -0
- package/instanced/InstancedChild.js +40 -0
- package/instanced/InstancedChild.ts +41 -0
- package/instanced/InstancedGroup.d.ts +48 -0
- package/instanced/InstancedGroup.js +45 -1
- package/instanced/InstancedGroup.ts +85 -0
- package/package.json +22 -7
- package/pass/debugDepthState.d.ts +16 -8
- package/pass/debugDepthState.js +4 -0
- package/pass/debugDepthState.ts +27 -9
- package/pass/glow_pass.js +11 -94
- package/pass/glow_pass.ts +11 -97
- package/pass/ssao_pass.d.ts +9 -23
- package/pass/ssao_pass.js +41 -128
- package/pass/ssao_pass.ts +36 -166
- package/pass/stroke_pass.js +3 -0
- package/pass/stroke_pass.ts +4 -0
- package/shaders/debugDepthCompareShader.d.ts +1 -1
- package/shaders/debugDepthCompareShader.js +1 -1
- package/shaders/debugDepthCompareShader.ts +1 -1
- package/shaders/debugDepthJudgeShader.d.ts +1 -1
- package/shaders/debugDepthJudgeShader.js +1 -1
- package/shaders/debugDepthJudgeShader.ts +1 -1
- package/PipeMesh/PathGeometry.d.ts +0 -44
- package/PipeMesh/PathGeometry.js +0 -307
- package/PipeMesh/PathGeometry.ts +0 -343
- package/PipeMesh/PathPoint.d.ts +0 -17
- package/PipeMesh/PathPoint.js +0 -31
- package/PipeMesh/PathPoint.ts +0 -36
- package/PipeMesh/PathPointList.d.ts +0 -31
- package/PipeMesh/PathPointList.js +0 -209
- package/PipeMesh/PathPointList.ts +0 -227
- package/PipeMesh/PathTubeGeometry.d.ts +0 -25
- package/PipeMesh/PathTubeGeometry.js +0 -130
- package/PipeMesh/PathTubeGeometry.ts +0 -146
- package/WaterFlow/FloatingDuck.d.ts +0 -88
- package/WaterFlow/FloatingDuck.js +0 -307
- package/WaterFlow/FloatingDuck.ts +0 -445
- package/WaterFlow/GPUFluidSimulation.d.ts +0 -56
- package/WaterFlow/GPUFluidSimulation.js +0 -785
- package/WaterFlow/GPUFluidSimulation.ts +0 -827
- package/WaterFlow/ReservoirSystem.d.ts +0 -106
- package/WaterFlow/ReservoirSystem.js +0 -621
- package/WaterFlow/ReservoirSystem.ts +0 -754
- package/WaterFlow/SPHField.d.ts +0 -35
- package/WaterFlow/SPHField.js +0 -204
- package/WaterFlow/SPHField.ts +0 -228
- package/WaterFlow/ScreenSpaceFluidPass.d.ts +0 -69
- package/WaterFlow/ScreenSpaceFluidPass.js +0 -736
- package/WaterFlow/ScreenSpaceFluidPass.ts +0 -789
- package/WaterFlow/ShallowWaterSurface.d.ts +0 -45
- package/WaterFlow/ShallowWaterSurface.js +0 -441
- package/WaterFlow/ShallowWaterSurface.ts +0 -510
- package/WaterFlow/WaterFlow.d.ts +0 -87
- package/WaterFlow/WaterFlow.js +0 -171
- package/WaterFlow/WaterFlow.ts +0 -219
- package/WaterFlow/types.d.ts +0 -161
- package/WaterFlow/types.js +0 -1
- package/WaterFlow/types.ts +0 -189
- package/WaterFlow/waterFlowPass.d.ts +0 -3
- package/WaterFlow/waterFlowPass.js +0 -20
- package/WaterFlow/waterFlowPass.ts +0 -40
- package/shaders/debugExcludedShader.d.ts +0 -15
- package/shaders/debugExcludedShader.js +0 -48
- package/shaders/debugExcludedShader.ts +0 -50
package/WaterFlow/types.ts
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WaterFlow 模块共享类型(单一来源,供 WaterFlow 目录内各 .ts 复用)。
|
|
3
|
-
*
|
|
4
|
-
* 2026-10-08 皇上旨「项目代码就应该写成 ts 来校验,尽量不写 js」——
|
|
5
|
-
* 原 WaterFlow/ 下 7 个手写 .js 全部改写为 .ts,公共入参/出参类型集中在此,
|
|
6
|
-
* 避免各文件重复声明高度相似的结构(也避免 any)。
|
|
7
|
-
*/
|
|
8
|
-
import type {
|
|
9
|
-
Camera,
|
|
10
|
-
DepthTexture,
|
|
11
|
-
Scene,
|
|
12
|
-
Texture,
|
|
13
|
-
Vector3,
|
|
14
|
-
Vector4,
|
|
15
|
-
WebGLRenderer,
|
|
16
|
-
WebGLRenderTarget,
|
|
17
|
-
} from 'three';
|
|
18
|
-
|
|
19
|
-
/** 深度解码口径:普通透视深度 | three-base 的对数深度(logarithmicDepthBuffer)。 */
|
|
20
|
-
export type DepthMode = 'standard' | 'logarithmic';
|
|
21
|
-
|
|
22
|
-
/** 「注入基础纹理」模式:直接消费调用方已有的颜色/深度,省掉一遍主场景渲染。 */
|
|
23
|
-
export interface WaterFlowBaseTextures {
|
|
24
|
-
colorTexture: Texture;
|
|
25
|
-
depthTexture: DepthTexture | Texture;
|
|
26
|
-
depthMode?: DepthMode;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** renderInto 的入参:在基础纹理之上再加「输出目标 + 相机」。 */
|
|
30
|
-
export interface WaterFlowRenderOptions extends WaterFlowBaseTextures {
|
|
31
|
-
/** 合成输出目标;null 表示沿用调用方当前渲染目标(由 renderer.getRenderTarget() 决定)。 */
|
|
32
|
-
outputTarget: WebGLRenderTarget | null;
|
|
33
|
-
camera: Camera;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** 模拟参数(可部分更新,故全部可选)。 */
|
|
37
|
-
export interface FluidParameters {
|
|
38
|
-
speed?: number;
|
|
39
|
-
aperture?: number;
|
|
40
|
-
fillRatio?: number;
|
|
41
|
-
emitting?: boolean;
|
|
42
|
-
turbulence?: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** 蓄水池状态。 */
|
|
46
|
-
export interface ReservoirState {
|
|
47
|
-
active?: boolean;
|
|
48
|
-
fillRatio?: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** 容器(盆)几何口径:x 范围、z 半宽、中心、水面高度与壁高。 */
|
|
52
|
-
export interface BasinConfig {
|
|
53
|
-
minX: number;
|
|
54
|
-
maxX: number;
|
|
55
|
-
halfZ: number;
|
|
56
|
-
centerZ?: number;
|
|
57
|
-
waterY: number;
|
|
58
|
-
wallTop: number;
|
|
59
|
-
floorY?: number;
|
|
60
|
-
containerFloorY?: number;
|
|
61
|
-
rimWidth?: number;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** ShallowWaterSurface 构造选项。 */
|
|
65
|
-
export interface ShallowWaterSurfaceOptions {
|
|
66
|
-
width?: number;
|
|
67
|
-
height?: number;
|
|
68
|
-
basinMinX?: number;
|
|
69
|
-
basinMaxX?: number;
|
|
70
|
-
basinHalfZ?: number;
|
|
71
|
-
basinCenterZ?: number;
|
|
72
|
-
waterY?: number;
|
|
73
|
-
cpuSampling?: boolean;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** ShallowWaterSurface.setBounds 的入参(centerZ 省略时按 0 处理)。 */
|
|
77
|
-
export interface ShallowWaterSurfaceBounds {
|
|
78
|
-
basinMinX: number;
|
|
79
|
-
basinMaxX: number;
|
|
80
|
-
basinHalfZ: number;
|
|
81
|
-
basinCenterZ?: number;
|
|
82
|
-
waterY: number;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 水面采样结果(ShallowWaterSurface.sampleSurface 回填 target 后返回)。
|
|
87
|
-
* 字段全为可选:调用方可只声明自己关心的部分,结构上兼容 FloatingDuck 的 DuckSurfaceSample。
|
|
88
|
-
*/
|
|
89
|
-
export interface WaterSurfaceSample {
|
|
90
|
-
height?: number;
|
|
91
|
-
velocityY?: number;
|
|
92
|
-
slopeX?: number;
|
|
93
|
-
slopeZ?: number;
|
|
94
|
-
flowX?: number;
|
|
95
|
-
flowZ?: number;
|
|
96
|
-
impact?: number;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** 渲染质量档。 */
|
|
100
|
-
export interface FluidQuality {
|
|
101
|
-
scale: number;
|
|
102
|
-
activeCount: number;
|
|
103
|
-
blurRadius: number;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** 外层 WaterFlow 构造选项。 */
|
|
107
|
-
export interface WaterFlowOptions {
|
|
108
|
-
width?: number;
|
|
109
|
-
height?: number;
|
|
110
|
-
scale?: number;
|
|
111
|
-
size?: number;
|
|
112
|
-
speed?: number;
|
|
113
|
-
aperture?: number;
|
|
114
|
-
nozzle?: Vector3;
|
|
115
|
-
basin?: Vector4;
|
|
116
|
-
jetDirection?: Vector3;
|
|
117
|
-
collision?: boolean;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** GPUFluidSimulation 构造选项(与外层同源,保留喷嘴/盆/喷流方向)。 */
|
|
121
|
-
export interface FluidSimulationOptions {
|
|
122
|
-
size?: number;
|
|
123
|
-
nozzle?: Vector3;
|
|
124
|
-
basin?: Vector4;
|
|
125
|
-
speed?: number;
|
|
126
|
-
aperture?: number;
|
|
127
|
-
jetDirection?: Vector3;
|
|
128
|
-
collision?: boolean;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/** SPHField 构造选项。 */
|
|
132
|
-
export interface SPHFieldOptions {
|
|
133
|
-
mobile?: boolean;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** ScreenSpaceFluidPass 构造选项。 */
|
|
137
|
-
export interface ScreenSpaceFluidPassOptions {
|
|
138
|
-
width?: number;
|
|
139
|
-
height?: number;
|
|
140
|
-
scale?: number;
|
|
141
|
-
activeCount?: number;
|
|
142
|
-
externalBase?: {
|
|
143
|
-
colorTexture: Texture;
|
|
144
|
-
depthTexture: DepthTexture | Texture;
|
|
145
|
-
depthMode: DepthMode;
|
|
146
|
-
} | null;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/** 屏幕空间 pass 需要的场景/相机(构造期持有,避免每帧反查)。 */
|
|
150
|
-
export interface ScreenSpaceFluidContext {
|
|
151
|
-
scene: Scene;
|
|
152
|
-
camera: Camera;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** setBaseTextures 的部分更新入参。 */
|
|
156
|
-
export interface PartialBaseTextures {
|
|
157
|
-
colorTexture?: Texture;
|
|
158
|
-
depthTexture?: DepthTexture | Texture;
|
|
159
|
-
depthMode?: DepthMode;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/** 渲染器能力判定结果:非 WebGL2 或缺浮点扩展时整套流体不可用。 */
|
|
163
|
-
export interface FluidSupportInfo {
|
|
164
|
-
renderer: WebGLRenderer;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* ScreenSpaceFluidPass 视角下的流体模拟器最小契约。
|
|
169
|
-
* 只声明 pass 真正读取的成员(粒子纹理边长 / 粒子数 / 能力位 / 位置与速度纹理),
|
|
170
|
-
* 使 pass 不必耦合 GPUFluidSimulation 的其余实现细节。
|
|
171
|
-
* GPUFluidSimulation 实例天然满足本结构(结构化子类型)。
|
|
172
|
-
*/
|
|
173
|
-
export interface ScreenSpaceFluidSource {
|
|
174
|
-
/** 粒子纹理边长,count === size * size。 */
|
|
175
|
-
size: number;
|
|
176
|
-
/** 粒子总数。 */
|
|
177
|
-
count: number;
|
|
178
|
-
/** 是否支持浮点纹理;false 时两个纹理成员为 null。 */
|
|
179
|
-
supported: boolean;
|
|
180
|
-
positionTexture: Texture | null;
|
|
181
|
-
velocityTexture: Texture | null;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* 「外部注入基础纹理」三元组的非空形态。
|
|
186
|
-
* 等价于 ScreenSpaceFluidPassOptions['externalBase'] 去掉 null,
|
|
187
|
-
* 供 pass 内部字段(externalBase)与 GPUFluidSimulation 之外的调用方直接复用。
|
|
188
|
-
*/
|
|
189
|
-
export type ExternalBaseTextures = NonNullable<ScreenSpaceFluidPassOptions['externalBase']>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { WebGLRenderer, WebGLRenderTarget, DepthTexture, Camera, Scene } from 'three';
|
|
2
|
-
import { WaterFlow } from './WaterFlow';
|
|
3
|
-
export default function waterFlowPass(renderer: WebGLRenderer, camera: Camera, scene: Scene, baseRenderTarget: WebGLRenderTarget, baseDepthTexture: DepthTexture, waterFlow: WaterFlow): void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export default function waterFlowPass(renderer, camera, scene, baseRenderTarget, baseDepthTexture, waterFlow) {
|
|
2
|
-
if (!waterFlow || !waterFlow.supported)
|
|
3
|
-
return;
|
|
4
|
-
// scene 仅占位以维持与 three-base 其它 pass 一致的参数形态;水面在 externalBase
|
|
5
|
-
// 模式下只消费基础纹理,不自渲染场景。
|
|
6
|
-
void scene;
|
|
7
|
-
void baseRenderTarget;
|
|
8
|
-
// 当前渲染目标(ThreeBase 此处即 screenRenderTarget,已是经 ssao/覆盖/磨砂后的合成画面)。
|
|
9
|
-
// 把它作为「场景颜色」注入给水面:水面内部先把当前目标拷到临时目标,再合成回当前目标,
|
|
10
|
-
// 既避免「读当前目标写当前目标」的反馈未定义行为,又完整保留既有后处理(不会被原始 base 覆盖)。
|
|
11
|
-
const originTarget = renderer.getRenderTarget();
|
|
12
|
-
const sceneColor = originTarget ? originTarget.texture : null;
|
|
13
|
-
waterFlow.renderInto(renderer, {
|
|
14
|
-
colorTexture: sceneColor ?? baseRenderTarget.texture,
|
|
15
|
-
depthTexture: baseDepthTexture,
|
|
16
|
-
depthMode: 'logarithmic',
|
|
17
|
-
outputTarget: originTarget,
|
|
18
|
-
camera,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* WaterFlow 函数式后处理入口(与 three-base 的 *_pass.ts 同形态)。
|
|
3
|
-
*
|
|
4
|
-
* 直接消费 baseRenderTarget.texture + baseDepthTexture(three-base 对数深度),
|
|
5
|
-
* 把屏幕空间水面合成回当前渲染目标,复用 three-base「共用基础纹理/基础深度图」的
|
|
6
|
-
* 后处理方案 —— 水面 pass 不自渲染主场景,省掉一遍全场景绘制。
|
|
7
|
-
*
|
|
8
|
-
* 调用位置(ThreeBase.render):在 frosted_glass_pass 之后、screenCopy 之前,
|
|
9
|
-
* 此时当前渲染目标仍是 baseRenderTarget,水面把结果合成回它,后续 screenCopy /
|
|
10
|
-
* screenBloom 会自然带上水面(水面高光也能被 bloom 处理)。
|
|
11
|
-
*/
|
|
12
|
-
import { WebGLRenderer, WebGLRenderTarget, DepthTexture, Camera, Scene, Texture } from 'three';
|
|
13
|
-
import { WaterFlow } from './WaterFlow';
|
|
14
|
-
|
|
15
|
-
export default function waterFlowPass(
|
|
16
|
-
renderer: WebGLRenderer,
|
|
17
|
-
camera: Camera,
|
|
18
|
-
scene: Scene,
|
|
19
|
-
baseRenderTarget: WebGLRenderTarget,
|
|
20
|
-
baseDepthTexture: DepthTexture,
|
|
21
|
-
waterFlow: WaterFlow,
|
|
22
|
-
): void {
|
|
23
|
-
if (!waterFlow || !waterFlow.supported) return;
|
|
24
|
-
// scene 仅占位以维持与 three-base 其它 pass 一致的参数形态;水面在 externalBase
|
|
25
|
-
// 模式下只消费基础纹理,不自渲染场景。
|
|
26
|
-
void scene;
|
|
27
|
-
void baseRenderTarget;
|
|
28
|
-
// 当前渲染目标(ThreeBase 此处即 screenRenderTarget,已是经 ssao/覆盖/磨砂后的合成画面)。
|
|
29
|
-
// 把它作为「场景颜色」注入给水面:水面内部先把当前目标拷到临时目标,再合成回当前目标,
|
|
30
|
-
// 既避免「读当前目标写当前目标」的反馈未定义行为,又完整保留既有后处理(不会被原始 base 覆盖)。
|
|
31
|
-
const originTarget = renderer.getRenderTarget();
|
|
32
|
-
const sceneColor: Texture | null = originTarget ? originTarget.texture : null;
|
|
33
|
-
waterFlow.renderInto(renderer, {
|
|
34
|
-
colorTexture: sceneColor ?? baseRenderTarget.texture,
|
|
35
|
-
depthTexture: baseDepthTexture,
|
|
36
|
-
depthMode: 'logarithmic',
|
|
37
|
-
outputTarget: originTarget,
|
|
38
|
-
camera,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ShaderMaterial } from "three";
|
|
2
|
-
/**
|
|
3
|
-
* 调试用:把「可见深度图」与「被排除面 mask」叠在一起看。
|
|
4
|
-
*
|
|
5
|
-
* 底色 = baseDepthTexture 灰度(近黑远白,同「全局深度图」档);
|
|
6
|
-
* 红色 = 该像素上的表面被 renderVisibleDepthPass 排除(sprite/线条/点、userData.aoTransparent)
|
|
7
|
-
* → **它写不进深度图,永远挡不住任何后处理**。
|
|
8
|
-
* ⚠️ 地板 Ground1 不在此列:2026-10-11 皇上旨「物体的深度都要进深度图」,原 aoFloor 排除特例
|
|
9
|
-
* 已整条拆除,地板现在是正常写深度的实心面(该像素应显示为灰、不是红)。
|
|
10
|
-
*
|
|
11
|
-
* 判读:挡不住你的那个面如果是红的 → 不是深度算法坏了,是它被标记成可透视;
|
|
12
|
-
* 把该对象的 userData.aoTransparent 去掉即可让它参与遮挡。
|
|
13
|
-
*/
|
|
14
|
-
declare const debugExcludedShader: ShaderMaterial;
|
|
15
|
-
export default debugExcludedShader;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ShaderChunk, ShaderMaterial } from "three";
|
|
2
|
-
/**
|
|
3
|
-
* 调试用:把「可见深度图」与「被排除面 mask」叠在一起看。
|
|
4
|
-
*
|
|
5
|
-
* 底色 = baseDepthTexture 灰度(近黑远白,同「全局深度图」档);
|
|
6
|
-
* 红色 = 该像素上的表面被 renderVisibleDepthPass 排除(sprite/线条/点、userData.aoTransparent)
|
|
7
|
-
* → **它写不进深度图,永远挡不住任何后处理**。
|
|
8
|
-
* ⚠️ 地板 Ground1 不在此列:2026-10-11 皇上旨「物体的深度都要进深度图」,原 aoFloor 排除特例
|
|
9
|
-
* 已整条拆除,地板现在是正常写深度的实心面(该像素应显示为灰、不是红)。
|
|
10
|
-
*
|
|
11
|
-
* 判读:挡不住你的那个面如果是红的 → 不是深度算法坏了,是它被标记成可透视;
|
|
12
|
-
* 把该对象的 userData.aoTransparent 去掉即可让它参与遮挡。
|
|
13
|
-
*/
|
|
14
|
-
const debugExcludedShader = new ShaderMaterial({
|
|
15
|
-
uniforms: {
|
|
16
|
-
tDepth: { value: null },
|
|
17
|
-
tMask: { value: null },
|
|
18
|
-
},
|
|
19
|
-
vertexShader: `
|
|
20
|
-
${ShaderChunk.common}
|
|
21
|
-
${ShaderChunk.logdepthbuf_pars_vertex}
|
|
22
|
-
varying vec2 vUv;
|
|
23
|
-
void main() {
|
|
24
|
-
vUv = uv;
|
|
25
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
26
|
-
${ShaderChunk.logdepthbuf_vertex}
|
|
27
|
-
}
|
|
28
|
-
`,
|
|
29
|
-
fragmentShader: `
|
|
30
|
-
${ShaderChunk.logdepthbuf_pars_fragment}
|
|
31
|
-
uniform sampler2D tDepth;
|
|
32
|
-
uniform sampler2D tMask;
|
|
33
|
-
varying vec2 vUv;
|
|
34
|
-
void main() {
|
|
35
|
-
float d = texture2D(tDepth, vUv).r;
|
|
36
|
-
float mask = texture2D(tMask, vUv).r;
|
|
37
|
-
// 灰度深度 + 被排除面叠红(mask 为纯红,取 r 通道即可)
|
|
38
|
-
vec3 col = vec3(d, d, d);
|
|
39
|
-
col = mix(col, vec3(1.0, 0.15, 0.15), mask * 0.85);
|
|
40
|
-
gl_FragColor = vec4(col, 1.0);
|
|
41
|
-
${ShaderChunk.logdepthbuf_fragment}
|
|
42
|
-
}
|
|
43
|
-
`,
|
|
44
|
-
depthTest: false,
|
|
45
|
-
depthWrite: false,
|
|
46
|
-
transparent: true,
|
|
47
|
-
});
|
|
48
|
-
export default debugExcludedShader;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ShaderChunk, ShaderMaterial, Texture } from "three";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 调试用:把「可见深度图」与「被排除面 mask」叠在一起看。
|
|
5
|
-
*
|
|
6
|
-
* 底色 = baseDepthTexture 灰度(近黑远白,同「全局深度图」档);
|
|
7
|
-
* 红色 = 该像素上的表面被 renderVisibleDepthPass 排除(sprite/线条/点、userData.aoTransparent)
|
|
8
|
-
* → **它写不进深度图,永远挡不住任何后处理**。
|
|
9
|
-
* ⚠️ 地板 Ground1 不在此列:2026-10-11 皇上旨「物体的深度都要进深度图」,原 aoFloor 排除特例
|
|
10
|
-
* 已整条拆除,地板现在是正常写深度的实心面(该像素应显示为灰、不是红)。
|
|
11
|
-
*
|
|
12
|
-
* 判读:挡不住你的那个面如果是红的 → 不是深度算法坏了,是它被标记成可透视;
|
|
13
|
-
* 把该对象的 userData.aoTransparent 去掉即可让它参与遮挡。
|
|
14
|
-
*/
|
|
15
|
-
const debugExcludedShader = new ShaderMaterial({
|
|
16
|
-
uniforms: {
|
|
17
|
-
tDepth: { value: null as unknown as Texture },
|
|
18
|
-
tMask: { value: null as unknown as Texture },
|
|
19
|
-
},
|
|
20
|
-
vertexShader: `
|
|
21
|
-
${ShaderChunk.common}
|
|
22
|
-
${ShaderChunk.logdepthbuf_pars_vertex}
|
|
23
|
-
varying vec2 vUv;
|
|
24
|
-
void main() {
|
|
25
|
-
vUv = uv;
|
|
26
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
27
|
-
${ShaderChunk.logdepthbuf_vertex}
|
|
28
|
-
}
|
|
29
|
-
`,
|
|
30
|
-
fragmentShader: `
|
|
31
|
-
${ShaderChunk.logdepthbuf_pars_fragment}
|
|
32
|
-
uniform sampler2D tDepth;
|
|
33
|
-
uniform sampler2D tMask;
|
|
34
|
-
varying vec2 vUv;
|
|
35
|
-
void main() {
|
|
36
|
-
float d = texture2D(tDepth, vUv).r;
|
|
37
|
-
float mask = texture2D(tMask, vUv).r;
|
|
38
|
-
// 灰度深度 + 被排除面叠红(mask 为纯红,取 r 通道即可)
|
|
39
|
-
vec3 col = vec3(d, d, d);
|
|
40
|
-
col = mix(col, vec3(1.0, 0.15, 0.15), mask * 0.85);
|
|
41
|
-
gl_FragColor = vec4(col, 1.0);
|
|
42
|
-
${ShaderChunk.logdepthbuf_fragment}
|
|
43
|
-
}
|
|
44
|
-
`,
|
|
45
|
-
depthTest: false,
|
|
46
|
-
depthWrite: false,
|
|
47
|
-
transparent: true,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export default debugExcludedShader;
|