| @@ -29,7 +29,7 @@ async function init() { | |||
| }) | |||
| viewer.renderManager.autoBuildPipeline = false | |||
| viewer.renderManager.pipeline = ['render', 'screen'] | |||
| viewer.renderManager.pipeline = ['depth', 'render', 'screen'] | |||
| const targetPreview = viewer.addPluginSync(RenderTargetPreviewPlugin) | |||
| targetPreview.addTarget(()=>depth.target, 'depth', false, true) | |||
| @@ -28,12 +28,12 @@ async function init() { | |||
| viewer.scene.setBackgroundColor('#555555') | |||
| const urls = [ | |||
| 'https://threejs.org/examples/textures/sprite0.png', | |||
| 'https://threejs.org/examples/textures/uv_grid_opengl.jpg', | |||
| 'https://threejs.org/examples/models/svg/style-css-inside-defs.svg', | |||
| 'https://threejs.org/examples/textures/tiltbrush/Light.webp', | |||
| 'https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.157.1004/examples/textures/sprite0.png', | |||
| 'https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.157.1004/examples/textures/uv_grid_opengl.jpg', | |||
| 'https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.157.1004/examples/models/svg/style-css-inside-defs.svg', | |||
| 'https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.157.1004/examples/textures/tiltbrush/Light.webp', | |||
| // todo: avif | |||
| 'https://threejs.org/favicon.ico', | |||
| 'https://threepipe.org/favicon.ico', | |||
| ] | |||
| const geometry = new PlaneGeometry(1, 1) | |||
| @@ -25,9 +25,9 @@ async function init() { | |||
| viewer.scene.setBackgroundColor('#555555') | |||
| const urls = [ | |||
| 'https://threejs.org/examples/textures/compressed/sample_etc1s.ktx2', | |||
| 'https://threejs.org/examples/textures/compressed/sample_uastc.ktx2', | |||
| 'https://threejs.org/examples/textures/compressed/sample_uastc_zstd.ktx2', | |||
| 'https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.153.1001/examples/textures/compressed/sample_etc1s.ktx2', | |||
| 'https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.153.1001/examples/textures/compressed/sample_uastc.ktx2', | |||
| 'https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.153.1001/examples/textures/compressed/sample_uastc_zstd.ktx2', | |||
| ] | |||
| // PlaneGeometry UVs assume flipY=true, which compressed textures don't support. | |||
| @@ -12,7 +12,7 @@ | |||
| { | |||
| "imports": { | |||
| "three": "./../../dist/index.mjs", | |||
| "three/examples/jsm/modifiers/SimplifyModifier.js": "https://cdn.jsdelivr.net/gh/repalash/three.js-modded/examples/jsm/modifiers/SimplifyModifier.js", | |||
| "three/examples/jsm/modifiers/SimplifyModifier.js": "https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.157.1004/examples/jsm/modifiers/SimplifyModifier.js", | |||
| "threepipe": "./../../dist/index.mjs", | |||
| "@threepipe/plugin-tweakpane": "./../../plugins/tweakpane/dist/index.mjs" | |||
| } | |||
| @@ -39,7 +39,7 @@ async function init() { | |||
| await viewer.setEnvironmentMap('https://hdrihaven.r2cache.com/hdr/1k/empty_warehouse_01_1k.hdr', { | |||
| setBackground: true, | |||
| }) | |||
| await viewer.load<IObject3D>('https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Sponza/glTF/Sponza.gltf', { | |||
| await viewer.load<IObject3D>('https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/d7a3cc8e51d7c573771ae77a57f16b0662a905c6/2.0/Sponza/glTF/Sponza.gltf', { | |||
| autoCenter: false, | |||
| autoScale: true, | |||
| autoScaleRadius: 30, | |||
| @@ -12,7 +12,7 @@ | |||
| { | |||
| "imports": { | |||
| "three": "./../../dist/index.mjs", | |||
| "three/examples/jsm/postprocessing/UnrealBloomPass.js": "https://cdn.jsdelivr.net/gh/repalash/three.js-modded/examples/jsm/postprocessing/UnrealBloomPass.js", | |||
| "three/examples/jsm/postprocessing/UnrealBloomPass.js": "https://cdn.jsdelivr.net/gh/repalash/three.js-modded@v0.157.1004/examples/jsm/postprocessing/UnrealBloomPass.js", | |||
| "threepipe": "./../../dist/index.mjs", | |||
| "@threepipe/webgi-plugins": "https://unpkg.com/@threepipe/webgi-plugins@0.2.0/dist/index.mjs", | |||
| "@threepipe/plugin-tweakpane": "./../../plugins/tweakpane/dist/index.mjs" | |||
| @@ -7,13 +7,14 @@ import { | |||
| PerspectiveCamera2, | |||
| PlaneGeometry, | |||
| PopmotionPlugin, | |||
| ProgressivePlugin, | |||
| ProgressivePlugin, shaderReplaceString, | |||
| Texture, | |||
| ThreeViewer, | |||
| ToneMapping, | |||
| TonemapPlugin, | |||
| UnlitMaterial, | |||
| VirtualCamerasPlugin, | |||
| ShaderChunk, | |||
| } from 'threepipe' | |||
| async function init() { | |||
| @@ -21,6 +22,8 @@ async function init() { | |||
| const viewer = new ThreeViewer({ | |||
| canvas: document.getElementById('mcanvas') as HTMLCanvasElement, | |||
| debug: true, | |||
| rgbm: true, | |||
| msaa: true, | |||
| plugins: [new ProgressivePlugin(16), LoadingScreenPlugin], | |||
| }) | |||
| const virtualCameras = viewer.addPluginSync(VirtualCamerasPlugin) | |||
| @@ -81,6 +84,19 @@ async function init() { | |||
| tonemap.toneMapping = lastTonemapping | |||
| }) | |||
| // (Extra optional) extension decoding rgbm render target when using rgbm | |||
| if (viewer.renderManager.rgbm) { | |||
| plane.material.registerMaterialExtensions([{ | |||
| shaderExtender: (shader, material) => { | |||
| if (material.map?.colorSpace !== 'rgbm-16') return | |||
| shader.fragmentShader = shaderReplaceString(shader.fragmentShader, '#include <map_fragment>', ShaderChunk.map_fragment) | |||
| shader.fragmentShader = shaderReplaceString(shader.fragmentShader, 'texture2D( map, vMapUv )', 'RGBM16ToLinear(texture2D( map, vMapUv ))', {replaceAll: true}) | |||
| }, | |||
| computeCacheKey: (material) => material.map?.colorSpace === 'rgbm-16' ? 'rgbm' : '', | |||
| }]) | |||
| } | |||
| } | |||
| init().finally(_testFinish) | |||
| @@ -24,10 +24,11 @@ | |||
| } | |||
| }, | |||
| "../../node_modules/three": { | |||
| "version": "0.153.1006", | |||
| "version": "0.157.1004", | |||
| "dev": true, | |||
| "license": "MIT", | |||
| "devDependencies": { | |||
| "@puppeteer/browsers": "^1.4.1", | |||
| "@rollup/plugin-node-resolve": "^15.0.1", | |||
| "@rollup/plugin-terser": "^0.4.0", | |||
| "chalk": "^5.2.0", | |||
| @@ -46,7 +47,7 @@ | |||
| "rollup": "^3.20.2", | |||
| "rollup-plugin-filesize": "^10.0.0", | |||
| "rollup-plugin-visualizer": "^5.9.0", | |||
| "servez": "^1.14.2" | |||
| "servez": "^2.0.0" | |||
| } | |||
| }, | |||
| "../../src": {}, | |||