Title: "NODE Raytracer" for Fragmentarium Post by: Kali on March 11, 2013, 08:47:18 PM This is my first attempt at writing my own Fragmentarium raytracer from scratch. I've done raytracing stuff before but always modifying the existing raytracers.
I always wanted a non-DE tracer to test formulas, so some time ago I was thinking of writing one by myself. But I still didn't know how to do some things, and then Syntopia made the nice Bruteforce Raytracer, so I abandoned the idea of making my own, as Mike's bruteforce was good enough for me :) - But yesterday I was thinking about it and some ideas came to my mind. So now that I understood how to use the buffers and other stuff, I decided to start with my own project. Obviously I took Syntopia's approach of using the buffer to store the depth map, as is the fastest way, with the only con of having to work with screen space for the normals. But I used a different method for finding the distance to the object, that I'll try to explain below (consider I didn't add comments to the code yet and I have the bad habit of not using very descriptive and friendly variable names at all :embarrass:) 1) Advance at fixed interval until ray is inside. 2) As the real limit is between "current position" and "current position - raystep", go 1/2 step back... if still inside, go 1/4 step back... if outside, go 1/4 step forward... and so on, dividing the raystep by 2 each time. The amount of times this search is performed, is specified with "SearchSteps" parameter (is this method the so called "binary search"?). This allows the use of not so small steps, and the surfaces still render good and pretty fast, but... 3) In the following subframes, I search for the pixels that have lower depths neighbors, and perform a "fine step" raytracing (controlled by FineStepScale parameter), because some details could be lost in the main fixed-step raytracing (i.e. the borders and small/thin structures). The raytrace starts at the depth of the neighbor pixel that has the nearest depth level so this recovery of lost pixels is also quite fast. However, if a non-connected part of the fractal is smaller/thinner than the raystep, it could be lost and the only solution is to lower the fixed-step, slowing down the render. The rest of the raytracer is still very rudimentary and it only features basic diffuse lighting with two sources, spotlight and camlight (please note spotlight direction is not relative to object but to camera, I'll fix this later) and distance fog... nothing more. No coloring, no AO (I still don't know how I'll do it), no shadows, etc. - so I have still a lot of work to do :hurt: - but even with the basic features of this early development stage, it's a nice tool for trying formulas without DE, and it's all included in a single .frag file. You only have to add to your .frag the "#include" line and a "bool inside" function that returns true if point is inside the fractal/object, then render in continuous mode, as with Syntopia's bruteforce (almost all the render is done in the first 2 frames, the rest is the missing parts recovery that takes a few more frames). Use MaxDistance and FixedStep parameters wisely, based on the zoom level and depth of the scene. By choosing them right you can achieve excellent rendering performances most of the times, but it depends on the depth of the scene you want to render. I attached the raytracer, and another .frag testing it with the rotjulia formula with this default parameters: (https://dl.dropbox.com/s/m9tq2xh31x3kun4/nodetest2.jpg?token_hash=AAFcYxA8zHlDa9tU_1NfrR1NlGQLOO_X4ik5Xp-mVTgGnQ) I'll be uploading new versions to this thread as I make some progress. Any comments or suggestions are always welcomed. Title: Re: "NODE Raytracer" for Fragmentarium Post by: Syntopia on March 11, 2013, 09:11:44 PM Looks great, Kali.
My first attempt with the brute force raytracer was also with fixed step ray marching, but I decided to try the stochastic method, because of the risk of stepping over thin structures (and also avoid introducing a parameter which has to be finetuned to the problem) - but perhaps the repair step is good enough to solve it. One suggestion: you might want to jitter the start distance for each point, so that there is less risk that neighbors points skip the same thin structure. Your image looks very smooth to me, so I probably should also employ a binary search for the final steps - my normals look more rough. It would require me to keep track of both the closest inside and outside point, though. Title: Re: "NODE Raytracer" for Fragmentarium Post by: Kali on March 11, 2013, 10:49:32 PM Looks great, Kali. Thanks. My first attempt with the brute force raytracer was also with fixed step ray marching, but I decided to try the stochastic method, because of the risk of stepping over thin structures (and also avoid introducing a parameter which has to be finetuned to the problem) - but perhaps the repair step is good enough to solve it. I think your method is probably better... Anyway I wanted to try something different instead of copying yours :), but to be honest, my results are despair... it works very well (and fast!) with objects without too much thin details, but with thin complex structures I have no remedy but to lower raysteps and therefore limiting the distance covered if I want to maintain a very short rendering time. And yes, too bad I have to finetune the params most of the time :sad1: One suggestion: you might want to jitter the start distance for each point, so that there is less risk that neighbors points skip the same thin structure. I thought it would introduce noise, but I tried it and works nice, thanks! Your image looks very smooth to me, so I probably should also employ a binary search for the final steps - my normals look more rough. I was surprised by how well this binary search works, if you implement it I think it will enhance your bruteforce renderer a lot ;) Title: Re: "NODE Raytracer" for Fragmentarium Post by: Kali on March 13, 2013, 07:20:43 PM v0.11: I changed the method for finding the missing parts... as fixed step + binary search works really fast, I used the consequent subframes for re-tracing the entire scene, but instead of jittering, changing the starting point each frame by adding a "progressive step" parameter that can be specified (off course marching the ray only to the last depth value found, and doing the binary search only if fixedstep finds a new lower depth).
Seems to work good enough, now I can move to the other features ;) EDIT: I forgot, also changed normal calculation for trying to avoid the thick black borders sometimes shown in the first version. Anyway normals still need some improvement... Title: Re: "NODE Raytracer" for Fragmentarium Post by: eiffie on March 13, 2013, 09:03:42 PM Thanks Kali! I've been using this quite a bit already.
Title: Re: "NODE Raytracer" for Fragmentarium Post by: Kali on March 18, 2013, 07:53:28 PM You are welcome eiffie, glad you are using it, I promise more features soon.
I tried some ambient occlusion approaches with good results but too slow for my taste, and I want to keep this raytracer AFAP. So I think I'll use something like Syntopia's "naive" AO method of his bruteforce raytracer, and maybe making the more accurate AO optional. Title: Re: "NODE Raytracer" for Fragmentarium Post by: Kali on March 26, 2013, 06:09:12 AM Coming soon...
(https://dl.dropbox.com/s/jybxyzfpw4zym7z/nodetestFF.jpg?token_hash=AAGPJnPcuWiNXus5drNWOxIZ1q4U8_vVFoDyGSlqf2rt9Q) RotJulia formula - diffuse+specular+ambient+AO+fog+DOF I'll upload the .frag later, but first I have to resolve some issues. Title: Re: "NODE Raytracer" for Fragmentarium Post by: Alef on March 26, 2013, 06:44:20 PM Not bad. Some more artistic touch in coding.
Title: Re: "NODE Raytracer" for Fragmentarium Post by: eiffie on March 27, 2013, 05:14:27 PM This is why I throw my code out there with issues - otherwise I would post nothing. Looks great btw.
Title: Re: "NODE Raytracer" for Fragmentarium Post by: Kali on April 02, 2013, 06:59:29 AM Almost done...
(https://dl.dropbox.com/s/qp781c3gj6jpglg/nodetest.jpg?token_hash=AAFMhX4SyLYABshWY35S6Hg51pvg2yQmWlen4e2QU74Dfg) I resolved a major issue with the lights, added gradient background & ambient light, improved DOF and I made a more precise (but much slower) ambient occlusion. Fast SSAO will be still available. Now I want to try an idea I have for a glow effect... and maybe tomorrow I'll be uploading the .frag to download section. @eiffie: you are right, I have a lot of unpublished stuff just because I want to make them better... including the volumetric light renderer, that works almost fine. Title: Re: "NODE Raytracer" for Fragmentarium Post by: Kali on April 10, 2013, 01:20:47 AM I uploaded version 0.9.1 to download section.
http://www.fractalforums.com/index.php?action=downloads;sa=view;down=48 Latest features added are volumetric render and glow. A test render using this features: (https://dl.dropbox.com/s/avx4i43rtjwrein/nodetest005.jpg?token_hash=AAH96pAEh3i_39uS8umPorpCmZ5Xc31esuSPJmhcxTF03A) Title: Re: "NODE Raytracer" for Fragmentarium Post by: lxh on April 10, 2013, 11:02:53 AM WOW THAT looks good, Kali! Congratulations! Volumetric render (smack) .. just love the translucence. :D
I wonder how long it renders. Looking forward to your competition contributions! O0 Title: Re: "NODE Raytracer" for Fragmentarium Post by: Kali on April 11, 2013, 10:27:51 AM Thanks lxh! It's an over-imposed volumetric rendering, but really looks like some translucence, isn't it? ;) - It renders very fast, but not so fast if you are used to GPU times :)
About the competition, in still images, it will be hard to beat M3D renderings like yours, now with volumetric light (I told you this feature was going to be added soon, remember?) And I don't know if I'll do something for the movie category... I'm not having a good moment and I think I just don't have the energy to put together a long film. Also I'm dissapointed there's no short animation this year, I could do well in that category. Title: Re: "NODE Raytracer" for Fragmentarium Post by: tryptophan on April 17, 2013, 08:47:07 PM That last image looks incredible! I'm going to try out that raytracer right now! Great work.
Title: Re: "NODE Raytracer" for Fragmentarium Post by: cKleinhuis on April 17, 2013, 09:01:22 PM Kali awesome organic rendering
hmm about the compoyou could make an awesomecollection of yourmoving sea creatures with awesome organic texture, dont let you down, i already have your movie in my head :) deep sea exploration ;) over a month time until deadline ;) Title: Re: "NODE Raytracer" for Fragmentarium Post by: eiffie on April 18, 2013, 05:54:17 PM Yeah Kali you could throw together a winning entry by tossing your old renders in the air and filming them in the order they fall :) don't bail on us.
Title: Re: "NODE Raytracer" for Fragmentarium Post by: Kali on April 18, 2013, 06:25:04 PM That last image looks incredible! I'm going to try out that raytracer right now! Great work. Thanks tryptophan. Good renders aren't automatically delivered with this tracer, though... you need to fine tune the parameters all the time... and as you will see, there are a lot of sliders to play with. Also works better with smooth surfaces... hard edges or complicated thin structures won't render with much quality. Theres' a basic documentation included, but feel free to ask if you need some more tips. Yeah Kali you could throw together a winning entry by tossing your old renders in the air and filming them in the order they fall :) don't bail on us. Well, thanks eiffie, and it's pretty much what I think I will be doing, maybe with the underwater creatures as Chris said, but as I mentioned before, I need to work on the camera movements to make a nice long video out of them. |