Skip to content

A triangle's texel density is the hit's to compute - #185

Draft
yujiaxu-ops wants to merge 4 commits into
mainfrom
hit-computes
Draft

yujiaxu-ops wants to merge 4 commits into
mainfrom
hit-computes

Conversation

@yujiaxu-ops

Copy link
Copy Markdown
Collaborator

Every triangle carried a constant for its mip choice (half the log of its UV area over its area), made when the scene was built. An instance added an offset for its scale; the skinning pass and the particle passes wrote the constant again each pose and frame. Now the kernel takes it from the triangle where it is hit: its two edges as it stands in the world, and its UVs (mesh_lod). Nothing stores or writes it; the attributes' first x word and the instance record's third info word are spare.

It is the first step of moving the geometry to shared vertices and indices: a pass that skins a vertex cannot keep a value a triangle.

What changes in a picture:

  • Under a uniform scale, rounding only. Five scenes rendered offline against the build before: four the same bytes, one with 21 of 921,600 pixels off by 6 steps at most.
  • An instance scaled otherwise has its triangles' own density now. Its offset was the cube root of its volume's scale.
  • A fault of the build before: a shadow ray through glass on a scaled instance added the instance's offset twice, so a pane's colour or transmission map was read some levels off (a pane scaled to 1 / 32: five too high). A test holds it.

A cost until the geometry step: the cutout test of a candidate hit reads its triangle's edges too, where its material has an alpha map.

Checks

  • The kernel's own mesh_lod, its text run on the GPU for 512 triangles (a millimetre to a hundred metres, UVs from a hundredth of the texture to a hundred repeats, ones without area) against 64-bit values.
  • Render tests, natively and under software traversal: a checker on an instance scaled 32 times (a square's inside reads its colour; a level five too high reads grey); the checker in a cutout's alpha on one scaled 256 times; a shadow through a pane with a colour map, the pane scaled 1 / 32 and 32 times. The first of the two fails on the build before.
  • 10 mutations: six of the formula fail the unit test, four of the places that use it fail a render test.
  • Not held by a test: the density a light sample, a material function's input and a translucent particle read. A wrong level there changes noise, not a mean.
  • Not run on Vulkan yet.

🤖 Generated with Claude Code

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.

1 participant