@call-me-sensei/toonlab 0.1.1
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/ATTRIBUTION.md +40 -0
- package/LICENSE +21 -0
- package/README.md +125 -0
- package/package.json +97 -0
- package/src/character/characterRig.js +353 -0
- package/src/character/freestyleSwimClip.js +541 -0
- package/src/character/index.js +4 -0
- package/src/character/modelLoader.js +433 -0
- package/src/core/materialRoles.js +438 -0
- package/src/core/presetDocuments.js +110 -0
- package/src/core/shaderBackend.js +24 -0
- package/src/debrisgen/debrisFields.js +544 -0
- package/src/debrisgen/debrisGenerator.js +1929 -0
- package/src/debrisgen/debrisPalettes.js +71 -0
- package/src/debrisgen/debrisPhysics.js +198 -0
- package/src/debrisgen/debrisPresets.js +155 -0
- package/src/debrisgen/debrisSettings.js +333 -0
- package/src/debrisgen/debrisTextures.js +380 -0
- package/src/debrisgen/index.js +5 -0
- package/src/debug/fieldValues.js +95 -0
- package/src/debug/index.js +7 -0
- package/src/debug/settingsPanel.js +170 -0
- package/src/environment/environmentAmbientProbe.js +160 -0
- package/src/environment/environmentMaterialAdapter.js +336 -0
- package/src/environment/environmentMaterialClassifier.js +178 -0
- package/src/environment/environmentPlanarReflection.js +201 -0
- package/src/environment/environmentPresets.js +443 -0
- package/src/environment/environmentRigs.js +684 -0
- package/src/environment/environmentSettings.js +504 -0
- package/src/environment/environmentShaderMaterials.js +318 -0
- package/src/environment/environmentSunShadowPass.js +268 -0
- package/src/environment/environmentTextureResolver.js +161 -0
- package/src/environment/environmentTimeOfDay.js +167 -0
- package/src/environment/environmentVertexAo.js +188 -0
- package/src/environment/index.js +8 -0
- package/src/environment/scanAssetStylize.js +103 -0
- package/src/index.js +21 -0
- package/src/loaders/index.js +1 -0
- package/src/post/index.js +2 -0
- package/src/post/postProcessing.js +1087 -0
- package/src/rockgen/export/glbExport.js +177 -0
- package/src/rockgen/heightfield/heightfieldErosion.js +7 -0
- package/src/rockgen/heightfield/heightfieldPatch.js +183 -0
- package/src/rockgen/heightfield/stylizedErosionSim.js +356 -0
- package/src/rockgen/index.js +14 -0
- package/src/rockgen/mesh/meshAttributes.js +374 -0
- package/src/rockgen/mesh/meshDocument.js +158 -0
- package/src/rockgen/mesh/surfaceNets.js +329 -0
- package/src/rockgen/noise/cellularNoise3.js +92 -0
- package/src/rockgen/noise/prng.js +62 -0
- package/src/rockgen/noise/simplexNoise3.js +89 -0
- package/src/rockgen/noise/valueNoise3.js +87 -0
- package/src/rockgen/rockDocument.js +255 -0
- package/src/rockgen/rockHelpers.js +8 -0
- package/src/rockgen/rockgenPresets.js +559 -0
- package/src/rockgen/rockgenSettings.js +756 -0
- package/src/rockgen/sdf/fieldCompiler.js +544 -0
- package/src/rockgen/sdf/sculptEdits.js +66 -0
- package/src/rockgen/sdf/sdfModifiers.js +45 -0
- package/src/rockgen/sdf/sdfOps.js +37 -0
- package/src/rockgen/sdf/sdfPrimitives.js +88 -0
- package/src/shaders-tsl/anime.js +963 -0
- package/src/shaders-tsl/chunks/character-color.js +64 -0
- package/src/shaders-tsl/chunks/character-highlights.js +174 -0
- package/src/shaders-tsl/chunks/character-lighting.js +309 -0
- package/src/shaders-tsl/chunks/character-material-maps.js +146 -0
- package/src/shaders-tsl/chunks/character-roles.js +52 -0
- package/src/shaders-tsl/chunks/character-scene-lights.js +270 -0
- package/src/shaders-tsl/chunks/character-shadow-color.js +61 -0
- package/src/shaders-tsl/chunks/character-skinning.js +140 -0
- package/src/shaders-tsl/chunks/environment-color.js +47 -0
- package/src/shaders-tsl/chunks/environment-debug.js +79 -0
- package/src/shaders-tsl/chunks/environment-lighting.js +260 -0
- package/src/shaders-tsl/chunks/environment-sun-shadow.js +87 -0
- package/src/shaders-tsl/chunks/foliage-fog.js +60 -0
- package/src/shaders-tsl/chunks/pass-depth-color.js +89 -0
- package/src/shaders-tsl/chunks/stylized-cloud-shadow.js +70 -0
- package/src/shaders-tsl/chunks/water-color.js +190 -0
- package/src/shaders-tsl/chunks/water-common.js +124 -0
- package/src/shaders-tsl/chunks/water-foam.js +93 -0
- package/src/shaders-tsl/chunks/water-lighting.js +116 -0
- package/src/shaders-tsl/chunks/water-ripple.js +64 -0
- package/src/shaders-tsl/chunks/water-waves.js +100 -0
- package/src/shaders-tsl/environment-ao-overlay.js +60 -0
- package/src/shaders-tsl/environment.js +680 -0
- package/src/shaders-tsl/flower.js +267 -0
- package/src/shaders-tsl/grass.js +193 -0
- package/src/shaders-tsl/post-composite.js +461 -0
- package/src/shaders-tsl/sky.js +175 -0
- package/src/shaders-tsl/tree-leaf.js +264 -0
- package/src/shaders-tsl/water-breaker.js +423 -0
- package/src/shaders-tsl/water-kelp.js +171 -0
- package/src/shaders-tsl/water-rain.js +107 -0
- package/src/shaders-tsl/water-simulation.js +140 -0
- package/src/shaders-tsl/water-splash.js +298 -0
- package/src/shaders-tsl/water.js +509 -0
- package/src/sky/index.js +2 -0
- package/src/sky/stylizedSky.js +341 -0
- package/src/toon/characterRenderPasses.js +646 -0
- package/src/toon/index.js +4 -0
- package/src/toon/settings/alphaSettings.js +170 -0
- package/src/toon/settings/averageShadowSettings.js +181 -0
- package/src/toon/settings/baseTextureSettings.js +133 -0
- package/src/toon/settings/celShadeSettings.js +96 -0
- package/src/toon/settings/contactShadowSettings.js +114 -0
- package/src/toon/settings/eyeHighlightSettings.js +187 -0
- package/src/toon/settings/faceLightingSettings.js +135 -0
- package/src/toon/settings/furSettings.js +112 -0
- package/src/toon/settings/glitterSettings.js +102 -0
- package/src/toon/settings/hairHighlightSettings.js +325 -0
- package/src/toon/settings/indirectLightSettings.js +244 -0
- package/src/toon/settings/localLightSettings.js +176 -0
- package/src/toon/settings/materialMapSettings.js +299 -0
- package/src/toon/settings/outlineSettings.js +263 -0
- package/src/toon/settings/perspectiveRemovalSettings.js +60 -0
- package/src/toon/settings/rimLightSettings.js +268 -0
- package/src/toon/settings/sceneShadowSettings.js +147 -0
- package/src/toon/settings/selfShadowSettings.js +221 -0
- package/src/toon/settings/shadowColorSettings.js +238 -0
- package/src/toon/settings/skinToneSettings.js +150 -0
- package/src/toon/settings/specularSettings.js +314 -0
- package/src/toon/settings/stickerSettings.js +102 -0
- package/src/toon/toonMaterialAdapter.js +2235 -0
- package/src/toon/toonSettings.js +860 -0
- package/src/vegetation/flowerSpecies.js +260 -0
- package/src/vegetation/index.js +10 -0
- package/src/vegetation/stylizedBush.js +136 -0
- package/src/vegetation/stylizedFlower.js +213 -0
- package/src/vegetation/stylizedFlowers.js +297 -0
- package/src/vegetation/stylizedGrass.js +491 -0
- package/src/vegetation/stylizedTree.js +2449 -0
- package/src/vegetation/stylizedTreeFoliage.js +691 -0
- package/src/vegetation/treeExport.js +300 -0
- package/src/vegetation/treeRecipe.js +647 -0
- package/src/water/index.js +2 -0
- package/src/water/water.js +20 -0
- package/src/water/waterBreakerSystem.js +591 -0
- package/src/water/waterInteraction.js +193 -0
- package/src/water/waterMaterial.js +263 -0
- package/src/water/waterRain.js +136 -0
- package/src/water/waterRippleSimulation.js +227 -0
- package/src/water/waterScenePasses.js +415 -0
- package/src/water/waterSettings.js +1138 -0
- package/src/water/waterSplashSystem.js +251 -0
- package/src/water/waterSurface.js +475 -0
- package/src/water/waterVegetation.js +83 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_OUTLINE_SETTINGS = Object.freeze({
|
|
4
|
+
defaultLightingMix: 0.28,
|
|
5
|
+
defaultMaxBrightness: 0.38,
|
|
6
|
+
defaultMinBrightness: 0.04,
|
|
7
|
+
defaultTintColor: [0.34, 0.33, 0.4],
|
|
8
|
+
defaultWidth: 0.002,
|
|
9
|
+
depthOffset: 0,
|
|
10
|
+
depthTest: true,
|
|
11
|
+
depthWrite: false,
|
|
12
|
+
enabled: true,
|
|
13
|
+
eyeLightingMix: 0.28,
|
|
14
|
+
eyeMaxBrightness: 0.38,
|
|
15
|
+
eyeMinBrightness: 0.04,
|
|
16
|
+
eyeTintColor: [0.34, 0.33, 0.4],
|
|
17
|
+
eyeWidth: 0,
|
|
18
|
+
faceLightingMix: 0.28,
|
|
19
|
+
faceMaxBrightness: 0.48,
|
|
20
|
+
faceMinBrightness: 0.04,
|
|
21
|
+
faceTintColor: [0.62, 0.36, 0.34],
|
|
22
|
+
faceWidth: 0,
|
|
23
|
+
hairCutoutWidth: 0,
|
|
24
|
+
hairLightingMix: 0.08,
|
|
25
|
+
hairMaxBrightness: 0.68,
|
|
26
|
+
hairMinBrightness: 0.085,
|
|
27
|
+
hairTintColor: [0.72, 0.78, 0.9],
|
|
28
|
+
hairWidth: 0.00055,
|
|
29
|
+
maxWidth: 0.006,
|
|
30
|
+
metalLightingMix: 0.28,
|
|
31
|
+
metalMaxBrightness: 0.38,
|
|
32
|
+
metalMinBrightness: 0.04,
|
|
33
|
+
metalTintColor: [0.34, 0.33, 0.4],
|
|
34
|
+
metalWidth: 0.002,
|
|
35
|
+
polygonOffset: false,
|
|
36
|
+
polygonOffsetFactor: 1,
|
|
37
|
+
polygonOffsetUnits: 1,
|
|
38
|
+
// Screen-space width correction: scales the view-space expansion by camera
|
|
39
|
+
// distance and FOV so the outline keeps a consistent on-screen width, then
|
|
40
|
+
// stops growing past widthFadeDistance so far-away characters lose outline
|
|
41
|
+
// weight instead of turning into black blobs. 0 restores the legacy
|
|
42
|
+
// constant view-space offset. referenceDistance/referenceFov define the
|
|
43
|
+
// framing at which configured widths mean what they meant before.
|
|
44
|
+
referenceDistance: 4,
|
|
45
|
+
referenceFov: 40,
|
|
46
|
+
screenSpaceWidth: 1,
|
|
47
|
+
// Average normals across position-duplicate vertices at conversion time so
|
|
48
|
+
// hard-edged geometry (Rigify mannequin, arbitrary GLB) keeps a closed hull.
|
|
49
|
+
smoothNormals: true,
|
|
50
|
+
widthFadeDistance: 12,
|
|
51
|
+
skinLightingMix: 0.28,
|
|
52
|
+
skinMaxBrightness: 0.48,
|
|
53
|
+
skinMinBrightness: 0.04,
|
|
54
|
+
skinTintColor: [0.62, 0.36, 0.34],
|
|
55
|
+
skinWidth: 0.001,
|
|
56
|
+
transparentOverlayWidth: 0,
|
|
57
|
+
widthScale: 1,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function firstDefined(source, keys) {
|
|
61
|
+
for (const key of keys) {
|
|
62
|
+
if (source?.[key] !== undefined) return source[key];
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function numberOption(value, fallback, { min = -Infinity, max = Infinity } = {}) {
|
|
68
|
+
const nextValue = Number(value);
|
|
69
|
+
if (!Number.isFinite(nextValue)) return fallback;
|
|
70
|
+
return Math.min(max, Math.max(min, nextValue));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function colorOption(value, fallback) {
|
|
74
|
+
if (value?.isColor) return value.clone();
|
|
75
|
+
|
|
76
|
+
if (Array.isArray(value) && value.length >= 3) {
|
|
77
|
+
return new THREE.Color(
|
|
78
|
+
numberOption(value[0], fallback[0] ?? fallback.r ?? 1),
|
|
79
|
+
numberOption(value[1], fallback[1] ?? fallback.g ?? 1),
|
|
80
|
+
numberOption(value[2], fallback[2] ?? fallback.b ?? 1),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (typeof value === 'object' && value !== null) {
|
|
85
|
+
return new THREE.Color(
|
|
86
|
+
numberOption(value.r ?? value.x, fallback[0] ?? fallback.r ?? 1),
|
|
87
|
+
numberOption(value.g ?? value.y, fallback[1] ?? fallback.g ?? 1),
|
|
88
|
+
numberOption(value.b ?? value.z, fallback[2] ?? fallback.b ?? 1),
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
93
|
+
try {
|
|
94
|
+
return new THREE.Color(value);
|
|
95
|
+
} catch {
|
|
96
|
+
// Fall through to fallback.
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return Array.isArray(fallback)
|
|
101
|
+
? new THREE.Color(fallback[0], fallback[1], fallback[2])
|
|
102
|
+
: fallback.clone();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function enabledOption(value) {
|
|
106
|
+
if (typeof value === 'string') {
|
|
107
|
+
const normalized = value.trim().toLowerCase();
|
|
108
|
+
return normalized !== 'off' && normalized !== 'none' && normalized !== 'false' && normalized !== '0';
|
|
109
|
+
}
|
|
110
|
+
return value !== false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function normalizeOutlineOptions(options) {
|
|
114
|
+
if (options === false) return { enabled: false };
|
|
115
|
+
if (options === true) return { enabled: true };
|
|
116
|
+
if (typeof options === 'string') return { enabled: enabledOption(options) };
|
|
117
|
+
return options || {};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function roleNumber(source, role, property, fallback, aliases = [], bounds = {}) {
|
|
121
|
+
const rolePrefix = role ? `${role}${property[0].toUpperCase()}${property.slice(1)}` : property;
|
|
122
|
+
return numberOption(firstDefined(source, [rolePrefix, ...aliases]), fallback, bounds);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function roleColor(source, role, property, fallback, aliases = []) {
|
|
126
|
+
const rolePrefix = role ? `${role}${property[0].toUpperCase()}${property.slice(1)}` : property;
|
|
127
|
+
return colorOption(firstDefined(source, [rolePrefix, ...aliases]), fallback);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function roleValue(settings, role, property, fallback) {
|
|
131
|
+
return settings[`${role}${property[0].toUpperCase()}${property.slice(1)}`] ?? fallback;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function createOutlineSettings(options = null) {
|
|
135
|
+
const source = normalizeOutlineOptions(options);
|
|
136
|
+
const enabled = enabledOption(source.enabled);
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
defaultLightingMix: enabled
|
|
140
|
+
? roleNumber(source, 'default', 'lightingMix', DEFAULT_OUTLINE_SETTINGS.defaultLightingMix, ['lightingMix'], { min: 0, max: 1 })
|
|
141
|
+
: DEFAULT_OUTLINE_SETTINGS.defaultLightingMix,
|
|
142
|
+
defaultMaxBrightness: roleNumber(source, 'default', 'maxBrightness', DEFAULT_OUTLINE_SETTINGS.defaultMaxBrightness, ['maxBrightness'], { min: 0, max: 2 }),
|
|
143
|
+
defaultMinBrightness: roleNumber(source, 'default', 'minBrightness', DEFAULT_OUTLINE_SETTINGS.defaultMinBrightness, ['minBrightness'], { min: 0, max: 2 }),
|
|
144
|
+
defaultTintColor: roleColor(source, 'default', 'tintColor', DEFAULT_OUTLINE_SETTINGS.defaultTintColor, ['tintColor', 'color']),
|
|
145
|
+
defaultWidth: enabled
|
|
146
|
+
? roleNumber(source, 'default', 'width', DEFAULT_OUTLINE_SETTINGS.defaultWidth, ['width', 'thickness'], { min: 0, max: 0.05 })
|
|
147
|
+
: 0,
|
|
148
|
+
depthOffset: enabled
|
|
149
|
+
? numberOption(firstDefined(source, ['depthOffset', 'zOffset', 'viewDepthOffset']), DEFAULT_OUTLINE_SETTINGS.depthOffset, { min: 0, max: 0.05 })
|
|
150
|
+
: 0,
|
|
151
|
+
depthTest: source.depthTest !== undefined ? enabledOption(source.depthTest) : DEFAULT_OUTLINE_SETTINGS.depthTest,
|
|
152
|
+
depthWrite: source.depthWrite !== undefined ? enabledOption(source.depthWrite) : DEFAULT_OUTLINE_SETTINGS.depthWrite,
|
|
153
|
+
enabled,
|
|
154
|
+
eyeLightingMix: enabled ? roleNumber(source, 'eye', 'lightingMix', DEFAULT_OUTLINE_SETTINGS.eyeLightingMix, [], { min: 0, max: 1 }) : DEFAULT_OUTLINE_SETTINGS.eyeLightingMix,
|
|
155
|
+
eyeMaxBrightness: roleNumber(source, 'eye', 'maxBrightness', DEFAULT_OUTLINE_SETTINGS.eyeMaxBrightness, [], { min: 0, max: 2 }),
|
|
156
|
+
eyeMinBrightness: roleNumber(source, 'eye', 'minBrightness', DEFAULT_OUTLINE_SETTINGS.eyeMinBrightness, [], { min: 0, max: 2 }),
|
|
157
|
+
eyeTintColor: roleColor(source, 'eye', 'tintColor', DEFAULT_OUTLINE_SETTINGS.eyeTintColor),
|
|
158
|
+
eyeWidth: enabled ? roleNumber(source, 'eye', 'width', DEFAULT_OUTLINE_SETTINGS.eyeWidth, [], { min: 0, max: 0.05 }) : 0,
|
|
159
|
+
faceLightingMix: enabled ? roleNumber(source, 'face', 'lightingMix', DEFAULT_OUTLINE_SETTINGS.faceLightingMix, [], { min: 0, max: 1 }) : DEFAULT_OUTLINE_SETTINGS.faceLightingMix,
|
|
160
|
+
faceMaxBrightness: roleNumber(source, 'face', 'maxBrightness', DEFAULT_OUTLINE_SETTINGS.faceMaxBrightness, [], { min: 0, max: 2 }),
|
|
161
|
+
faceMinBrightness: roleNumber(source, 'face', 'minBrightness', DEFAULT_OUTLINE_SETTINGS.faceMinBrightness, [], { min: 0, max: 2 }),
|
|
162
|
+
faceTintColor: roleColor(source, 'face', 'tintColor', DEFAULT_OUTLINE_SETTINGS.faceTintColor),
|
|
163
|
+
faceWidth: enabled ? roleNumber(source, 'face', 'width', DEFAULT_OUTLINE_SETTINGS.faceWidth, [], { min: 0, max: 0.05 }) : 0,
|
|
164
|
+
hairCutoutWidth: enabled
|
|
165
|
+
? numberOption(firstDefined(source, ['hairCutoutWidth', 'hairCardWidth', 'hairAlphaWidth']), DEFAULT_OUTLINE_SETTINGS.hairCutoutWidth, { min: 0, max: 0.05 })
|
|
166
|
+
: 0,
|
|
167
|
+
hairLightingMix: enabled ? roleNumber(source, 'hair', 'lightingMix', DEFAULT_OUTLINE_SETTINGS.hairLightingMix, [], { min: 0, max: 1 }) : DEFAULT_OUTLINE_SETTINGS.hairLightingMix,
|
|
168
|
+
hairMaxBrightness: roleNumber(source, 'hair', 'maxBrightness', DEFAULT_OUTLINE_SETTINGS.hairMaxBrightness, [], { min: 0, max: 2 }),
|
|
169
|
+
hairMinBrightness: roleNumber(source, 'hair', 'minBrightness', DEFAULT_OUTLINE_SETTINGS.hairMinBrightness, [], { min: 0, max: 2 }),
|
|
170
|
+
hairTintColor: roleColor(source, 'hair', 'tintColor', DEFAULT_OUTLINE_SETTINGS.hairTintColor),
|
|
171
|
+
hairWidth: enabled ? roleNumber(source, 'hair', 'width', DEFAULT_OUTLINE_SETTINGS.hairWidth, [], { min: 0, max: 0.05 }) : 0,
|
|
172
|
+
maxWidth: numberOption(firstDefined(source, ['maxWidth', 'maxThickness']), DEFAULT_OUTLINE_SETTINGS.maxWidth, { min: 0, max: 0.05 }),
|
|
173
|
+
metalLightingMix: enabled ? roleNumber(source, 'metal', 'lightingMix', DEFAULT_OUTLINE_SETTINGS.metalLightingMix, [], { min: 0, max: 1 }) : DEFAULT_OUTLINE_SETTINGS.metalLightingMix,
|
|
174
|
+
metalMaxBrightness: roleNumber(source, 'metal', 'maxBrightness', DEFAULT_OUTLINE_SETTINGS.metalMaxBrightness, [], { min: 0, max: 2 }),
|
|
175
|
+
metalMinBrightness: roleNumber(source, 'metal', 'minBrightness', DEFAULT_OUTLINE_SETTINGS.metalMinBrightness, [], { min: 0, max: 2 }),
|
|
176
|
+
metalTintColor: roleColor(source, 'metal', 'tintColor', DEFAULT_OUTLINE_SETTINGS.metalTintColor),
|
|
177
|
+
metalWidth: enabled ? roleNumber(source, 'metal', 'width', DEFAULT_OUTLINE_SETTINGS.metalWidth, [], { min: 0, max: 0.05 }) : 0,
|
|
178
|
+
polygonOffset: source.polygonOffset === true,
|
|
179
|
+
polygonOffsetFactor: numberOption(firstDefined(source, ['polygonOffsetFactor']), DEFAULT_OUTLINE_SETTINGS.polygonOffsetFactor, { min: -64, max: 64 }),
|
|
180
|
+
polygonOffsetUnits: numberOption(firstDefined(source, ['polygonOffsetUnits']), DEFAULT_OUTLINE_SETTINGS.polygonOffsetUnits, { min: -1024, max: 1024 }),
|
|
181
|
+
referenceDistance: numberOption(
|
|
182
|
+
firstDefined(source, ['referenceDistance', 'widthReferenceDistance']),
|
|
183
|
+
DEFAULT_OUTLINE_SETTINGS.referenceDistance,
|
|
184
|
+
{ min: 0.1, max: 100 },
|
|
185
|
+
),
|
|
186
|
+
referenceFov: numberOption(
|
|
187
|
+
firstDefined(source, ['referenceFov', 'widthReferenceFov']),
|
|
188
|
+
DEFAULT_OUTLINE_SETTINGS.referenceFov,
|
|
189
|
+
{ min: 5, max: 150 },
|
|
190
|
+
),
|
|
191
|
+
screenSpaceWidth: numberOption(
|
|
192
|
+
firstDefined(source, ['screenSpaceWidth', 'screenSpaceWidthFix', 'widthDistanceFix']),
|
|
193
|
+
DEFAULT_OUTLINE_SETTINGS.screenSpaceWidth,
|
|
194
|
+
{ min: 0, max: 1 },
|
|
195
|
+
),
|
|
196
|
+
smoothNormals: firstDefined(source, ['smoothNormals', 'smoothedNormals', 'bakeSmoothNormals']) !== false,
|
|
197
|
+
widthFadeDistance: numberOption(
|
|
198
|
+
firstDefined(source, ['widthFadeDistance', 'maxWidthDistance', 'fadeDistance']),
|
|
199
|
+
DEFAULT_OUTLINE_SETTINGS.widthFadeDistance,
|
|
200
|
+
{ min: 0.5, max: 200 },
|
|
201
|
+
),
|
|
202
|
+
skinLightingMix: enabled ? roleNumber(source, 'skin', 'lightingMix', DEFAULT_OUTLINE_SETTINGS.skinLightingMix, [], { min: 0, max: 1 }) : DEFAULT_OUTLINE_SETTINGS.skinLightingMix,
|
|
203
|
+
skinMaxBrightness: roleNumber(source, 'skin', 'maxBrightness', DEFAULT_OUTLINE_SETTINGS.skinMaxBrightness, [], { min: 0, max: 2 }),
|
|
204
|
+
skinMinBrightness: roleNumber(source, 'skin', 'minBrightness', DEFAULT_OUTLINE_SETTINGS.skinMinBrightness, [], { min: 0, max: 2 }),
|
|
205
|
+
skinTintColor: roleColor(source, 'skin', 'tintColor', DEFAULT_OUTLINE_SETTINGS.skinTintColor),
|
|
206
|
+
skinWidth: enabled ? roleNumber(source, 'skin', 'width', DEFAULT_OUTLINE_SETTINGS.skinWidth, [], { min: 0, max: 0.05 }) : 0,
|
|
207
|
+
transparentOverlayWidth: enabled
|
|
208
|
+
? numberOption(firstDefined(source, ['transparentOverlayWidth', 'overlayWidth', 'decalWidth']), DEFAULT_OUTLINE_SETTINGS.transparentOverlayWidth, { min: 0, max: 0.05 })
|
|
209
|
+
: 0,
|
|
210
|
+
widthScale: enabled
|
|
211
|
+
? numberOption(firstDefined(source, ['widthScale', 'scale', 'thicknessScale']), DEFAULT_OUTLINE_SETTINGS.widthScale, { min: 0, max: 20 })
|
|
212
|
+
: 0,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function resolveOutlineForMaterial(settings, {
|
|
217
|
+
alphaTest = -1,
|
|
218
|
+
isEye = false,
|
|
219
|
+
isFace = false,
|
|
220
|
+
isHair = false,
|
|
221
|
+
isMetal = false,
|
|
222
|
+
isSkin = false,
|
|
223
|
+
isTransparentOverlay = false,
|
|
224
|
+
} = {}) {
|
|
225
|
+
let role = 'default';
|
|
226
|
+
if (isEye) role = 'eye';
|
|
227
|
+
else if (isFace) role = 'face';
|
|
228
|
+
else if (isSkin) role = 'skin';
|
|
229
|
+
else if (isHair) role = 'hair';
|
|
230
|
+
else if (isMetal) role = 'metal';
|
|
231
|
+
|
|
232
|
+
let width = role === 'hair' && alphaTest >= 0
|
|
233
|
+
? settings.hairCutoutWidth
|
|
234
|
+
: roleValue(settings, role, 'width', settings.defaultWidth);
|
|
235
|
+
|
|
236
|
+
if (isTransparentOverlay) {
|
|
237
|
+
width = settings.transparentOverlayWidth;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
width = Math.min(settings.maxWidth, Math.max(0, width * settings.widthScale));
|
|
241
|
+
|
|
242
|
+
return {
|
|
243
|
+
depthOffset: settings.depthOffset,
|
|
244
|
+
depthTest: settings.depthTest,
|
|
245
|
+
depthWrite: settings.depthWrite,
|
|
246
|
+
enabled: settings.enabled && width > 0,
|
|
247
|
+
lightingMix: roleValue(settings, role, 'lightingMix', settings.defaultLightingMix),
|
|
248
|
+
maxBrightness: roleValue(settings, role, 'maxBrightness', settings.defaultMaxBrightness),
|
|
249
|
+
minBrightness: roleValue(settings, role, 'minBrightness', settings.defaultMinBrightness),
|
|
250
|
+
polygonOffset: settings.polygonOffset,
|
|
251
|
+
polygonOffsetFactor: settings.polygonOffsetFactor,
|
|
252
|
+
polygonOffsetUnits: settings.polygonOffsetUnits,
|
|
253
|
+
referenceDistance: settings.referenceDistance,
|
|
254
|
+
referenceFov: settings.referenceFov,
|
|
255
|
+
screenSpaceWidth: settings.screenSpaceWidth,
|
|
256
|
+
smoothNormals: settings.smoothNormals,
|
|
257
|
+
widthFadeDistance: settings.widthFadeDistance,
|
|
258
|
+
skinTintColor: settings.skinTintColor,
|
|
259
|
+
skinTintStrength: 1,
|
|
260
|
+
tintColor: roleValue(settings, role, 'tintColor', settings.defaultTintColor),
|
|
261
|
+
width,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Perspective removal (portrait flattening).
|
|
2
|
+
//
|
|
3
|
+
// Re-divides the clip-space XY of vertices near the character's head by the
|
|
4
|
+
// head center's view depth instead of their own W, progressively removing
|
|
5
|
+
// perspective distortion in closeups — the anime-portrait "long lens" look
|
|
6
|
+
// without moving the camera. Masked by a sphere around the tracked head bone
|
|
7
|
+
// and a world-height fade so feet stay grounded in true perspective.
|
|
8
|
+
//
|
|
9
|
+
// Requires the runtime head tracker (characterRenderPasses); inert otherwise.
|
|
10
|
+
// Note: extreme amounts can confuse CPU frustum culling because the GPU moves
|
|
11
|
+
// vertices the CPU cannot see — character meshes in this project already
|
|
12
|
+
// disable frustum culling, so this is safe here.
|
|
13
|
+
|
|
14
|
+
export const DEFAULT_PERSPECTIVE_REMOVAL_SETTINGS = Object.freeze({
|
|
15
|
+
amount: 0,
|
|
16
|
+
enabled: false,
|
|
17
|
+
// Sphere radius (meters) around the head bone that receives the effect.
|
|
18
|
+
radius: 1.4,
|
|
19
|
+
// World-height fade: 0 at startHeight, full at endHeight.
|
|
20
|
+
startHeight: 0,
|
|
21
|
+
endHeight: 1,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
function firstDefined(source, keys) {
|
|
25
|
+
for (const key of keys) {
|
|
26
|
+
if (source?.[key] !== undefined) return source[key];
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function numberOption(value, fallback, { min = -Infinity, max = Infinity } = {}) {
|
|
32
|
+
const nextValue = Number(value);
|
|
33
|
+
if (!Number.isFinite(nextValue)) return fallback;
|
|
34
|
+
return Math.min(max, Math.max(min, nextValue));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function normalizePerspectiveRemovalOptions(options) {
|
|
38
|
+
if (options === false) return { enabled: false };
|
|
39
|
+
if (options === true) return { enabled: true };
|
|
40
|
+
if (typeof options === 'number') return { amount: options, enabled: options > 0 };
|
|
41
|
+
return options || {};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function createPerspectiveRemovalSettings(options = null) {
|
|
45
|
+
const source = normalizePerspectiveRemovalOptions(options);
|
|
46
|
+
const requestedAmount = numberOption(
|
|
47
|
+
firstDefined(source, ['amount', 'strength', 'perspectiveRemovalAmount']),
|
|
48
|
+
DEFAULT_PERSPECTIVE_REMOVAL_SETTINGS.amount,
|
|
49
|
+
{ min: 0, max: 1 },
|
|
50
|
+
);
|
|
51
|
+
const enabled = source.enabled === true || (source.enabled !== false && requestedAmount > 0);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
amount: enabled ? requestedAmount : 0,
|
|
55
|
+
enabled: enabled && requestedAmount > 0,
|
|
56
|
+
endHeight: numberOption(firstDefined(source, ['endHeight']), DEFAULT_PERSPECTIVE_REMOVAL_SETTINGS.endHeight, { min: -100, max: 1000 }),
|
|
57
|
+
radius: numberOption(firstDefined(source, ['radius']), DEFAULT_PERSPECTIVE_REMOVAL_SETTINGS.radius, { min: 0.05, max: 50 }),
|
|
58
|
+
startHeight: numberOption(firstDefined(source, ['startHeight']), DEFAULT_PERSPECTIVE_REMOVAL_SETTINGS.startHeight, { min: -100, max: 1000 }),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
export const RIM_LIGHT_MODES = Object.freeze({
|
|
4
|
+
fresnel: 'fresnel',
|
|
5
|
+
depthTexture: 'depthTexture',
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const RIM_LIGHT_MODE_VALUES = Object.freeze({
|
|
9
|
+
[RIM_LIGHT_MODES.fresnel]: 0,
|
|
10
|
+
[RIM_LIGHT_MODES.depthTexture]: 1,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_RIM_LIGHT_SETTINGS = Object.freeze({
|
|
14
|
+
blockByShadow: 0.65,
|
|
15
|
+
defaultIntensity: 0.13,
|
|
16
|
+
defaultTintColor: [0.82, 0.9, 1.0],
|
|
17
|
+
// Screen-space depth-sampled edge width, relative to the character.
|
|
18
|
+
// Only used in depthTexture mode; falls back to fresnel when no depth
|
|
19
|
+
// prepass is running, so the mode is safe as a default.
|
|
20
|
+
depthCloseWidthReduce: 1,
|
|
21
|
+
depthDottedLineFix: true,
|
|
22
|
+
depthFadeEndDistance: 30,
|
|
23
|
+
depthFadeRange: 1,
|
|
24
|
+
depthFadeStartDistance: 20,
|
|
25
|
+
depthMask3D: false,
|
|
26
|
+
depthSafeDistance: 1,
|
|
27
|
+
depthThresholdOffset: 0,
|
|
28
|
+
depthWidth: 1,
|
|
29
|
+
enabled: true,
|
|
30
|
+
eyeIntensity: 0.04,
|
|
31
|
+
faceIntensity: 0.13,
|
|
32
|
+
hairIntensity: 0.23,
|
|
33
|
+
midPoint: 0.48,
|
|
34
|
+
mixWithBaseMapColor: 0.35,
|
|
35
|
+
mode: RIM_LIGHT_MODES.depthTexture,
|
|
36
|
+
skinIntensity: 0.13,
|
|
37
|
+
softness: 0.1,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
function firstDefined(source, keys) {
|
|
41
|
+
for (const key of keys) {
|
|
42
|
+
if (source?.[key] !== undefined) return source[key];
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function numberOption(value, fallback, { min = -Infinity, max = Infinity } = {}) {
|
|
48
|
+
const nextValue = Number(value);
|
|
49
|
+
if (!Number.isFinite(nextValue)) return fallback;
|
|
50
|
+
return Math.min(max, Math.max(min, nextValue));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function colorOption(value, fallback) {
|
|
54
|
+
if (value?.isColor) return value.clone();
|
|
55
|
+
|
|
56
|
+
if (Array.isArray(value) && value.length >= 3) {
|
|
57
|
+
return new THREE.Color(
|
|
58
|
+
numberOption(value[0], fallback[0] ?? fallback.r ?? 1),
|
|
59
|
+
numberOption(value[1], fallback[1] ?? fallback.g ?? 1),
|
|
60
|
+
numberOption(value[2], fallback[2] ?? fallback.b ?? 1),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (typeof value === 'object' && value !== null) {
|
|
65
|
+
return new THREE.Color(
|
|
66
|
+
numberOption(value.r ?? value.x, fallback[0] ?? fallback.r ?? 1),
|
|
67
|
+
numberOption(value.g ?? value.y, fallback[1] ?? fallback.g ?? 1),
|
|
68
|
+
numberOption(value.b ?? value.z, fallback[2] ?? fallback.b ?? 1),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
73
|
+
try {
|
|
74
|
+
return new THREE.Color(value);
|
|
75
|
+
} catch {
|
|
76
|
+
// Fall through to fallback.
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return Array.isArray(fallback)
|
|
81
|
+
? new THREE.Color(fallback[0], fallback[1], fallback[2])
|
|
82
|
+
: fallback.clone();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function enabledOption(value) {
|
|
86
|
+
if (typeof value === 'string') {
|
|
87
|
+
const normalized = value.trim().toLowerCase();
|
|
88
|
+
return normalized !== 'off' && normalized !== 'none' && normalized !== 'false' && normalized !== '0';
|
|
89
|
+
}
|
|
90
|
+
return value !== false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function normalizeRimLightOptions(options) {
|
|
94
|
+
if (options === false) return { enabled: false };
|
|
95
|
+
if (options === true) return { enabled: true };
|
|
96
|
+
if (typeof options === 'string') return { enabled: enabledOption(options) };
|
|
97
|
+
return options || {};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function roleNumber(source, role, property, fallback, aliases = [], bounds = {}) {
|
|
101
|
+
const rolePrefix = role ? `${role}${property[0].toUpperCase()}${property.slice(1)}` : property;
|
|
102
|
+
return numberOption(firstDefined(source, [rolePrefix, ...aliases]), fallback, bounds);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function rimModeOption(value, fallback) {
|
|
106
|
+
const key = String(value ?? '')
|
|
107
|
+
.trim()
|
|
108
|
+
.replace(/[\s_-]+/g, '')
|
|
109
|
+
.toLowerCase();
|
|
110
|
+
if (['depth', 'depthtexture', 'depthtex', 'screenspace', '2d'].includes(key)) {
|
|
111
|
+
return RIM_LIGHT_MODES.depthTexture;
|
|
112
|
+
}
|
|
113
|
+
if (['fresnel', 'classic', 'nov', '3d', 'legacy'].includes(key)) {
|
|
114
|
+
return RIM_LIGHT_MODES.fresnel;
|
|
115
|
+
}
|
|
116
|
+
return fallback;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function createRimLightSettings(options = null) {
|
|
120
|
+
const source = normalizeRimLightOptions(options);
|
|
121
|
+
const enabled = enabledOption(source.enabled);
|
|
122
|
+
const defaultIntensity = enabled
|
|
123
|
+
? roleNumber(
|
|
124
|
+
source,
|
|
125
|
+
'default',
|
|
126
|
+
'intensity',
|
|
127
|
+
DEFAULT_RIM_LIGHT_SETTINGS.defaultIntensity,
|
|
128
|
+
['intensity', 'rimIntensity'],
|
|
129
|
+
{ min: 0, max: 8 },
|
|
130
|
+
)
|
|
131
|
+
: 0;
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
blockByShadow: enabled
|
|
135
|
+
? roleNumber(
|
|
136
|
+
source,
|
|
137
|
+
'',
|
|
138
|
+
'blockByShadow',
|
|
139
|
+
DEFAULT_RIM_LIGHT_SETTINGS.blockByShadow,
|
|
140
|
+
['rimBlockByShadow', 'shadowBlocking', 'shadowBlock'],
|
|
141
|
+
{ min: 0, max: 1 },
|
|
142
|
+
)
|
|
143
|
+
: 0,
|
|
144
|
+
defaultIntensity,
|
|
145
|
+
defaultTintColor: colorOption(
|
|
146
|
+
firstDefined(source, ['tintColor', 'color', 'rimTintColor', 'defaultTintColor']),
|
|
147
|
+
DEFAULT_RIM_LIGHT_SETTINGS.defaultTintColor,
|
|
148
|
+
),
|
|
149
|
+
depthCloseWidthReduce: numberOption(
|
|
150
|
+
firstDefined(source, ['depthCloseWidthReduce', 'closeWidthReduce']),
|
|
151
|
+
DEFAULT_RIM_LIGHT_SETTINGS.depthCloseWidthReduce,
|
|
152
|
+
{ min: 0, max: 1 },
|
|
153
|
+
),
|
|
154
|
+
depthDottedLineFix: firstDefined(source, ['depthDottedLineFix', 'dottedLineFix']) !== false,
|
|
155
|
+
depthFadeEndDistance: numberOption(
|
|
156
|
+
firstDefined(source, ['depthFadeEndDistance']),
|
|
157
|
+
DEFAULT_RIM_LIGHT_SETTINGS.depthFadeEndDistance,
|
|
158
|
+
{ min: 0, max: 200 },
|
|
159
|
+
),
|
|
160
|
+
depthFadeRange: numberOption(
|
|
161
|
+
firstDefined(source, ['depthFadeRange', 'depthRimFadeRange']),
|
|
162
|
+
DEFAULT_RIM_LIGHT_SETTINGS.depthFadeRange,
|
|
163
|
+
{ min: 0.01, max: 20 },
|
|
164
|
+
),
|
|
165
|
+
depthFadeStartDistance: numberOption(
|
|
166
|
+
firstDefined(source, ['depthFadeStartDistance']),
|
|
167
|
+
DEFAULT_RIM_LIGHT_SETTINGS.depthFadeStartDistance,
|
|
168
|
+
{ min: 0, max: 200 },
|
|
169
|
+
),
|
|
170
|
+
depthMask3D: firstDefined(source, ['depthMask3D', 'mask3D']) === true,
|
|
171
|
+
depthSafeDistance: numberOption(
|
|
172
|
+
firstDefined(source, ['depthSafeDistance', 'safeViewDistance']),
|
|
173
|
+
DEFAULT_RIM_LIGHT_SETTINGS.depthSafeDistance,
|
|
174
|
+
{ min: 0.05, max: 10 },
|
|
175
|
+
),
|
|
176
|
+
depthThresholdOffset: numberOption(
|
|
177
|
+
firstDefined(source, ['depthThresholdOffset', 'depthRimThresholdOffset']),
|
|
178
|
+
DEFAULT_RIM_LIGHT_SETTINGS.depthThresholdOffset,
|
|
179
|
+
{ min: -0.05, max: 1 },
|
|
180
|
+
),
|
|
181
|
+
depthWidth: numberOption(
|
|
182
|
+
firstDefined(source, ['depthWidth', 'depthRimWidth']),
|
|
183
|
+
DEFAULT_RIM_LIGHT_SETTINGS.depthWidth,
|
|
184
|
+
{ min: 0, max: 8 },
|
|
185
|
+
),
|
|
186
|
+
enabled,
|
|
187
|
+
eyeIntensity: enabled
|
|
188
|
+
? roleNumber(source, 'eye', 'intensity', DEFAULT_RIM_LIGHT_SETTINGS.eyeIntensity, [], { min: 0, max: 8 })
|
|
189
|
+
: 0,
|
|
190
|
+
faceIntensity: enabled
|
|
191
|
+
? roleNumber(source, 'face', 'intensity', DEFAULT_RIM_LIGHT_SETTINGS.faceIntensity, [], { min: 0, max: 8 })
|
|
192
|
+
: 0,
|
|
193
|
+
hairIntensity: enabled
|
|
194
|
+
? roleNumber(source, 'hair', 'intensity', DEFAULT_RIM_LIGHT_SETTINGS.hairIntensity, [], { min: 0, max: 8 })
|
|
195
|
+
: 0,
|
|
196
|
+
midPoint: enabled
|
|
197
|
+
? roleNumber(
|
|
198
|
+
source,
|
|
199
|
+
'',
|
|
200
|
+
'midPoint',
|
|
201
|
+
DEFAULT_RIM_LIGHT_SETTINGS.midPoint,
|
|
202
|
+
['rimMidPoint', 'threshold', 'rimThreshold'],
|
|
203
|
+
{ min: 0, max: 1 },
|
|
204
|
+
)
|
|
205
|
+
: DEFAULT_RIM_LIGHT_SETTINGS.midPoint,
|
|
206
|
+
mixWithBaseMapColor: enabled
|
|
207
|
+
? roleNumber(
|
|
208
|
+
source,
|
|
209
|
+
'',
|
|
210
|
+
'mixWithBaseMapColor',
|
|
211
|
+
DEFAULT_RIM_LIGHT_SETTINGS.mixWithBaseMapColor,
|
|
212
|
+
['rimMixWithBaseMapColor', 'albedoMix', 'baseColorMix'],
|
|
213
|
+
{ min: 0, max: 1 },
|
|
214
|
+
)
|
|
215
|
+
: 0,
|
|
216
|
+
mode: rimModeOption(
|
|
217
|
+
firstDefined(source, ['mode', 'rimMode', 'technique']),
|
|
218
|
+
DEFAULT_RIM_LIGHT_SETTINGS.mode,
|
|
219
|
+
),
|
|
220
|
+
skinIntensity: enabled
|
|
221
|
+
? roleNumber(source, 'skin', 'intensity', DEFAULT_RIM_LIGHT_SETTINGS.skinIntensity, [], { min: 0, max: 8 })
|
|
222
|
+
: 0,
|
|
223
|
+
softness: enabled
|
|
224
|
+
? roleNumber(
|
|
225
|
+
source,
|
|
226
|
+
'',
|
|
227
|
+
'softness',
|
|
228
|
+
DEFAULT_RIM_LIGHT_SETTINGS.softness,
|
|
229
|
+
['rimSoftness', 'feather', 'rimFeather'],
|
|
230
|
+
{ min: 0.001, max: 1 },
|
|
231
|
+
)
|
|
232
|
+
: DEFAULT_RIM_LIGHT_SETTINGS.softness,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function resolveRimLightForMaterial(settings, {
|
|
237
|
+
isEye = false,
|
|
238
|
+
isFace = false,
|
|
239
|
+
isHair = false,
|
|
240
|
+
isOutline = false,
|
|
241
|
+
isSkin = false,
|
|
242
|
+
} = {}) {
|
|
243
|
+
let intensity = settings.defaultIntensity;
|
|
244
|
+
if (isEye) intensity = settings.eyeIntensity;
|
|
245
|
+
else if (isFace) intensity = settings.faceIntensity;
|
|
246
|
+
else if (isSkin) intensity = settings.skinIntensity;
|
|
247
|
+
else if (isHair) intensity = settings.hairIntensity;
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
blockByShadow: settings.blockByShadow,
|
|
251
|
+
depthCloseWidthReduce: settings.depthCloseWidthReduce,
|
|
252
|
+
depthDottedLineFix: settings.depthDottedLineFix,
|
|
253
|
+
depthFadeEndDistance: settings.depthFadeEndDistance,
|
|
254
|
+
depthFadeRange: settings.depthFadeRange,
|
|
255
|
+
depthFadeStartDistance: settings.depthFadeStartDistance,
|
|
256
|
+
depthMask3D: settings.depthMask3D,
|
|
257
|
+
depthSafeDistance: settings.depthSafeDistance,
|
|
258
|
+
depthThresholdOffset: settings.depthThresholdOffset,
|
|
259
|
+
depthWidth: settings.depthWidth,
|
|
260
|
+
enabled: settings.enabled && !isOutline && intensity > 0,
|
|
261
|
+
intensity,
|
|
262
|
+
midPoint: settings.midPoint,
|
|
263
|
+
mixWithBaseMapColor: settings.mixWithBaseMapColor,
|
|
264
|
+
modeValue: RIM_LIGHT_MODE_VALUES[settings.mode] ?? RIM_LIGHT_MODE_VALUES[RIM_LIGHT_MODES.depthTexture],
|
|
265
|
+
softness: settings.softness,
|
|
266
|
+
tintColor: settings.defaultTintColor,
|
|
267
|
+
};
|
|
268
|
+
}
|