Home Unreal Engine

The wonders of technical art (Unreal Engine)

1234568

Replies

  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
  • rollin
    Offline / Send Message
    rollin interpolator
    Hehe.. I see.. so you can now bool-model directly in-engine ;)
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Made some optims to the data texture writes, so now in this same scene, i have more than 120 fps even when I update everything on tick (it was like 40 before the optim). Drawing the distance field texture is still expensive but I'm not sure what could be done against that. Its a 4k texture...
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Got colors to work as well.

  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    It can be also used kinda like Clayxels if you heard about it... Its similar sdf modeler thing but for Unity.

    This is a building made out of sdf shapes, and processed into a volume texture for real time display.
    A cool thing in this is that later I can add those fancy lighting and reflections, so they can be used better in more complex scenes.



    I need to add "insert,remove,add" functionality to the data texture baking. 
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    And, with the usual stochastic skylight:

  • rollin
    Offline / Send Message
    rollin interpolator
    Ok this is really some freaky stuff.. So you are bound to a certain volume - you have to define first - and in there you have volumetric math-shapes you process with a compute shader to generate a mesh?! Which then can be normally lit and shaded?
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Almost. I process things in an area, put them into a volume texture (color and distance field), and then render the volume texture as regular distance field. 

    So essentially, a voxel texture gets created, and then I output data from a ray marcher, that the regular unreal shader can use. So world normal, color, etc.

    So this is what I do:

    1. have a blueprint class that can be used for placing primitives. This class will also contain basic info about the primitives, such as color, blend softness, etc. Have some of these placed in the level.

    2. have a second blueprint class, that can be placed in the level in an area (box volume). Upon a transform change of any of the intersecting primitives, or when a new one is placed, gather info about them, and store them in a data texture so a shader can actually use ot.  The texture that this makes looks like this, and one row represents one primitive's data:


    3. Have a shader that takes this data texture as input, and spawns math based distance field shapes, and bakes them into a volume texture. At this point, the color also gets rendered:

    distance field volume:

    color volume:


    4. These 2 textures can be used to drive a regular sphere tracing based ray marcher. So render the result using ray marching:


    The normals can be computed from the distance field directly. In this example, I used standard lit shader, and hooked up the outputs of the ray marcher.

    When I want more realistic and non game-ish lighting, I use this custom lighting model that stochastically samples the sdf and a cubemap for sky occlusion:


  • rollin
    Offline / Send Message
    rollin interpolator
    Ah K.. bc the Clayxels dude said he runs it without ray marcher and so I thought you too.

    And do (or could) all these buildings act like instances, rendered from the same volume texture?
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Ah. No I still render it as ray marching. Yeah he uses some kind of particles to display the result or something like that. I honestly don't like the look of that.

    Yes, on these last images, they are all instances. That is actually the reason for why I placed more than one. So I can see how well it works, but it does. You can apply the shader to any amount of boxes...
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    I should make it so you can select wether you want to modify only shape, only color, or both. Because currently the color of the cutout shape appears on top. This should be optional.

  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    One cool application for the current implementation is to use it for "laser cuts" using the smooth blend option.

  • igi
    Offline / Send Message
    igi polycounter lvl 11
    Obscura said:



    Just great! I'm wondering how useful would SDF be for hardsurface modeling? Would it be possible to polygonize these shapes?
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Hi. It sure would be. But the first thing that comes to my mind is the usual marching cubes algorithm. The output would be similar to Blenders voxelization feature. There are other methods too but this is the simplest. Also I have never tried doing something like that.
  • Obscura
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
  • edoublea
    Offline / Send Message
    edoublea polycounter lvl 9
    Those are looking good.  How does the perf hit compare to the more "solid surface" SDF stuff you've been doing?
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Its much worse :) A light ray needs to be marched on every opacity step. Forget stochastic light sampling with multiple samples per frame.
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Joining the wobbly liquid party....

  • edoublea
    Offline / Send Message
    edoublea polycounter lvl 9
    I've been following along with Fake Fluid Sims Week as well....  it seems like the popular technique people are using is a Vertex Shader accessing a Read/Write Compute Shader, and manipulating the verts directly.  This looks more like a fragment-shader mask approach.  Would love some more info, but here's my guess:
    Looks like you might be accumulating and dissipating a couple of different velocity float values (x and y directions maybe?) in BP, and then using those to drive a sinewave-perturbed planar-mask that is pivoting around the center.  Am I close, or are you getting into some sneaky Compute stuff here?  How would you approach dealing with the liquid's "top surface" appearance? (my assumption, especially based on your other stuff, would be raymarching, which would work great).
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Almost there:


    @edoublea I use "lagged floats" like Ryan. I get the xy linear and angular velocity, choose the larger between the linear and angular one. Put them in 2 scalar parameter, and slowly fade them out when there is no movement. Then I manipulate some sines in the shader. Yeah I used ray marching.
  • edoublea
    Offline / Send Message
    edoublea polycounter lvl 9
    Well done, I quite like that approach.
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Thanks. Yeah its pretty convincing, even though its so fake. I'm thinking about adding more perturbation using vector noise so maybe I could have overhanging splashes too. I'm not sure yet how well would that work but I guess I'll find it out.
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    The vector noise thing didn't work as I would have expected, so I'll rather add some nice refraction and absorption  :)
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
  • edoublea
    Offline / Send Message
    edoublea polycounter lvl 9
    Great results.  Are you using Unreal's transparent/lit lighting models, or doing all the lighting yourself in the raymarcher?  Curious about the interplay between the "box surface" highlights/reflections and the water surface highlights.
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    For now its just quickly thrown together using 2 normals (box outer and liquid surface). I must have to do it inside the ray marcher to add multiple layers of reflections. Currently I'm adding tank thickness and refractions so properly implemented multiple reflections and refractions will be there in the next update. I'm experiencing some weird stuff with refract(). ior lower than 1 works while higher than 1 breaks. And I even need to use flipped normal to get lower than 1 to look correct.
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Launched a patreon page. Nothing there yet, but I'm planning to post "exlusive content" there. It will also serve as an extension of this page where I go into more details regarding the ones I'm posting about here, including code samples, downloadables and more...
    Don't judge, we live from money and there are a bunch of people thinking that everything should be for free. Some people can allow himself to give out anything for free, but I can't afford that unfortunately.

    https://www.patreon.com/kristoflovas
  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    I'm experimenting with texture array asset, as a possible alternative of pseudo volume texture, and volume texture asset. The benefit of this method is that you can achieve larger 3d resolution, because you don't have the size limits of a 2d texture. The second benefit is that you could theoratically have any axis ratio (1,1,2...3,1,1...etc) because there is no connection between the x-y and z resolution. Reading/sampling performance is fine. These are examples of a 512^3 volume, in a non volumetric material, and in a raymarcher. Z interpolation is manually added, since the texture array doesn't interpolate the elements. But this is the same using pseudovolume. If you take a look into its code, you can see that it takes 2 samples and interpolates them to get smooth z. Resource size of the 512^3 volume using this method, and dxt is 128 mb vram. So its not even that much memory.


  • Obscura
    Offline / Send Message
    Obscura godlike master sticky
    Random rtx rendering study I've done today.

1234568
Sign In or Register to comment.