Conversation
|
pkg.pr.new packages benchmark commit |
b89b489 to
5e31cf5
Compare
5e31cf5 to
a677387
Compare
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:
📋 All resultsClick to reveal the results table (351 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
| } from './operators.ts'; | ||
|
|
||
| export { classifySlot, createJumpFlood } from './jumpFlood.ts'; | ||
| export type { ColorTexture, JumpFloodExecutor, SdfTexture } from './jumpFlood.ts'; |
There was a problem hiding this comment.
Seeing as we're planning to add more things to the @typegpu/sdf package (like a default sdf renderer), maybe it would be worth it to wrap these additional type defs into a namespace?
export declare namespace JumpFlood {
type ColorTexture = ...;
type SdfTexture = ...;
type Executor = ...;
}Usage:
import { createJumpFlood, JumpFlood } from '@typegpu/sdf';Alternative
We could also just export everything under JumpFlood:
import { JumpFlood } from '@typegpu/sdf';
const jumpFloodExecutor = JumpFlood.createExecutor({ ... });
// ^? JumpFlood.Executor| export type { ColorTexture, JumpFloodExecutor, SdfTexture } from './jumpFlood.ts'; | |
| export * as JumpFlood from './jumpFlood.ts'; |
| @@ -0,0 +1,37 @@ | |||
| <div align="center"> | |||
|
|
|||
| # @typegpu/three | |||
There was a problem hiding this comment.
Sus ඞ
| # @typegpu/three | |
| # @typegpu/radiance-cascades |
| 🚧 **Under Construction** 🚧 | ||
|
|
||
| </div> | ||
|
|
||
| A helper library for using TypeGPU with Three.js. | ||
|
|
||
| ```ts | ||
| import * as TSL from 'three/tsl'; | ||
| import * as t3 from '@typegpu/three'; | ||
| import { fract } from 'typegpu/std'; | ||
|
|
||
| const material1 = new THREE.MeshBasicNodeMaterial(); | ||
| const pattern = TSL.texture(detailMap, TSL.uv().mul(10)); | ||
| // `fromTSL` can be used to access any TSL node from a TypeGPU function | ||
| const patternAccess = t3.fromTSL(pattern, d.vec4f); | ||
| material1.colorNode = t3.toTSL(() => { | ||
| 'use gpu'; | ||
| return patternAccess.$; | ||
| }); | ||
|
|
||
| const material2 = new THREE.MeshBasicNodeMaterial(); | ||
| material2.colorNode = t3.toTSL(() => { | ||
| 'use gpu'; | ||
| // Many builtin TSL nodes are already reexported as `accessors` | ||
| const uv = t3.uv().$; | ||
|
|
||
| if (uv.x < 0.5) { | ||
| return d.vec4f(fract(uv.mul(4)), 0, 1); | ||
| } | ||
|
|
||
| return d.vec4f(1, 0, 0, 1); | ||
| }); | ||
| ``` |
There was a problem hiding this comment.
Please update usage docs
| "unplugin-typegpu": "workspace:*" | ||
| }, | ||
| "peerDependencies": { | ||
| "typegpu": "^0.9.0" |
There was a problem hiding this comment.
| "typegpu": "^0.9.0" | |
| "typegpu": "workspace:^" |
| @@ -0,0 +1,44 @@ | |||
| { | |||
| "name": "@typegpu/radiance-cascades", | |||
| "version": "0.9.0", | |||
There was a problem hiding this comment.
If we release it
| "version": "0.9.0", | |
| "version": "0.11.0", | |
| "private": true, |
| displayPipeline | ||
| .withColorAttachment({ | ||
| view: context.getCurrentTexture().createView(), | ||
| loadOp: 'clear', | ||
| storeOp: 'store', | ||
| }) | ||
| .draw(3); |
There was a problem hiding this comment.
| displayPipeline | |
| .withColorAttachment({ | |
| view: context.getCurrentTexture().createView(), | |
| loadOp: 'clear', | |
| storeOp: 'store', | |
| }) | |
| .draw(3); | |
| displayPipeline.withColorAttachment({ view: context }).draw(3); |
| for (let i = 0; i < scene.disks.length; i++) { | ||
| const disk = scene.disks[i]; |
There was a problem hiding this comment.
| for (let i = 0; i < scene.disks.length; i++) { | |
| const disk = scene.disks[i]; | |
| for (const disk of scene.disks) { |
| for (let i = 0; i < scene.boxes.length; i++) { | ||
| const box = scene.boxes[i]; |
There was a problem hiding this comment.
| for (let i = 0; i < scene.boxes.length; i++) { | |
| const box = scene.boxes[i]; | |
| for (const box of scene.boxes) { |
| import tgpu from 'typegpu'; | ||
| import * as d from 'typegpu/data'; |
There was a problem hiding this comment.
| import tgpu from 'typegpu'; | |
| import * as d from 'typegpu/data'; | |
| import tgpu, { d } from 'typegpu'; |
| import * as sdf from '@typegpu/sdf'; | ||
| import tgpu from 'typegpu'; | ||
| import { fullScreenTriangle } from 'typegpu/common'; | ||
| import * as d from 'typegpu/data'; | ||
| import * as std from 'typegpu/std'; |
There was a problem hiding this comment.
| import * as sdf from '@typegpu/sdf'; | |
| import tgpu from 'typegpu'; | |
| import { fullScreenTriangle } from 'typegpu/common'; | |
| import * as d from 'typegpu/data'; | |
| import * as std from 'typegpu/std'; | |
| import * as sdf from '@typegpu/sdf'; | |
| import tgpu, { d, std, common } from 'typegpu'; |
There was a problem hiding this comment.
Thumbnails are missing
There was a problem hiding this comment.
Could we mimic the control scheme from JFA here and clear colors on rmb?
There was a problem hiding this comment.
Or we could have two colors, and use the second one on rmb
| { | ||
| "title": "Compute Cascades (with flooding)", | ||
| "category": "rendering", | ||
| "tags": ["experimental", "3d"] |
There was a problem hiding this comment.
Include the coolness factor here
| console.debug('[radiance-cascades] config:', { | ||
| output: `${outputWidth}x${outputHeight}`, | ||
| cascadeDim: `${cascadeDimX}x${cascadeDimY}`, | ||
| probes: `${cascadeProbesX}x${cascadeProbesY}`, | ||
| cascadeCount: cascadeAmount, | ||
| sdfResolution: `${sdfResolution.width}x${sdfResolution.height}`, | ||
| textureMemory: `${((cascadeDimX * cascadeDimY * cascadeAmount * 8 * 2) / (1024 * 1024)).toFixed( | ||
| 1, | ||
| )} MB (2x cascade textures)`, | ||
| dispatchesPerRun: `${cascadeAmount} cascade + 1 build = ${cascadeAmount + 1}`, | ||
| workgroupsPerCascadeDispatch: `${Math.ceil(cascadeDimX / 8)}x${Math.ceil( | ||
| cascadeDimY / 8, | ||
| )} = ${Math.ceil(cascadeDimX / 8) * Math.ceil(cascadeDimY / 8)}`, | ||
| workgroupsPerBuildDispatch: `${Math.ceil(outputWidth / 8)}x${Math.ceil( | ||
| outputHeight / 8, | ||
| )} = ${Math.ceil(outputWidth / 8) * Math.ceil(outputHeight / 8)}`, | ||
| }); |
There was a problem hiding this comment.
Will we leave this in?
b6a0e20 to
24fb17c
Compare
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.79, 1.59, 3.39, 5.40, 6.06, 7.82, 18.94, 22.87]
line [0.81, 1.62, 3.87, 4.95, 6.05, 9.33, 18.18, 20.09]
line [0.85, 1.66, 3.91, 5.28, 6.29, 9.59, 18.00, 20.79]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.30, 0.52, 0.63, 0.72, 0.97, 1.03, 1.31, 1.37]
line [0.33, 0.51, 0.63, 0.79, 1.01, 1.07, 1.28, 1.40]
line [0.27, 0.49, 0.64, 0.74, 1.03, 1.05, 1.28, 1.39]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.80, 1.88, 3.73, 5.04, 10.46, 21.95, 48.11, 94.82]
line [0.79, 1.84, 3.77, 5.70, 10.59, 22.43, 47.14, 94.94]
line [0.73, 1.76, 2.97, 5.29, 10.25, 21.52, 47.65, 93.51]
|
aleksanderkatan
left a comment
There was a problem hiding this comment.
Let's goo radiance cascades!! 🦋⚰️
|
|
||
| let accum = d.vec4f(); | ||
|
|
||
| for (let i = d.u32(0); i < 4; i++) { |
There was a problem hiding this comment.
| for (let i = d.u32(0); i < 4; i++) { | |
| for (const i of tgpu.unroll(std.range(4))) { |
There was a problem hiding this comment.
This example has no mobile controls, thus is just an uninteractive black canvas. radiance-compute is not interactive either
| let bestOutsideCoord = d.vec2f(-1); | ||
| let bestInsideDist = 1e20; | ||
| let bestOutsideDist = 1e20; | ||
| let bestInsideDist = d.f32(3.4 * 10 ** 38); |
There was a problem hiding this comment.
Maybe we could expose constants like max, min, epsilon for each data type, like IEEE754 specifies?
There was a problem hiding this comment.
Or we could have two colors, and use the second one on rmb
| "types": "./dist/index.d.ts" | ||
| }, | ||
| "scripts": { | ||
| "build": "unbuild", |
There was a problem hiding this comment.
tsdown + no index.cjs?
|
|
||
| 🚧 **Under Construction** 🚧 |
There was a problem hiding this comment.
c:
| 🚧 **Under Construction** 🚧 |
| readonly sdfOutput: SdfTexture; | ||
| /** The color output texture (rgba8unorm). */ | ||
| readonly colorOutput: ColorTexture; | ||
| /** Clean up GPU resources created by this executor. */ |
There was a problem hiding this comment.
| /** Clean up GPU resources created by this executor. */ |
| } | ||
|
|
||
| export const sdfSlot = tgpu.slot<(uv: d.v2f) => number>(); | ||
| export const colorSlot = tgpu.slot<(uv: d.v2f) => d.v3f>(); |
There was a problem hiding this comment.
Shouldn't there also be a way to provide transmittance of a pixel? Otherwise, transmittance will always be either 0 or 1, right?
| T = 0; | ||
| break; |
There was a problem hiding this comment.
This also seems to treat transmittance binarily

No description provided.