Does anyone have any recommendations for learning materials and examples to learn more about and start using, distance fields, raymarching etc in vvvv?
hey mrboni i tried to implement the gpugems3
the funny thing is that is kind of old (but nevertheless amazing)
but therefore he uses a lot of fragmentshader that I was not able to puzzle together correctly.
Even if it is HSLS there is a lot of semantics that I didnt encounter before in my vvvv HLSL learnings.
Also I had some problems reading the c++ program code that uses all the fragment shaders.
@tekcor - ah balls, didn’t realise it was GLSL. Just noticed it was made in 2007! Fair play. The thing that really interests me in it is generating complex mesh data with fairly simple density functions
@Vux - Amazing. A really useful start. A few things -
What is being accumulated in the ‘iter’ for loop? I can imagine many rays are being cast, but why are there so many rays for each pixel, and what is the difference between them?
What is actually being returned as the colour §? It seems to relate to the distance and also the angle from view
How is the following line creating an array of spheres?
float3 np = abs§ % spacing - (spacing * 0.5f)
Thanks guys
(edit) - I get how in the for loop we are moving the ray forward in steps along the raydir vector, but I’m not sure how the result of the distance function is relating to this)
@Vux, I’m primarily interested in being able to procedurally generate animated volume fields that relate to sound input, and visualise those and many ways including as geometry, or particle emitters/forces
in iter you calculate the position of the closest object.
By having this minimal distance you assume you can safely advance your ray from this distance (this is not always true). When distance is under a certain value you assume that you “hit” the object.
As color I just return iteration count, it useful for some other aspects but if you want to color and shade you need to compute normals at intersection point (there’s heap load of doc about it), it’s more or less a gradient function.
Once you have normals you can shade with any light equation you want.
Using abs and % is a domain repetition function. Not too simple to explain, but basically you convolute your ray to fit in a smaller domain. For a lot of useful functions (bend/twist/transform), you generally modify your ray a instead of your object itself.