Rendering Signed Distance Field primitives

Hi all,

I’m new to the forums and this is my first post!

I’ve been working with SDF’s and SDF primitives (think shadertoy) recently and figured I would try and use them for a university project I’m working on. My question is, has anyone done anything like this before? If yes, I’d love to hear how you approached it? So far I’ve been unable to find almost anything related to this as most of the SDF usage revolves around shadows and AO.

I did quickly prototype this by creating a custom pixel shader following the custom shader creation ideas discussed in As for the pixel shader it is pretty standard when it comes to raymarching SDF primitives. The output is written to a render target and for now I’m using the alpha channel to store the depth of the trace for culling later. As for displaying the result in the scene I created a post process material where I compare the depth value to the Scene Depth.


At the moment the solution still has many problems and it doesn’t take into account any of the lights in the scene nor does it generate any shadows whatsoever. Also for now there are no interaction between the object and the rest of the scene but I’m planning on approximating the shape with simple collision shapes as the size of the object is not random but can be estimated. One problem I noticed as well with this prototype is that there’s something wrong with the depth estimation when rendering the post process material as you can see a thick outline of the object when looking against the sky as seen below


All in all there’s still a lot to do but would love to hear your opinions and suggestions.

A small video of the prototype:


I added walls to the scene to “rid” the scene of the black outlines

The rendered SDF scene is a slightly modified version of so all glory of that to the creator.

Sorry for the short post, I wanted to write something up quickly before heading from the University. I’d be happy to answer any questions that you might have and will try and keep this post updated as I make progress. Also forgive me if my terminology is off somewhere, feel free to correct the mistakes :slight_smile:

Hi - this is fantastic! I am experimenting with rendering SDF primitives in UE4 myself… I’d almost given up finding anyone else doing the same.

Have you taken this prototype any further? I would be keen to hear what you’ve learnt.

Rendering fractals

Hey guys I too have been experimenting with rendering using raymarching and SDFs and have some results to share:

Till now been using Volumetric decals but they are prohibitively expensive. Trying to figure out how to raymarch using a normal Surface domain material as I saw in this post:

It’s not working right now but knowing that it’s possible is half the battle IMO. Will update if it changes. If you guys want more on the Volumetric decals look here: