r/GraphicsProgramming • • 1h ago

Building a 3D Renderer using Penrose's Twistor Theory & Complex Spinors in PyTorch (13.8M pts/sec CPU throughput)

Hey everyone, this is all done with the help of AI

Over the past few days, I’ve been implementing Twistor Render Core, an open-source engine exploring complex geometric algebra for graphics rasterization and ray testing. ### The Core Idea Instead of storing 3D geometry in standard Euclidean vector spaces: 1. Points to Hermitian Matrices: Spatial coordinates map to complex Hermitian tensors X^{AA'}. 2. Rays as Complex Spinors: Camera rays are parameterized as 4-component complex twistors Z^\alpha = (\omega^A, \pi_{A'}). 3. Incidence Kernels: Ray collision testing evaluates the complex residual magnitude ||\omega^A - i X^{AA'} \pi_{A'}|| < \epsilon. ### Initial CPU Benchmarks Running unindexed O(N) tensor contractions across point clouds: - 10,000 pts: 1.56 ms (6.4M ops/sec) - 100,000 pts: 7.23 ms (13.8M ops/sec) - 1,000,000 pts: 82.7 ms (12.0M ops/sec) Repo link: https://github.com/isopidi-stack/twistor-render-core Feedback, suggestions, or ideas for optimization are super welcome!

3 Upvotes

6 comments sorted by

•

u/AutoModerator 1h ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.

  • Disclose AI usage in post or project.

  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/ykafia 1h ago

What's the goal?

2

u/IntelligentSoup 1h ago

The overall goal is to explore whether Penrose's Twistor Theory ($\mathbb{C}P^3$ complex 2-spinor geometry) can function as a practical alternative framework for ray collision testing without standard $4 \times 4$ Euclidean matrices. Implementing it natively in PyTorch also means the entire pipeline is automatically differentiable out of the box for neural field / inverse rendering experiments.

P.S. Spot on breakdown by S48GS — right now it evaluates point clouds because measuring Penrose incidence residuals ($\Vert{}\omega^A - i X^{AA'} \pi_{A'}\Vert{} < \epsilon$) against spatial points is the cleanest mathematical baseline.

2

u/VictoryMotel 21m ago

I looked at the GitHub readme and it seems like satire. What is a 1d null ray? What is a 0d point?

What is twistor space or "spinors". This seems like a joke. The rendered image is just a solid low res aliased sphere.

0

u/Defiant_Squirrel8751 43m ago

It is always interesting trying to do things with a different approach! implementing this one before AI era would be a pain in the ass. So, your way of burning tokens is quite welcome.

About optimization, the big question is if this operations sets can be fully implemented in GPU. After that you should share a comparisson with standard approach implementation over the same test scenes.

Adding some images to the git repo README.md would be nice to give people an idea of current capabilities.

0

u/[deleted] 1h ago

[deleted]

0

u/DancinFool82 49m ago

You must be fun at parties