Take #2 IQ Clouds remix
Thankyou both, I'm starting to get the hang of it but not writing anything from scratch yet, it looks good because of the guys who wrote the code, IQ & Kali
http://vimeo.com/moogaloop.swf?clip_id=79613106how/what did I do?
Kalis code, Mandelbox Distance Estimator (Rrrola's version), is untouched cuz I would like to make something that any DE can use, kinda like a plugin along the same idea as Kalis ColorPalette.frag but for clouds
I addapted IQs cloud code (uses his raymarcher but just for clouds) to use inputs from Fragmentarium, the main() routine is renamed clouds and takes 2 vec3 inputs, clouds(from, direction) and returns a vec3 color for this location, backColor is set = cloudColor and blended into the floor and background hits, then the obj hitcolor is blended like...
gl_FragDepth = ((MaxDistance / (MaxDistance - minDist)) +
(MaxDistance * minDist / (minDist - MaxDistance)) /
clamp(totalDist/length(dir), minDist, MaxDistance));
// cloud occlusion ??
return mix(hitColor,cloudColor,1.0-gl_FragDepth);
the above may or may not be correct or ideal, watch the vid and judge for yourself, I figured if I'm calculating depth for spline path occlusion I might as well make use of it for other things too
that's what I used in Take #2 and found that the cloud code has issues on 0.0 axis, as most if not all DE calculations do. To test this, run Fragmentarium, set Up vector as 0.0,1.0,0.0 then set eye and target at 1.0,0.0,0.0 and -1.0,0.0,0.0, the mandelbulb should disapear, move the camera back to -6.28 or +6.28 an any axis and the mandelbulb should be visible again but only from outside that radius with other 2 axis at 0.0, hmm... 2PI or not 2PI, that is the question, at any rate it still looks pretty good because your eyes follow the objects around and your brain is distracted by foreground movement.
I don't think this will work without depth buffers being enabled (front+back+hires+preview yes they all need one to render properly) unless code is added to pass the values around.
in the first vid the clouds are static with Eye and the world moves around them
in Take #2 the clouds have wind direction and are world relative, looks much better when they move now but has problems when you are looking into the wind? eye lids fluttering? along a particular axis of calculation, maybe changing wind direction will help.
the first vid had a lot of speckles so I processed the frames with Gimp 2.8 and lost some detail, but I think I found that little bug and the second vid looks crispier, mmmmm crunch crunch crunch.
maybe this will help with the SoC frag, cheers
Edit: don't need depth for clouds as we have depth for everything else