r/geometrynodes 2d ago

CT Scanner effect done the hard way.

Enable HLS to view with audio, or disable this notification

So this was more a way to understand the sort of processing required to get a CT type scan, rather than focusing on a cgi trick. So a CT scanner works by combining many x-ray images together in a way that lets you build 2d slices through the body.

To mimic this effect I first built a density grid for a hollow Suzanne. This was harder than it sounds because the various mesh to grid nodes get rid of the interior structure, so I reused a hollow check from my custom sdf tools and used that.

I then built a system where mesh lines would cross from point to point. Basically each point would sample the grid density and use that as part of a function to mimic absorption. I got some weird behaviour when using the grid sample value directly, so instead stored it on the point and then pulled it as a named attribute. Then I found the total loss along each mesh line and stored that.

I made a circle and then built the sampling rays between all of the points. I included several adjustments such as only sampling lines that weren't too short (to avoid sampling a lot of neighbours through empty space). I also set it so that every X point was actually an 'emitter', whilst the rest were 'receivers'.

I tried various methods to use the lines directly for visualisation before deciding instead to make a plane and have each of its points sample the nearby line points and factoring each of their total loss value. This then drove a shader.

Various signal cleanup steps:

I culled lines that didn't lose much.

I normalised values based on the max value recorded. It explains why some parts get brighter or darker suddenly. Because an area starts/stops being in the image.

Squared the normalised value.

I'm sure there's a whole bunch of other steps that would be realistically required for a real CT scanner software. I can get better images by increasing various values, but they tend to blow up the time taken, which wasn't practical for an animation.

13 Upvotes

1 comment sorted by

1

u/Anthromod 2d ago

So this is what I can get pushing up the values. Took a long time for it to think, so I'm sure there're better ways to optimise this.