Logo by LAR2 - 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: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. April 26, 2024, 11:24:10 AM


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 ... 3 4 [5] 6 7 ... 16   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: updating of DE-Raytracer  (Read 38407 times)
Description: adding features in DE-raytracer: volumetric light, kaliset3d, clouds...
0 Members and 1 Guest are viewing this topic.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #60 on: April 10, 2015, 01:42:54 AM »

@eiffie for such a little bit of code... it's mesmerizing crazy eyes
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
SCORPION
Conqueror
*******
Posts: 104


« Reply #61 on: April 10, 2015, 01:50:06 AM »

eiffie code from running on shadertoy fragmentarium very good and fast !!!!

Code:
//Pseudo Knightyan by eiffie 
//Original shader: https://www.shadertoy.com/view/lls3Wf

#include "Progressive2D.frag"
uniform float time;
vec3 iResolution = vec3(1.0/pixelSize.x, 1.0/pixelSize.y, 1.0);

vec3 mcol=vec3(-1.0);
mat2 rmx;
int rotater=-1;
float DE(vec3 p){//knighty's pseudo kleinian
const vec3 CSize = vec3(0.63248,0.78632,0.875);
float DEfactor=1.;
for(int i=0;i<5;i++){
if(i==rotater)p.xy=p.xy*rmx;
p=2.*clamp(p, -CSize, CSize)-p;
float k=max(0.70968/dot(p,p),1.);
p*=k;DEfactor*=k;
}
if(mcol.r>=0.0)mcol+=abs(p);
float rxy=length(p.xy);
return max(rxy-0.92784, abs(rxy*p.z) / length(p))/DEfactor;
}
vec3 Normal(in vec3 p, in float px){
vec2 v=vec2(px*0.1,0.0);
vec3 n=normalize(vec3(DE(p+v.xyy)-DE(p-v.xyy),DE(p+v.yxy)-DE(p-v.yxy),DE(p+v.yyx)-DE(p-v.yyx)));
return (n==n)?n:vec3(0.0);
}
float randSeed;
void randomize(vec2 c){randSeed=fract(sin(dot(c,vec2(113.421,17.329)))*3134.1234);}
float rand(){return fract(sin(randSeed++)*3143.45345);}
vec3 path(float tyme){return vec3(cos(tyme),sin(tyme),-0.65+abs(sin(tyme*0.7))*0.25)*(2.0+sin(tyme*1.7)*0.5)+vec3(0.0,0.0,1.0);}
vec4 scene(vec3 ro, vec3 rd, float pathSlider, float tyme, float pxl) {
randomize(coord.xy+tyme);
vec3 LP=path(tyme+1.0),p;
LP.z+=pathSlider;
ro.z-=pathSlider;
float d=DE(ro)*0.8,t=d*rand(),nt=d,od=1.0,ft=0.0;//t=totalDist,nt=nextDistForRealDECheck,od=lastDist,ft=fogStepDist
vec4 col=vec4(0.0,0.0,0.0,1.0);
vec4 am,tm=vec4(-1.0);//stacks for hit alphas and dists
for(int i=0;i<99;i++){
//t+=d=DE(ro+rd*t);if(t>20.0 || d<0.001)break;
if(nt>t+ft){//prepare for fog step
p=ro+rd*(t+ft);
p+=(LP-p)*(-p.z)/(LP.z-p.z);//sample the point on the plane z=0
}else{//regular march
p=ro+rd*t;
}
d=DE(p);
if(nt>t+ft){//step thru the fog and light it up
float dL=0.05*length(ro+rd*(t+ft)-LP);//how far we step is based on distance to light
col.rgb+=col.a*vec3(1.0,1.0,0.7)*exp(-dL*40.0)*smoothstep(0.0,0.01,d);
if(t+ft+dL>nt){
ft=0.0;
t=nt;
if(t>20.0)break;
}else ft+=dL;
}else{//save edge samples and march
if(d<od && tm.w<0.0){
float alpha=clamp(d/(pxl*t),0.0,1.0);
if(alpha<0.95){
am=vec4(alpha,am.xyz);tm=vec4(t,tm.xyz);
col.a*=alpha;
}
}
od=d;
nt=t+d*(0.6+0.2*rand());
}
}
vec3 tcol=vec3(0.0);
for(int i=0;i<4;i++){//now surface lighting from the saved stack of hits
if(tm.x<0.0)continue;
mcol=vec3(0.0);
p=ro+rd*tm.x;
vec3 N=Normal(p,pxl*tm.x),L=LP-p,scol;
mcol=sin(mcol)*0.3+vec3(0.8,0.6,0.4);
float ls=exp(-dot(L,L)*0.2);
p+=L*(-p.z)/L.z;
L=normalize(L);
scol=ls*mcol*max(0.0,dot(N,L));
float v=max(0.0,dot(N,-rd));
scol+=exp(-t)*mcol*v;
d=smoothstep(0.0,0.005,DE(p));
scol+=ls*vec3(2.0,2.0,1.7)*max(0.0,dot(N,L))*d;
if(rd.z<0.0 && d>0.0)scol+=ls*vec3(4.0,3.0,1.4)*pow(max(0.0,dot(reflect(rd,N),L)),5.0)*(1.0-0.25*v)*d;
tcol=mix(scol,tcol,am.x);
am=am.yzwx;tm=tm.yzwx;
}
col.rgb=clamp(col.rgb+tcol,0.0,1.0);
return vec4(col.rgb,t);
}
mat3 lookat(vec3 fw){
fw=normalize(fw);vec3 rt=normalize(cross(fw,vec3(0.0,0.0,1.0)));return mat3(rt,cross(rt,fw),fw);
}

void SetCamera(inout vec3 ro, inout vec3 rd, inout float pathSlider,float tyme, vec2 uv){
ro=path(tyme);
vec3 ta=path(tyme+0.2);ta.z+=0.1;
rd=lookat(ta-ro)*normalize(vec3(uv,1.0));
tyme=mod(tyme,18.85);
rmx=mat2(cos(tyme),sin(tyme),-sin(tyme),cos(tyme));
rotater=5-int(tyme/3.1416);
pathSlider=1.0;
if(rotater==0)pathSlider=cos((tyme-15.707)*2.0);
}


vec3 color(vec2 J)
{
vec2 uv=(J.xy-iResolution.xy)/iResolution.y;
vec3 ro,rd;
float pathSlider;
SetCamera(ro,rd,pathSlider,time*0.125,uv);
vec4 scn=scene(ro,rd,pathSlider,time*0.125,3.0/iResolution.y);
return scn;
}

#preset default
Gamma = 2.08335
Brightness = 1
Contrast = 1
Saturation = 1
Center = 485.794,592.973
Zoom = 0.00228831
ToneMapping = 1
Exposure = 1
AARange = 2
AAExp = 1
GaussianAA = true
#endpreset



* rays.jpg (183.71 KB, 600x338 - viewed 348 times.)
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #62 on: April 10, 2015, 02:42:28 AM »

I think I know from who I'm going to steal something for my next shadertoy  evil
Logged

3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #63 on: April 10, 2015, 06:07:17 AM »

I did an interesting mod...

in Kn2-DE.frag @ line 588 add...
Code:
//wind direction
uniform vec3 WindDir; slider[(-1.0,-1.0,-1.0),(0.0,0.0,1.0),(1.0,1.0,1.0)]
//wind speed
uniform float WindSpeed; slider[0.0,1.0,2.0]
to the IQ_Clouds group of vars
and then change line 638 from...
Code:
vec3 ro=p0,rd=normalize(p1-p0),cloudDir=normalize(HF_Dir);
to...
Code:
vec3 ro=p0 + (WindSpeed*(WindDir*time)),rd=normalize(p1-p0),cloudDir=normalize(HF_Dir);
then add...
Code:
#define USE_IQ_CLOUDS
uniform float time;
before the de include line...
Code:
#include "DE-Kn2.frag"
to your fragment code
when you select "Animation" "Play" buttons in Fragmentarium gui the clouds move  wink
« Last Edit: April 10, 2015, 06:31:23 AM by 3dickulus, Reason: typo » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #64 on: April 10, 2015, 06:41:44 AM »

Thanks SCORPION!

But return scn.xyz  grin
Logged

knighty
Fractal Iambus
***
Posts: 819


« Reply #65 on: April 10, 2015, 08:06:52 PM »

Ooops! haven't finished that one. There are still lot of things to do. Any idea is welcome (Kali?).
Thank you 3Dickulus. I'll see what to steal from you modifications.  grin
Eiffie, is it possible to take a look at your rain code (if applicable)?
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #66 on: April 10, 2015, 08:39:23 PM »

Hi knighty! I have the same idea as you: stealing eiffie's 3D rain code  evil  angel

Haha.

But sure I'll come up with something when I found the time...



Logged

eiffie
Guest
« Reply #67 on: April 10, 2015, 09:55:13 PM »

Oh I don't have it with me but start a ray at a distance from the camera and march into a stretched perlin noise accumulating an alpha. I did about 6 march steps.
If you don't need 3d stick with Dave Hoskin's 2d rain which looks convincing.
https://www.shadertoy.com/view/4dsXWn
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #68 on: April 10, 2015, 10:18:20 PM »

Yeah, only some steps of volumetric renderings of fractals/noise and then animating and even adding distortions based on distance estimate or other functions, can do interesting effects and it's very fun to play with!

I did it in Hot Shower shadertoy and I have some .frags somewhere... when I posted flash anims here doing this some time ago, I'll look for this experiments back at home and share some ideas.



Logged

knighty
Fractal Iambus
***
Posts: 819


« Reply #69 on: April 12, 2015, 11:23:20 PM »

Thank you eiffie! only a handful iterations for such awesomeness? chapeau!
Logged
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #70 on: September 14, 2015, 05:57:39 PM »

@Kali, did you shared your ideas? ) I'm very interested in improoving of fragmentarium renderer.
Logged

Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #71 on: September 16, 2015, 07:24:15 PM »

@Crist - what do you need?
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #72 on: September 17, 2015, 07:18:11 PM »

@Crist - what do you need?
- Improove Godrays - they very very slowly
- Improove iq clouds - artifacts when increase distance. Maybe if that posible - combine clouds and godrays
- More complex AO  like SSAO or HBAO  embarrass
- Water effect on the floor? Or real water shader.
- Particles...

Logged

Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #73 on: September 24, 2015, 02:05:15 PM »

Improove Godrays - they very very slowly
→ These can be improved but won't be fast. It takes computation. I am working now on implementing iteration fog similar to the one that is in the mandelbulber software. Will take some more time though. My version of the raytracer has also extra support for more light sources for the volumetric fog.

- Improove iq clouds - artifacts when increase distance. Maybe if that possible - combine clouds and godrays
→ You can combine them with volumetric, but current clouds implementation is not volumetric. What I did was adding an extra layer of clouds (posted in my version of the raytracer). Moving these clouds to volumetric model will be a computing overkill.

- More complex AO  like SSAO or HBAO  embarrass
SSAO is not more advanced. It's simpler in fact. If you look at my raytracer I added a nice Dirt effect which makes use of the underlying AO. Currently (did not post this yet) you have already 3 modifiable effects based on AO which gives huge creative freedom and is not very computationally expensive.

- Water effect on the floor? Or real water shader.
→ In the simplest option that's just a matter of adding a bump map to the floor. Or you mean full raytraced water?

- Particles...
→ and what else huh? cheesy
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #74 on: October 03, 2015, 06:17:40 PM »

In first knighty`s version godrays faster because he used different way to create rays. I am not a programmer, so I don`t know details.
Yes I mean real volumetric clouds, which interact with light and objects.
Water - yes, real water shader )
When i sayed about AO i mean more realistic occlusion, like global illumination or Sky-Pathtracer. Your dirt-effect is interesting, but not what is needed...

I don't like this very dark borders and presence of AO in the lighted areas:
DE/GI/Sky
Logged

Pages: 1 ... 3 4 [5] 6 7 ... 16   Go Down
  Print  
 
Jump to:  


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.137 seconds with 25 queries. (Pretty URLs adds 0.011s, 2q)