Kali
|
|
« Reply #15 on: January 03, 2013, 08:00:56 PM » |
|
Nice work!! does it render fast?
I took a look at the papers but I didn't have the time for making an implementation in fragmentarium yet. Thanks for the code!
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #16 on: January 03, 2013, 08:01:17 PM » |
|
Stunning stuff Pablo
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #17 on: January 03, 2013, 08:11:13 PM » |
|
#info Faceted sphere Distance Estimator just like Darkbeam's discoballIFS #include "DE-Raytracer.frag" #group discoballIFS
// Number of faces in xy and yz planes. uniform int Nfaces; slider[0,9,100]
vec2 fold2D(vec2 p, vec2 fp){//algorithmically this is O(n)... It could be done in O(log(n)). Gess how ;o) vec2 ap=p+vec2(1.); int i=0; while(i++<20 && any(notEqual( p, ap))){ ap=p; p.y=abs(p.y); float t=2.*min(0.,dot(p,fp)); p-=t*fp; } return p; }
float DE(vec3 p) { #define PI 3.14159 float angle = PI/float(Nfaces); vec2 foldingPlaneNormal=vec2(sin(angle),-cos(angle)); p.xy=fold2D(p.xy,foldingPlaneNormal); p.xz=fold2D(p.xz,foldingPlaneNormal); return p.x-1.; } It's brilliant but I'm not sure if it's so fast when facets become a lot (say, 50,100) - I used polyfold instead.
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
eiffie
Guest
|
|
« Reply #18 on: January 03, 2013, 09:24:53 PM » |
|
Yes the depth texture version runs fast since you are replacing a DE march towards the light with a single texture lookup. Less than 2x normal rendering speed and if the light and fractal aren't moving with respect to each other (only the camera moves) then you can precompute the depth texture once! You could use this texture to calculate shadows as well but you would need a large texture to avoid pixelating.
So your version is still better when zooming in and for high precision stills.
|
|
« Last Edit: January 03, 2013, 09:38:24 PM by eiffie »
|
Logged
|
|
|
|
Syntopia
|
|
« Reply #19 on: January 03, 2013, 09:45:40 PM » |
|
Yes the depth texture version runs fast since you are replacing a DE march towards the light with a single texture lookup. Less than 2x normal rendering speed and if the light and fractal aren't moving with respect to each other (only the camera moves) then you can precompute the depth texture once! You could use this texture to calculate shadows as well but you would need a large texture to avoid pixelating.
Kudos for implementing that, Eiffie! It is a great idea to use shadowmaps for volumetric lights. Did you see Quilez recent post: http://www.iquilezles.org/www/articles/multiresaocc/multiresaocc.htmHere he uses a blurred shadowmap for low-frequency shadows (combined with SSAO and baked AO :-)) You could do these two passes in Fragmentarium using the backBuffer and the backBufferCounter to flip back and forth then throw away every other frame.
I'm not sure this is the best way (how would you throw away every other frame?), but Fragmentarium already supports two-pass shading. You can add an additional buffershader (e.g. with the command: #buffershader "DepthBufferShader.frag"), which can read from an 'uniform sampler2D frontbuffer'. But this is really something I'd like to redesign at some point - it is quite hackish. It would be great to be able to setup a arbitrary pipeline of shaders and buffers, and only recalculate specific buffers if the uniforms bound to them changes (e.g. a shadowmap would only be recalculated if the light source moved, the tone mapping shader would not need to render the whole scene to change a simple color parameters and so on).
|
|
|
Logged
|
|
|
|
M Benesi
|
|
« Reply #20 on: January 03, 2013, 11:47:58 PM » |
|
Nice job. Fog shadows are pretty awesome.
|
|
|
Logged
|
|
|
|
eiffie
Guest
|
|
« Reply #21 on: January 04, 2013, 05:44:16 PM » |
|
Thanks Syntopia for explaining about the buffers - I also now see there is an init() in the vertex section - lol. I should have guessed you thought of those things already I would love to see the geometry shader IQ is working on!
|
|
|
Logged
|
|
|
|
eiffie
Guest
|
|
« Reply #22 on: January 05, 2013, 06:20:08 PM » |
|
Kali have you tried using your dynamic fractal waves (3d version) with this fog shadow effect? It should give a nice smokey look. I haven't been able to render a good example of it.
|
|
|
Logged
|
|
|
|
Kali
|
|
« Reply #23 on: January 05, 2013, 10:25:54 PM » |
|
I was thinking of finding a way for texturing the fog, I was going to try the 3DKaliset formula with some julias and low ierations, but the fractal waves could be a better idea also for animating, will give it a try when I find the time, thanks for the suggestion
|
|
|
Logged
|
|
|
|
|
knighty
Fractal Iambus
Posts: 819
|
|
« Reply #25 on: January 09, 2013, 03:55:39 PM » |
|
Great one effie! it could maybe be faster with the tricks described by the papers . I don't think it could then be feasible in fragmentarium. Kali: this last render is absolutely marvelous: atmosphere and sens of scale... perfect! Darkbeam: actually you can also do it in O(1): get angle then apply an infinite folding... I don't know how it is done in polyfold though.
|
|
|
Logged
|
|
|
|
Kali
|
|
« Reply #26 on: February 23, 2013, 01:04:39 AM » |
|
I came back to this thread to look for eiffie's optimization code I want to implement in Fragmentarium, and I noticed I didn't thank knighty's kind comment on "ARQ" render so... thanks knighty!! Now back to coding, wish me luck... I never used the buffer before
|
|
« Last Edit: February 23, 2013, 01:28:08 AM by Kali »
|
Logged
|
|
|
|
Kali
|
|
« Reply #27 on: February 27, 2013, 12:22:59 AM » |
|
After some problems, I got it working... I want to implement a few more things and I'll share the .frag. @eiffie: I implemented full 360º shadowmap, so mapping resolution is quite low. Does your original code make only 180º view shadow mapping? I mean, only fog shadows between light and camera are calculated? I'll maybe add a "shadowmap field of view" parameter. First test render:
|
|
« Last Edit: February 27, 2013, 12:24:58 AM by Kali »
|
Logged
|
|
|
|
eiffie
Guest
|
|
« Reply #28 on: February 27, 2013, 06:01:41 PM » |
|
I have done that to get quick shadows (180 and less) but for the fog effect I just use a bigger texture because I want the light moving "inside" a fractal.
|
|
|
Logged
|
|
|
|
Kali
|
|
« Reply #29 on: March 02, 2013, 03:56:29 AM » |
|
I have done that to get quick shadows (180 and less) but for the fog effect I just use a bigger texture because I want the light moving "inside" a fractal.
Yep, too bad I only have the alpha channel of the screen-size buffer to store things in Fragmentarium. But today I managed to put two shadowmaps in a floating point this way: encode: smap=min(50000,floor(smap1*1000))+fract(smap2/100); decode: if (lightdir.z>0) smap=floor(smap)/1000; else smap=fract(smap)*100; So I have two 180º maps, one on the integer part, and the other on the fractional part. I choose the right one based on light direction (lightdir.z>0), and as each one is the size of the screen, I have twice the resolution than before On the other hand, I have less distance accuracy (.001), but only noticeable in big zooms. Also fog shadow works only if object is at a max distance of 50 from light source, but it's far enough I think. I still want to have a better fog translucency approach, so I'll be working a bit more on the script before making it public.
|
|
« Last Edit: March 02, 2013, 05:26:53 PM by Kali »
|
Logged
|
|
|
|
|