Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Exponential smooth min affects clipping

A topic by helpsypoo created Feb 05, 2020 Views: 226 Replies: 1
Viewing posts 1 to 2

I'm trying out different smooth min methods from our high priest Inigo. When I edit a blend snippet to the exponential smooth min from that article, the surface renders as expected, but the camera clipping gets messed up. Or it seems to get messed up. I have a feeling it's actually something to do with how the raymarching steps interact with the exponential blend. But it does look like clipping.

In my test example, I have two unit sphere raymarch objects spaced a unit apart. The blend intensity is set to 10, which shows the balls merge nicely. But it starts to clip at a camera distance of about 13 regardless of the camera clipping plane or the Raymarcher draw distance. It follows a pattern where doubling intensity halves the max camera distance. With intensity 20, it starts to clip around 6.9. At intensity 40, it clips around 3.7. At intensity 5, it clips close to 26. None of the parameters in the editor seem to affect this, and I find myself unable to see how to change it in the .cginc files, since I don't understand it. Any help appreciated! 

Here is the blend snippet:

    float res = exp2(-$intensity*a) + exp2(-$intensity*b );
    return -log2( res )/$intensity;

To be concrete about what I need: I want to be able to have large intensities and render them at large camera distances, just like is possible with the default polynomial smooth min. I'm using this to output video frames, so I'm not too concerned about performance.

In general I'm not sure I have enough information to help you find a perfect solution. Preserving "lipschitz continuity" is important and not all blends or modifiers do that perfectly--but that's what the "extra accuracy" knob is for. That doesn't help render closer to the camera?