softbox 4.25.0 → 4.26.0
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/README.md +2 -2
- package/dist/{ThreePathTracingService-yCaEtW_f.js → ThreePathTracingService-BF9N0xLz.js} +6 -3
- package/dist/{ThreePathTracingService-CamzPwtW.cjs → ThreePathTracingService-Cfn0abhM.cjs} +2 -2
- package/dist/{UnrealBloomPass-BTHiW_Y8.js → UnrealBloomPass-CTDMA_YD.js} +22 -6
- package/dist/UnrealBloomPass-hgOwlQJl.cjs +114 -0
- package/dist/simple-viewer.cjs +7 -7
- package/dist/simple-viewer.es.js +1351 -1267
- package/package.json +6 -4
- package/dist/UnrealBloomPass-CQHHa-s_.cjs +0 -115
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "softbox",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.26.0",
|
|
5
5
|
"homepage": "https://leming.github.io/softbox/",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Batteries-included React 3D viewer — any GLB looks studio-shot in one line",
|
|
@@ -73,13 +73,14 @@
|
|
|
73
73
|
"@eslint/js": "^10.0.1",
|
|
74
74
|
"@microsoft/api-extractor": "^7.58.9",
|
|
75
75
|
"@playwright/test": "^1.61.1",
|
|
76
|
+
"@tailwindcss/vite": "^4.3.2",
|
|
76
77
|
"@testing-library/jest-dom": "^6.4.8",
|
|
77
78
|
"@testing-library/react": "^16.1.0",
|
|
78
79
|
"@types/jest": "^30.0.0",
|
|
79
80
|
"@types/pngjs": "^6.0.5",
|
|
80
81
|
"@types/react": "^19.0.0",
|
|
81
82
|
"@types/react-dom": "^19.0.0",
|
|
82
|
-
"@types/three": "^0.
|
|
83
|
+
"@types/three": "^0.187.0",
|
|
83
84
|
"@vitejs/plugin-react": "^6.0.3",
|
|
84
85
|
"eslint": "^10.7.0",
|
|
85
86
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
@@ -89,7 +90,8 @@
|
|
|
89
90
|
"pngjs": "^7.0.0",
|
|
90
91
|
"react": "^19.0.0",
|
|
91
92
|
"react-dom": "^19.0.0",
|
|
92
|
-
"
|
|
93
|
+
"tailwindcss": "^4.3.2",
|
|
94
|
+
"three": "^0.187.0",
|
|
93
95
|
"three-gpu-pathtracer": "^0.0.23",
|
|
94
96
|
"three-mesh-bvh": "^0.9.11",
|
|
95
97
|
"threedgizmo": "^1.2.1",
|
|
@@ -102,7 +104,7 @@
|
|
|
102
104
|
"peerDependencies": {
|
|
103
105
|
"react": ">=18.0.0 <20.0.0",
|
|
104
106
|
"react-dom": ">=18.0.0 <20.0.0",
|
|
105
|
-
"three": ">=0.177.0 <0.
|
|
107
|
+
"three": ">=0.177.0 <0.188.0"
|
|
106
108
|
},
|
|
107
109
|
"sideEffects": [
|
|
108
110
|
"./dist/simple-viewer.es.js",
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
const e=require("./CopyShader-CM1OGKAp.cjs"),t=require("./Pass-D0vYi-gB.cjs");let n=require("three");var r={name:`LuminosityHighPassShader`,uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new n.Color(0)},defaultOpacity:{value:0}},vertexShader:`
|
|
2
|
-
|
|
3
|
-
varying vec2 vUv;
|
|
4
|
-
|
|
5
|
-
void main() {
|
|
6
|
-
|
|
7
|
-
vUv = uv;
|
|
8
|
-
|
|
9
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
10
|
-
|
|
11
|
-
}`,fragmentShader:`
|
|
12
|
-
|
|
13
|
-
uniform sampler2D tDiffuse;
|
|
14
|
-
uniform vec3 defaultColor;
|
|
15
|
-
uniform float defaultOpacity;
|
|
16
|
-
uniform float luminosityThreshold;
|
|
17
|
-
uniform float smoothWidth;
|
|
18
|
-
|
|
19
|
-
varying vec2 vUv;
|
|
20
|
-
|
|
21
|
-
void main() {
|
|
22
|
-
|
|
23
|
-
vec4 texel = texture2D( tDiffuse, vUv );
|
|
24
|
-
|
|
25
|
-
float v = luminance( texel.xyz );
|
|
26
|
-
|
|
27
|
-
vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
|
|
28
|
-
|
|
29
|
-
float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
|
|
30
|
-
|
|
31
|
-
gl_FragColor = mix( outputColor, texel, alpha );
|
|
32
|
-
|
|
33
|
-
}`},i=class i extends t.n{constructor(i,a=1,o,s){super(),this.strength=a,this.radius=o,this.threshold=s,this.resolution=i===void 0?new n.Vector2(256,256):new n.Vector2(i.x,i.y),this.clearColor=new n.Color(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let c=Math.round(this.resolution.x/2),l=Math.round(this.resolution.y/2);this.renderTargetBright=new n.WebGLRenderTarget(c,l,{type:n.HalfFloatType}),this.renderTargetBright.texture.name=`UnrealBloomPass.bright`,this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){let t=new n.WebGLRenderTarget(c,l,{type:n.HalfFloatType});t.texture.name=`UnrealBloomPass.h`+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);let r=new n.WebGLRenderTarget(c,l,{type:n.HalfFloatType});r.texture.name=`UnrealBloomPass.v`+e,r.texture.generateMipmaps=!1,this.renderTargetsVertical.push(r),c=Math.round(c/2),l=Math.round(l/2)}let u=r;this.highPassUniforms=n.UniformsUtils.clone(u.uniforms),this.highPassUniforms.luminosityThreshold.value=s,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new n.ShaderMaterial({uniforms:this.highPassUniforms,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}),this.separableBlurMaterials=[];let d=[6,10,14,18,22];c=Math.round(this.resolution.x/2),l=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(d[e])),this.separableBlurMaterials[e].uniforms.invSize.value=new n.Vector2(1/c,1/l),c=Math.round(c/2),l=Math.round(l/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=a,this.compositeMaterial.uniforms.bloomRadius.value=.1;let f=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=f,this.bloomTintColors=[new n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=n.UniformsUtils.clone(e.t.uniforms),this.blendMaterial=new n.ShaderMaterial({uniforms:this.copyUniforms,vertexShader:e.t.vertexShader,fragmentShader:e.t.fragmentShader,premultipliedAlpha:!0,blending:n.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new n.Color,this._oldClearAlpha=1,this._basic=new n.MeshBasicMaterial,this._fsQuad=new t.t(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(e,t){let r=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(r,i);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(r,i),this.renderTargetsVertical[e].setSize(r,i),this.separableBlurMaterials[e].uniforms.invSize.value=new n.Vector2(1/r,1/i),r=Math.round(r/2),i=Math.round(i/2)}render(e,t,n,r,a){e.getClearColor(this._oldClearColor),this._oldClearAlpha=e.getClearAlpha();let o=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),a&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this._fsQuad.material=this._basic,this._basic.map=n.texture,e.setRenderTarget(null),e.clear(),this._fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this._fsQuad.render(e);let s=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this._fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[t].uniforms.direction.value=i.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this._fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=i.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this._fsQuad.render(e),s=this.renderTargetsVertical[t];this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this._fsQuad.render(e),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,a&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(n),this._fsQuad.render(e)),e.setClearColor(this._oldClearColor,this._oldClearAlpha),e.autoClear=o}_getSeparableBlurMaterial(e){let t=[],r=e/3;for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(r*r))/r);return new n.ShaderMaterial({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new n.Vector2(.5,.5)},direction:{value:new n.Vector2(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:`
|
|
34
|
-
|
|
35
|
-
varying vec2 vUv;
|
|
36
|
-
|
|
37
|
-
void main() {
|
|
38
|
-
|
|
39
|
-
vUv = uv;
|
|
40
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
41
|
-
|
|
42
|
-
}`,fragmentShader:`
|
|
43
|
-
|
|
44
|
-
#include <common>
|
|
45
|
-
|
|
46
|
-
varying vec2 vUv;
|
|
47
|
-
|
|
48
|
-
uniform sampler2D colorTexture;
|
|
49
|
-
uniform vec2 invSize;
|
|
50
|
-
uniform vec2 direction;
|
|
51
|
-
uniform float gaussianCoefficients[KERNEL_RADIUS];
|
|
52
|
-
|
|
53
|
-
void main() {
|
|
54
|
-
|
|
55
|
-
float weightSum = gaussianCoefficients[0];
|
|
56
|
-
vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
|
|
57
|
-
|
|
58
|
-
for ( int i = 1; i < KERNEL_RADIUS; i ++ ) {
|
|
59
|
-
|
|
60
|
-
float x = float( i );
|
|
61
|
-
float w = gaussianCoefficients[i];
|
|
62
|
-
vec2 uvOffset = direction * invSize * x;
|
|
63
|
-
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
|
|
64
|
-
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
|
|
65
|
-
diffuseSum += ( sample1 + sample2 ) * w;
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
gl_FragColor = vec4( diffuseSum, 1.0 );
|
|
70
|
-
|
|
71
|
-
}`})}_getCompositeMaterial(e){return new n.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`
|
|
72
|
-
|
|
73
|
-
varying vec2 vUv;
|
|
74
|
-
|
|
75
|
-
void main() {
|
|
76
|
-
|
|
77
|
-
vUv = uv;
|
|
78
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
79
|
-
|
|
80
|
-
}`,fragmentShader:`
|
|
81
|
-
|
|
82
|
-
varying vec2 vUv;
|
|
83
|
-
|
|
84
|
-
uniform sampler2D blurTexture1;
|
|
85
|
-
uniform sampler2D blurTexture2;
|
|
86
|
-
uniform sampler2D blurTexture3;
|
|
87
|
-
uniform sampler2D blurTexture4;
|
|
88
|
-
uniform sampler2D blurTexture5;
|
|
89
|
-
uniform float bloomStrength;
|
|
90
|
-
uniform float bloomRadius;
|
|
91
|
-
uniform float bloomFactors[NUM_MIPS];
|
|
92
|
-
uniform vec3 bloomTintColors[NUM_MIPS];
|
|
93
|
-
|
|
94
|
-
float lerpBloomFactor( const in float factor ) {
|
|
95
|
-
|
|
96
|
-
float mirrorFactor = 1.2 - factor;
|
|
97
|
-
return mix( factor, mirrorFactor, bloomRadius );
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
void main() {
|
|
102
|
-
|
|
103
|
-
// 3.0 for backwards compatibility with previous alpha-based intensity
|
|
104
|
-
vec3 bloom = 3.0 * bloomStrength * (
|
|
105
|
-
lerpBloomFactor( bloomFactors[ 0 ] ) * bloomTintColors[ 0 ] * texture2D( blurTexture1, vUv ).rgb +
|
|
106
|
-
lerpBloomFactor( bloomFactors[ 1 ] ) * bloomTintColors[ 1 ] * texture2D( blurTexture2, vUv ).rgb +
|
|
107
|
-
lerpBloomFactor( bloomFactors[ 2 ] ) * bloomTintColors[ 2 ] * texture2D( blurTexture3, vUv ).rgb +
|
|
108
|
-
lerpBloomFactor( bloomFactors[ 3 ] ) * bloomTintColors[ 3 ] * texture2D( blurTexture4, vUv ).rgb +
|
|
109
|
-
lerpBloomFactor( bloomFactors[ 4 ] ) * bloomTintColors[ 4 ] * texture2D( blurTexture5, vUv ).rgb
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );
|
|
113
|
-
gl_FragColor = vec4( bloom, bloomAlpha );
|
|
114
|
-
|
|
115
|
-
}`})}};i.BlurDirectionX=new n.Vector2(1,0),i.BlurDirectionY=new n.Vector2(0,1),exports.UnrealBloomPass=i;
|