Archive 17/01/2023.

3D fractals demo

Bananaft

Lately I was playing with raymarching and 3d-fractals. I came up with the method to optimize raymarching and implemented it in Urho. I also added volumetric light scattering for point and spot lights. Taking from this demo: blog.mmacklin.com/2010/05/29/in-scattering-demo/ and using some ugly hackery to make it work with finite attenuation lights (it uses inverse square fore light attenuation ).

Requires modern GPU.

Screenshots and download:
bananaft.itch.io/yedomaglobula

Follow me: https://twitter.com/Bananaft


theak472009

Looks freaking amazing man. Reminds me of those ShaderToy fractal demos.
Any chance to get the C++ source code or is it all done in shader code?
Edit: Found the code in Angelscript.

ghidra

super cool.
The lights look great. Are you also building collision objects for that character to stand on?

I did some similar work a while ago… but I never took it as far as you have:
topic1682.html

dakilla

nice, I love fractals

Lumak

I like the lighting effect. Awesome demo.

Bananaft

Thank you all for feedback. So it actually works :slight_smile:. Forgot to ask, I really want to know what hardware you have and what performance you are getting?

My go to source.

With this project I’ve made my first baby steps in C++. Whole raymarching thing is purely glsl and renderpath.xml. But I had to disable Z-culling for light volumes, to make them work with raymarching result. Also I passed couple additional shader parameters for light scattering of spotlights. That’s like 5-6 lines changed.

No, I just placed him there :slight_smile:. I haven’t tried collisions yet, but I will. Mesh is not an option, I have to calculate SDF for collisions either on GPU or CPU, both ways seems terrible. CPU will require to write code twice, keep it same, and may still give different results (in theory). GPU has problems with bringing information back to CPU to update objects.

vivienneanthony

I wonder if a Linux version can be built. :-/

dakilla

just put the linux binary player in the folder and run it.
it works partially, I experimented somes bugs…

Bananaft

Here is my fork and all the changes.

franck22000

Very nice demo !

Do you think you could make a pull request in Urho3D master branch for adding this volumetric effect support to point and spot lights ? That would be awesome.

Bananaft

Hi, sorry for long reply.

I never did a pull requests, might use an assistance, and my coding style is a bit savage.

Also, it works easily only with deferred lighting, other modes will need an additional light volumes pass, witch is not cool.
Plus, this light scattering should somehow interact with fog, and trying to resolve this will rise many complicated questions.

Bananaft

The new version features four different fractals, smoother lights scattering, cubemap sky and colored ambient occlusion, and some more minor tweaks.

Modanung

So cool…
Unfortunately the misspelling of a certain resource prevents me from pouring the submarine some tea.

Bananaft

What do you mean? Is there an error, it won’t load or something?

Modanung

Yea, it’s looking for a Teapot where there only is a TeaPot.

Bananaft

So you’ve built Linux binary from my brunch? How does it work? What GPU do you have?

Modanung

I ran the game.as with a natively built Urho3D player. It’s a simple naming issue fixed by changing line 234 of game.as from:

tpObject.model = cache.GetResource("Model","Models/Teapot.mdl");

to:

tpObject.model = cache.GetResource("Model", "Models/TeaPot.mdl");

…damned alternative spellings. :stuck_out_tongue_winking_eye:

Bananaft

New video.

Eugene

Fractals are goddamn amazing. How the physics is implemented?

Bananaft

Everything has to be sphere approximated. Character controller uses 2 spheres. Submarine uses 3. It’s calculated with pixel shader. I use small 16bit textures to pass data to and from GPU. Position and radius is sent to GPU, distance and normal(estimated with given radius) are sent back. It is not very accurate, but with signed distance you can do soft collisions

johnnycable

Nice. What kind of monsters are going to put in there?

Bananaft

don’t know yet. Will see. It won’t be a shooting gallery though.

johnnycable

What about the dreaded l-system monster?

06
(the monster in a rare shot)

The foul creature is renowned to live in such abysses like the ones you depicted. It feeds on unfortunate travelers looking for uncommon sources.
It is made of crystal/rocky (ehr, boxes is this shot) formations which can take the shape of many things like, obviously, different fractals kind.
You only need a formula, a fractal shape (which you substitute for the boxes), a auto-generated skeleton for movement, placement in sentive context.

27
(matrices paths for object substitution and skeletonizing)

Easy creation with Sverchok generative design in Blender:
48
just substitute Box for whatever

get the blend

A heightened study on the subject: LTM notes by Elfnor

Bananaft

I wrote a devlog-story. It is mostly about graphics features and visuals.

Bananaft

Thank you. My plan is to first try it at small platform like itch or humblewidget and then move to big ones.

Bananaft

New build is available.