Welcome to Fractal Forums

Fractal Software => Fragmentarium => Topic started by: Crist-JRoger on August 23, 2017, 11:51:14 AM




Title: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 23, 2017, 11:51:14 AM
Found here https://www.shadertoy.com/view/Xtt3Wn
Now I try to adapt this shader for Fragmentarium. So it's not "real" montecarlo like Eiffie`s GI or SunSky by Syntopia, but very cool for interior renders and more or less faster. I'll post shader soon when put the code in order  88)

(https://img11.deviantart.net/0416/i/2017/235/6/d/02_by_c_jr-dbl0w89.jpg) (https://orig03.deviantart.net/8403/f/2017/235/f/d/02_by_c_jr-dbl0w89.jpg)


Title: Re: Simple PathTracer with volumectic light
Post by: Sabine on August 23, 2017, 01:54:05 PM
 :o Cannot wait! :)


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 25, 2017, 02:29:24 PM
Okay  :embarrass: here it is. Need add speculars, soft shadows...
Run Menger to see. Please report if there are any errors.

(https://img07.deviantart.net/c001/i/2017/236/1/0/03_by_c_jr-dbl4k0z.jpg) (https://orig09.deviantart.net/2f13/f/2017/236/f/7/03_by_c_jr-dbl4k0z.jpg)


Title: Re: Simple PathTracer with volumectic light
Post by: Sabine on August 25, 2017, 03:01:34 PM
:o :o :o Crist-JRoger!!!!!!!!  :o :o :o
Shockingly beautiful :)  :yes: :thumbsup1:
Will test asap!

PS Please post on DA? More fragm-users needed !! ;)


Title: Re: Simple PathTracer with volumectic light
Post by: Sabine on August 25, 2017, 04:45:34 PM
Had some runs and found some glitches, but might also be me  :embarrass:

- Reflections of material do not seem to work
- Bokeh settings seem to do nothing
- Black or white dots on some renders (see below)

BUT from what I can see, it's looking good already!

Any chance for 3D spotlight, ambient light colour, camlight plus colour, and nice AO... and and and..? and then it would no longer be a simple shader  ;D ;D ;D
I am sorry, I get all greedy when I see something looking so great :dink:

Will let you know if I find more things not yet working well





Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 25, 2017, 05:28:15 PM
- Reflections - did you set Mat_ReflExp =1?

- Bokeh works, check attach on your PC  :)

- Dots... i see on your picture, but fragment looks clean on my Radeon  :hmh: So I will see why you have this artifacts. How many subframes on your render?


upd.: Something wrong with texturing. I'll fix it. Thank you!


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 25, 2017, 05:30:41 PM
:o :o :o Crist-JRoger!!!!!!!!  :o :o :o
Shockingly beautiful :)  :yes: :thumbsup1:
Will test asap!

PS Please post on DA? More fragm-users needed !! ;)
:embarrass: need to test, to test and... to test  :dink: 
And I think need ask permission from Inigo Quilez  O0


Title: Re: Simple PathTracer with volumectic light
Post by: Sabine on August 25, 2017, 05:35:15 PM
Just tested some more, now reflection works fine!  :embarrass: So, that was me in error! ;}

I hope he says Yes! ;)


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 25, 2017, 05:37:14 PM
black dots.. replace 178 string to
Code:
if(UseTexture)surfaceColor+=clamp(texcube(DeTex, pos*DeTexScale, nor ).xyz,0.0,1.0)*DeTexExposure;


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 25, 2017, 05:42:55 PM
 :pray2: GLSL gurus  :pray2: where are you? Does this renderer have a right to exist? My knowledge is not enough for make full renderer with all basic functions.


Title: Re: Simple PathTracer with volumectic light
Post by: 3dickulus on August 26, 2017, 03:35:42 AM
Very nice work CJR !!! simply by existing it has earned the right to exist ;)

I get lots of warnings at compile, varying deprecated etc. etc. I have made a few adjustments as I have learned that #version 400 does not cover the entire fragment, the line must also be in the vertex part and in the buffershader (vert and frag), also the sampler that uses tex.jpg should be initialized with an image that is in the distribution, like texture.jpg, and altered after loading by applying a preset, in the Default preset is good, so that when it compiles initially there are no errors but a warning will still be seen if the user doesn't have the texture you set in the Default preset.
hopefully that makes sense? frags attached :)

edit: IQ's shadertoy code is License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 (https://creativecommons.org/licenses/by-nc-sa/3.0/) you can review your obligations at the link


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 26, 2017, 09:29:04 AM
3dickulus, I have no warnings  :hmh: With or without version declare. I noticed that wanghash doesn't runs on intel gpu without declaring of version.
I didn't set any texture path to preset to avoid unnecessary warnings. But it's trifles.

Any artifacts on nvidia?


Title: Re: Simple PathTracer with volumectic light
Post by: 3dickulus on August 26, 2017, 05:42:37 PM
No artifacts, I have just now done a few tests on the zip I posted, with no clamp at lines 177 and 178 and no black dots after 1000 subframes :D

Before the changes I made to the files in the zip I posted above...
Code:
Tried path: ./Downloads/CJR/tex.jpg
Tried path: ./Fragmentarium/Examples/Include/tex.jpg
Could not resolve path for file: tex.jpg
9 locked variables: X,Y,Z,R,CycleColors,Cycles,RayBounces,RaySteps,MaxDepth
Tried path: ./Downloads/CJR
Tried path: ./Fragmentarium/Examples/Include
Could not resolve path for file:
Setting texture to:
Camera: Use W/S to fly. 1/3 adjusts speed. Q/E rolls. Click on 3D window for key focus. See Help Menu for more.
Created front and back buffers as RGBA32F
Maximum texture size: 16384x16384
Fragment shader compiled with warnings: Fragment info
-------------
0(176) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(177) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(178) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(179) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(180) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(181) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(186) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(187) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(188) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(189) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(190) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(329) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(382) : warning C7533: global variable gl_FragColor is deprecated after version 120

Not a valid texture: Fragmentarium/
Compiled script in 41 ms.
Found 'Default' preset. Executing...

After these changes...
Code:
Added texture: DeTex -> ./Fragmentarium/Examples/Include/texture.jpg
9 locked variables: X,Y,Z,R,CycleColors,Cycles,RayBounces,RaySteps,MaxDepth
Setting texture to: ./Fragmentarium/Examples/Include/texture.jpg
Camera: Use W/S to fly. 1/3 adjusts speed. Q/E rolls. Click on 3D window for key focus. See Help Menu for more.
Created front and back buffers as RGBA32F
Maximum texture size: 16384x16384
Compiled script in 42 ms.
Found 'Default' preset. Executing...

I will look at inserting the #version line from user frag (main window code editor) into vertex and fragment parts of main shader and buffer shader before sending code to GPU so that user only has to specify #version once , should warn if conflict. If DE.frag or 3D.frag or BufferShader.frag already have #version then the highest #version will be the minimum required. Using the compatibility flag will also take care of some conflicts.

again... excellent work  :beer:


edit: I have fixed up FragM's parser to to automatically add #version from user fragment to the vertex shader so it only needs to be specified once and both parts, fragment and vertex use it.


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 27, 2017, 12:37:21 PM
Thank you very much  :)
Another one, 2000 subframes. Some broken shadows...

(https://img08.deviantart.net/661b/i/2017/239/1/0/2017_08_27_113709_by_c_jr-dblgm1u.jpg) (https://orig05.deviantart.net/d5d2/f/2017/239/b/9/2017_08_27_113709_by_c_jr-dblgm1u.jpg)


Title: Re: Simple PathTracer with volumectic light
Post by: 3dickulus on August 27, 2017, 09:23:09 PM
Nice to see some activity in this area :) I have added code to FragM for putting #version line from fragment into vertex code, user just adds one line at the top of DE and Buffershader files.  Not on github yet but very soon ;)
I was also playing with rand wanghash stuff to see if it could resolve faster, cleaned up a little bit of code re:MathUtils.frag , seems to work?
Here is a 500 subframes image and fragment(s)...


Title: Re: Simple PathTracer with volumectic light
Post by: 3dickulus on August 28, 2017, 01:28:58 AM
@CJR off topic but here's a tip ;)

When using textures the defaults are usually ok but there are options for tweaking how textures are handled...

min = 1.0 = no filter
max = 16.0

this pic is labeled as subframes.anisotropy
(http://www.fractalforums.com/index.php?action=dlattach;topic=22320.0;attach=12078;image)

so for better quality....
Code:
uniform sampler2D DeTex; file[texture.jpg]
#TexParameter DeTex GL_TEXTURE_MAX_LEVEL 1000
#TexParameter DeTex GL_TEXTURE_WRAP_S GL_REPEAT
#TexParameter DeTex GL_TEXTURE_WRAP_T GL_REPEAT
#TexParameter DeTex GL_TEXTURE_MAG_FILTER GL_LINEAR
#TexParameter DeTex GL_TEXTURE_MIN_FILTER GL_LINEAR_MIPMAP_LINEAR
#TexParameter DeTex GL_TEXTURE_MAX_ANISOTROPY 16
Why so many lines to get one thing done? when user specifies a texture parameter the defaults are not used so user must specify all parameters.


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 28, 2017, 08:32:52 AM
I was also playing with rand wanghash stuff to see if it could resolve faster, cleaned up a little bit of code re:MathUtils.frag , seems to work?
As you wish. I just want add all rands funcrions into one place.
For now i trying add speculars... any help?  88)


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 28, 2017, 10:10:52 PM
ok, some specs... but looks not so good as I wish  :'(  The sun looks like little flashlight. Somrthing wrong in code  :headbatting:
Attached zip with fragments.
 
(https://img12.deviantart.net/0116/i/2017/240/d/8/specs_by_c_jr-dblmk6m.jpg) (https://orig00.deviantart.net/397b/f/2017/240/b/8/specs_by_c_jr-dblmk6m.jpg)


Title: Re: Simple PathTracer with volumectic light
Post by: 3dickulus on August 29, 2017, 01:57:46 AM
just testing with mandelbulb formula, I find that high iterations of MB cause black dots :( so clamp is needed  :embarrass: as in...
Code:
if(UseTexture)surfaceColor+=clamp(texcube(DeTex, pos*DeTexScale, nor ).xyz,0.0,1.0)*DeTexExposure;

imho : specular-ness results from surface hardness and surface reflectivness so if the math is right Material->Refl and Material->ReflExp should effectively create a specular surface ???

Edit: added burning-bulb, seems specular to me?


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 29, 2017, 08:23:37 AM
Too small renders!  :dink:
Reflect is reflect, specular is specular. Do not confuse. When refl parameter is too high, I agree, it looks like specs. But material like metal could not be reflected (in certain cases) and could has high spec patameter with hith specExp. For example, brushed stainless steel.
And all of that gives more properties of material.

Black dots... yes, need check on hard fractal or hard settings with a lot of iterations or high detail...


Title: Re: Simple PathTracer with volumectic light
Post by: Sabine on August 29, 2017, 10:54:16 PM
@Crist-JRoger Here too!! Tested your latest version, and get lots of black or white dots again (and they were so nicely vanished with the clamp added in ln 178!)  :'(
When I replaced your newest raytracer version with previous in the zip you posted up here, dots are gone :crazyeyes:


Title: Re: Simple PathTracer with volumectic light
Post by: Sabine on August 31, 2017, 04:34:40 PM
 :o This pathtracer is fantastic! Whatever I try with it looks much better than before


(http://nocache-nocookies.digitalgott.com/gallery/20/10093_31_08_17_4_31_05.png)


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 31, 2017, 06:14:40 PM
I'm very glad )
So, fractals with Kali's palette coloring will looks interesting i think  88)  Need to try it  88)
Now i play with SunSky, and it's most beautiful renderer for Fragmentarium. Fixed some black dots on my Radeon. Maybe it deserves new topic...

(https://img08.deviantart.net/13e3/i/2017/243/5/6/01_by_c_jr-dblxe8l.png) (https://orig08.deviantart.net/79eb/f/2017/243/1/7/01_by_c_jr-dblxe8l.png)


(https://img08.deviantart.net/ca37/i/2017/243/4/e/02_by_c_jr-dblxea0.png) (https://orig09.deviantart.net/8eb3/f/2017/243/e/b/02_by_c_jr-dblxea0.png)


Title: Re: Simple PathTracer with volumectic light
Post by: Sabine on August 31, 2017, 07:01:08 PM
yesyes, new topic:) I will try it here too, let's see what sunsky does on nvidia ;) But I hope you will also keep looking at newiqpath?


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on August 31, 2017, 11:18:35 PM
I'll do my best  :)
Recently i noticed (among other things) that SunSky renderer has perfect shadow code. I dreamed about this  88) here (http://www.fractalforums.com/fragmentarium/natural-shadow-blur/)
Now how it looks in SunSky, very realistic shadow blur

(https://orig06.deviantart.net/174c/f/2017/243/c/f/03_by_c_jr-dblyddq.jpg)


Title: Re: Simple PathTracer with volumectic light
Post by: Sabine on September 01, 2017, 10:08:21 AM
 :o :o :o

Ohh yes, I remember you asking how that could be done with these realistic shadows! Very cool!
This weekend I will try sunsky:)

And I am glad you won't forget the wonderful newiqpath! :dink:


Title: Re: Simple PathTracer with volumectic light
Post by: Tim Emit on September 01, 2017, 10:30:30 PM
Great work on this Crist ... Lovely images all. Only managed to have a quick peek but it looks very useable look forward to trying it out ..thanks as ever : )

(https://img08.deviantart.net/03fc/i/2017/244/e/9/mengnewiq_11_by_timemit-dbm1ypo.jpg)


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on September 11, 2017, 04:25:04 PM
Good render Tim!
Now I tested some closed fraclal scenes without any sky or spotlight access inside. So too dark! Need some CamLight or Abmient light inside the odject.
This renderer takes light only from background and spot light. Too bad I think. I have no idea how add camlight and save AO  :'(


Title: Re: Simple PathTracer with volumectic light
Post by: Tim Emit on September 19, 2017, 07:49:57 PM
thanks Crist..yes only light from outside so very dark interior, only a little light seeping in and at such an intensity as to almost burns : ) .. but still a very nice effect.


Title: Re: Simple PathTracer with volumectic light
Post by: Crist-JRoger on September 20, 2017, 08:36:32 AM
Attached new frags to 1st post. Updates:
- added floor with rotate
- added materials for every object like GI, see vec2 map(in vec3 z) function
- better de and shadows
- separate colors for background and ambience