Possibility to render mesh objects (or their SDFs) onto slice render image? #291
-
|
Hello :) First of all, thank you for this tool! I've been trying to set it up to display the slice renderer image in a virtual MRI intervention scene which works really great! My problem: I'm trying to add 3D meshes to the whole process and I've been wondering whether I'm trying to achieve a functionality that already exists. In short, here's what I try to do:
Steps 1 to 4 are working fine but where it gets tricky (at least for me), is the 5th step. I cannot seem to get the volume data of the additional meshes to be displayed in the slice renderer image. Here's the process I've tried so far:
The result is quite promising but I cannot actually achieve to sample the SDFs correctly. At the moment, I only correctly sync the worldToLocal matrices to the shader. The problem is that I'm new to shaders so I don't fully understand every detail necessary to achieve this. Having different scale settings when using multiple meshes or their SDFs adds to the problem of making this flexible for non-primitive objects.
The box shape you see on the "display" to the left is actually just the limited coordinate range in the shader for that SDF. If I wouldn't limit that, everything would be tinted white. So I think I'm not even close to an answer here. And that's why I would like to know if you know a better way towards achieving this. I'll keep trying and keep you updated. I can also submit the code I already have so far. I just didn't want to overload this post too much. Anyway, thanks for reading if you made it this far :) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
|
Hi! First of all, I think I mostly understand what you want to achieve, but I have two questions:
The reason I'm asking is:
I have some suggestions, depending on exactly what you want to achieve:
The mathematical solution (that only works with geometric shapes) is by far the easiest. The orthographic camera solution should also not be too hard - but it may of course take some time to get it right. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Thanks for sharing! And regarding this:
You may or may not have seen this, but I just merged a PR for updating the plugin to support URP and HDRP. I haven't made a release yet though. I need to first decide on how to deal with some of the Unity Asset Store requirements, haha. Anyway, great work on this! |
Beta Was this translation helpful? Give feedback.


@mlavik1
Alright, thanks for waiting. I hope it was worth it. At least, I learned a lot :)
First: What can you do with the tool I wrote (partially with help of AI):
What you cannot do with this tool: