Skip to content

Conversation

@BigTurtle8
Copy link
Contributor

@BigTurtle8 BigTurtle8 commented Sep 22, 2025

WORK IN PROGRESS - This change likely shouldn't be merged yet. I just wanted to get the code out to community in case anyone wanted to tinker on it.

Implement 3D viewer of current design in new "3D" tab by using solid-three, specifically its next branch.

Used solid-three's Entity pattern as opposed to createT pattern mainly out of personal preference, could probably be either way. Look here for more info: https://github.com/solidjs-community/solid-three/tree/next?tab=readme-ov-file#basic-usage

Also used magic numbers to get the display to fit on my machine; almost certainly NEEDS WORK to be universal and applicable for most users.

image

To Do

That can think of right now...

  • Adapt for more screen sizes, removing magic numbers in process.
  • Fix z fighting of layers at same y-level (basically the substrate layers, like p substrate and n well).
  • Fix overflow off the containing Paper.

Implement 3D viewer of current design in new
"3D" tab by using `solid-three`, specifically
its `next` branch.

Used `Entity` pattern as opposed to `createT`
pattern mainly as personal preference.

Also added lighting using (admittedly) magic
numbers to give visual contrast to 3D. Also
used magic numbers to get in frame on own
machine.
@BigTurtle8 BigTurtle8 marked this pull request as draft September 22, 2025 07:02
Fixed style on canvas so that isometric view does
not overflow its containing `<Paper>` element.
Moved JSX initialization of full mesh to
a separate component, `SiliconMesh`, so that
hopefully can do boolean operations on the separate
meshes to fix their z-fighting.

Also ended up, for `SiliconMesh`, subverting the normal `Entity`
pattern and directly implementing the adding of the meshes to the
scene using `three`. As of the time of development `solid-three`'s
Entity wasn't updating, even when `createEffect`'s callback
was being called and updating `group`. This is probably my
own misunderstanding, but got to work for now by essentially doing
the scene management directly.
Added `OrbitControls` to 3D viewer, allowing users to
rotate, pan, and zoom the silicon.

This reveals that the supposed blocking of diffusion
by the polysilicon is not actually being rendered, which
will likely have to also come from implementing boolean
geometry.

Additionally, there is a bug (or an incovenience?)
that zooming out too much causes the mesh to go out
of render distance and so disappear.
Included `three-csg-ts` in order to utilize CSG
(Constructive Solid Geometry) to fix z-fighting issues,
especially in substrate. Currently incredibly inefficient.

Also in installing, was a scary "overriding peer dependency"
message, but overall still seems to work. Was specifically
for a `magicast` module. Worth keeping in mind.
@BigTurtle8
Copy link
Contributor Author

Commit dc9e0aa introduces new dependencies, specifically three-csg-ts. There was also a warning of "overriding peer dependency", but it seemed to still work when hosting it locally. If anyone can test this on their own machines, please let me know if you run into any problems!

@BigTurtle8
Copy link
Contributor Author

Additionally, I'm considering if "Adapt for more screen sizes, removing magic numbers in process" would be better suited for a different PR, particularly because other components (see Graph.tsx) similarly hard-coding magic formatting numbers.

If this item can be reserved for another PR, I think the 3D view is ready for review.

@BigTurtle8 BigTurtle8 marked this pull request as ready for review November 11, 2025 07:32
@BigTurtle8
Copy link
Contributor Author

Finally, it should be noted that this current implementation is quite inefficient and naive. For context, in order to fix the z-fighting, BSG was used with an $O(n^2)$ runtime for the number of rectangles. While there's certainly some algorithm that would fix this, I don't currently have the time to architect it while theoretically remaining compatible with any technology that may have arbitrary layer heights, etc.

This inefficiency appears when opening the 3D tab and when editing the design while the 3D view is open. It's small but definitely noticeable from inverter.json (~0.5s freeze), but it's quite significant with skullfet.json (~5s freeze).

image

@urish
Copy link
Member

urish commented Nov 13, 2025

Thanks! 5s is quite significant (even 0.5s is noticable).

What is the impact of disabling the z-fighting? would this still be usable?

@urish
Copy link
Member

urish commented Nov 13, 2025

Also, wouldn't adding a relatively small number (e.g. 0.00001) to z-height of some of the layers fix he z-fighting?

@BigTurtle8
Copy link
Contributor Author

Sorry for the late reply!

  1. The 3D viewer would definitely still be usable. It's mainly an aesthetic issue, honestly, as orbit controls are implemented and so people can probably rotate the 3D model until it looks right. Actually, the official TT GDS viewer has this same issue (pictured below, taken from https://gds-viewer.tinytapeout.com/?model=https%3A%2F%2Fshuttle-assets.tinytapeout.com%2Fttsky25a%2Ftt_um_chip_rom%2Ftt_um_chip_rom.oas&pdk=sky130A).
image

It's worth pointing out, however, that the smaller scale of siliwiz means this aesthetic issue is much more prevalent than in the official viewer.

  1. I think z-bumping would work as a quick band-aid fix. Very quick testing locally suggests it would be on the scale of 0.5 additional height. However, these additional z-heights would have to compound for every additional layer that might overlap (i.e. with the current "technology" in siliwiz, there's 6 layers at a crossY of 100 (https://github.com/TinyTapeout/siliwiz/blob/main/src/model/layerTypes.ts)), which may become distracting. Also, this compounding issue might get hard to handle if ever another technology with more layers at the same crossY were to be ported to siliwiz.

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.

2 participants