Logo by fractalwizz - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. March 29, 2024, 01:17:07 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1] 2   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: "NODE Raytracer" for Fragmentarium  (Read 3512 times)
0 Members and 1 Guest are viewing this topic.
Kali
Fractal Supremo
*****
Posts: 1138


« 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 smiley - 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:





I'll be uploading new versions to this thread as I make some progress.

Any comments or suggestions are always welcomed.



* NODE.Raytracer.v0.1.frag (3.93 KB - downloaded 159 times.)
* RotJulia-NODE.frag (1.23 KB - downloaded 152 times.)
« Last Edit: March 11, 2013, 08:53:50 PM by Kali » Logged

Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #1 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.
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #2 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 smiley, 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  sad

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 wink
Logged

Kali
Fractal Supremo
*****
Posts: 1138


« Reply #3 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 wink

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...



* NODE.Raytracer.v0.11.frag (3.95 KB - downloaded 137 times.)
Logged

eiffie
Guest
« Reply #4 on: March 13, 2013, 09:03:42 PM »

Thanks Kali! I've been using this quite a bit already.
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #5 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.



Logged

Kali
Fractal Supremo
*****
Posts: 1138


« Reply #6 on: March 26, 2013, 06:09:12 AM »

Coming soon... 



RotJulia formula - diffuse+specular+ambient+AO+fog+DOF

I'll upload the .frag later, but first I have to resolve some issues.

Logged

Alef
Fractal Supremo
*****
Posts: 1174



WWW
« Reply #7 on: March 26, 2013, 06:44:20 PM »

Not bad. Some more artistic touch in coding.
Logged

fractal catalisator
eiffie
Guest
« Reply #8 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.
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #9 on: April 02, 2013, 06:59:29 AM »

Almost done...



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.


Logged

Kali
Fractal Supremo
*****
Posts: 1138


« Reply #10 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:

Logged

lxh
Iterator
*
Posts: 178


« Reply #11 on: April 10, 2013, 11:02:53 AM »

WOW THAT looks good, Kali! Congratulations! Volumetric render (smack) .. just love the translucence. cheesy
I wonder how long it renders. Looking forward to your competition contributions!  afro
Logged

I've learned so much by my mistakes that I'm planing to do some more.
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #12 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? wink - It renders very fast, but not so fast if you are used to GPU times smiley

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.
« Last Edit: April 11, 2013, 10:29:27 AM by Kali » Logged

tryptophan
Safarist
******
Posts: 86


« Reply #13 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.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #14 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 smiley deep sea exploration wink over a month time until deadline wink

Logged

---

divide and conquer - iterate and rule - chaos is No random!
Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
"True 3D" Mamdelbrot, solid based on orbit trapping animation 3D Fractal Generation David Makin 5 18374 Last post September 02, 2009, 10:23:26 PM
by David Makin
Special "offset" and "rotate" options from Fractallab possible in M3d-formula? Mandelbulb 3d « 1 2 » SaMMy 18 27401 Last post April 05, 2011, 12:20:52 PM
by DarkBeam
I had a vague idea that "fractal" was related to "pretty pictures" Meet & Greet Repomancer 5 7681 Last post October 10, 2012, 02:04:23 AM
by David Makin
""justme" ... just would like to introduce himself ... Meet & Greet justme 1 2224 Last post November 30, 2012, 01:17:26 PM
by cKleinhuis
"Node" Still Frame Zakar 0 674 Last post May 30, 2014, 10:14:18 PM
by Zakar

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.446 seconds with 28 queries. (Pretty URLs adds 0.052s, 2q)