Skip to content

docs: Small @typegpu/three tutorial#2050

Merged
iwoplaza merged 1 commit intoreleasefrom
docs/typegpu-three-small-tutorial
Jan 14, 2026
Merged

docs: Small @typegpu/three tutorial#2050
iwoplaza merged 1 commit intoreleasefrom
docs/typegpu-three-small-tutorial

Conversation

@iwoplaza
Copy link
Collaborator

No description provided.

@iwoplaza iwoplaza changed the base branch from main to release January 14, 2026 12:24
@github-actions
Copy link

📊 Bundle Size Comparison

📈 Summary

  • 📈 Increased: 0 bundles

  • 📉 Decreased: 0 bundles

  • Unchanged: 24 bundles

  • Unknown: 0 bundles

📋 Bundle Size Comparison

Test tsdown webpack
dataImportEverything.ts 80.03 kB (➖) 85.34 kB (➖)
dataImportOneDirect.ts 40.28 kB (➖) 40.75 kB (➖)
dataImportOneStar.ts 40.28 kB (➖) 40.75 kB (➖)
functionWithUseGpu.ts 268 B (➖) 276 B (➖)
functionWithoutUseGpu.ts 24 B (➖) 59 B (➖)
importEntireLibrary.ts 256.73 kB (➖) 283.79 kB (➖)
importEntireLibraryUnused.ts 0 B (➖) 0 B (➖)
stdImportEverything.ts 113.10 kB (➖) 117.60 kB (➖)
stdImportOneDirect.ts 61.97 kB (➖) 62.92 kB (➖)
stdImportOneStar.ts 61.97 kB (➖) 62.92 kB (➖)
tgpuImportEverything.ts 237.74 kB (➖) 264.42 kB (➖)
tgpuImportOne.ts 237.75 kB (➖) 264.43 kB (➖)

@github-actions
Copy link

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@72de23f461e015e91608833f30c9e35c64e4481d
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@72de23f461e015e91608833f30c9e35c64e4481d
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@72de23f461e015e91608833f30c9e35c64e4481d

benchmark
view benchmark

commit
view commit

@iwoplaza iwoplaza merged commit d2e6cfc into release Jan 14, 2026
4 checks passed
@iwoplaza iwoplaza deleted the docs/typegpu-three-small-tutorial branch January 14, 2026 15:06
Copy link
Contributor

@aleksanderkatan aleksanderkatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great docs!

const material = new THREE.MeshBasicNodeMaterial();

+const albedo = TSL.color('magenta').mul(0.5);
+const albedoAccess = t3.fromTSL(albedo, d.vec3f);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fromTSL does not work insinde TGSL, right? Is the error descriptive? Maybe we should mention it around here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I remember, it works inside TGSL just fine 👀

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does work

material.positionNode = t3.toTSL(() => {
  'use gpu';
  return t3.fromTSL(TSL.positionLocal, d.vec3f).$
    .mul(scaleBuffer.$[t3.instanceIndex.$])
    .add(posBuffer.$[t3.instanceIndex.$]);
});

const springForce = springForceBuffer.$[springId];
const springVertexIds = springVertexIdBuffer.$[springId];
const factor = std.select(-1, 1, springVertexIds.x === idx);
force = force.add(springForce.mul(d.f32(factor)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When rewriting three.js code to TGSL, I accidentally rewrote:

const position = positionsBuffer.element(i);
position.addAssign(1);

to

const position = positionsBuffer.$[i];
position += 1;

I think some new users may come across this. Maybe we should include a warning about this caveat in the docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants