Logo by dainbramage - 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: Visit us on facebook
 
*
Welcome, Guest. Please login or register. March 28, 2024, 09:32:33 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]   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: Fragmentarium scripts  (Read 1978 times)
Description: Some experimental scripts to share
0 Members and 1 Guest are viewing this topic.
Kali
Fractal Supremo
*****
Posts: 1138


« on: April 09, 2015, 04:09:27 AM »

Hi, I opened this topic to share some scripts I made and never made public because I wanted to improve them first.

I decided to share them anyway as they are, so use as you want and feel free to modify and improve them.
It would be nice to have any mod posted here, though.

The first script is called "Cosmos", based on "Star Nest" shader I published at Shadertoy site.

Some presets are included. Latest Fragmentarium version is required: http://blog.hvidtfeldts.net/index.php/2013/09/fragmentarium-version-1-0-cologne-released/

Notes:
-Don't take too seriously the name of the parameters (like "contrast") as they don't behave exactly as the name suggests smiley
-When adding iterations or making other adjustments you must find the balance to adjust others so the brightness/contrast thing matches good results.
-When using dither parameter it requires a lot of subframes, like in presets 5 & 6
-Use FOV to zoom in/out without altering the image.

Also you can use Post tab for postprocessing included in Fragmentarium's 3D.frag

To do:
-Animation options, but the volumetric steps should fall in the same part of the fractal as the camera moves. Otherwise the effect is still nice but objects will behave as "pulsing".
(I think I made this fix somewhere in other experiments but finding things in the messy fractal that my hard disk is could take some time haha.)
-Some autobalance algorithm for not having to adjust parameters constantly.
-Whatever else anybody would like to do with it.

* cosmos.frag (7.07 KB - downloaded 126 times.)

* cosmos.jpg (216.86 KB, 877x518 - viewed 287 times.)
« Last Edit: April 09, 2015, 04:20:08 AM by Kali » Logged

SCORPION
Conqueror
*******
Posts: 104


« Reply #1 on: April 09, 2015, 11:42:57 AM »

Thank you Kali!
Option 2D of https://www.shadertoy.com/view/XlfGRj.

Code:
#include "Progressive2D.frag"
uniform float time;
vec3 iResolution = vec3(1.0/pixelSize.x, 1.0/pixelSize.y, 1.0);
uniform vec3 iMouse; slider[(-720,-720,0),(0,0,0),(720,720,1)]
float iGlobalTime = time;

// Star Nest by Pablo Román Andrioli
// This content is under the MIT License.

uniform int iterations;  slider[0,17,50]
uniform float formuparam; slider[0,0.53,1]
uniform float volsteps; slider[0,20,40]
uniform float stepsize; slider[0,0.1,0.15]
uniform float zoom; slider[0,0.8,5]
uniform float tile; slider[0,0.850,1]
uniform float speed; slider[0,0.01,0.1]
uniform float brightness; slider[0,0.0015,0.01]
uniform float darkmatter; slider[0,0.3,1]
uniform float distfading; slider[0,0.730,1]
uniform float saturation; slider[0,0.850,1]

vec3 color(vec2 J)
{
//get coords and direction
vec2 uv=J.xy/iResolution.xy;
uv.y*=iResolution.y/iResolution.x;
vec3 dir=vec3(uv*zoom,1.);
float time=iGlobalTime*speed+.25;

//mouse rotation
float a1=.5+iMouse.x/iResolution.x*2.;
float a2=.8+iMouse.y/iResolution.y*2.;
mat2 rot1=mat2(cos(a1),sin(a1),-sin(a1),cos(a1));
mat2 rot2=mat2(cos(a2),sin(a2),-sin(a2),cos(a2));
dir.xz*=rot1;
dir.xy*=rot2;
vec3 from=vec3(1.,.5,0.5);
from+=vec3(time*2.,time,-2.);
from.xz*=rot1;
from.xy*=rot2;

//volumetric rendering
float s=0.1,fade=1.;
vec3 v=vec3(0.);
for (int r=0; r<volsteps; r++) {
vec3 p=from+s*dir*.5;
p = abs(vec3(tile)-mod(p,vec3(tile*2.))); // tiling fold
float pa,a=pa=0.;
for (int i=0; i<iterations; i++) {
p=abs(p)/dot(p,p)-formuparam; // the magic formula
a+=abs(length(p)-pa); // absolute sum of average change
pa=length(p);
}
float dm=max(0.,darkmatter-a*a*.001); //dark matter
a*=a*a; // add contrast
if (r>6) fade*=1.-dm; // dark matter, don't render near
//v+=vec3(dm,dm*.5,0.);
v+=fade;
v+=vec3(s,s*s,s*s*s*s)*a*brightness*fade; // coloring based on distance
fade*=distfading; // distance fading
s+=stepsize;
}
v=mix(vec3(length(v)),v,saturation); //color adjust
return v*.01;

}

#preset default
Center = -2.5937,-7.07992
Zoom = 0.00429325
Gamma = 1.1818
ToneMapping = 1
Exposure = 2.2341
Brightness = 0.5263
Contrast = 0.92235
Saturation = 1.26315
AARange = 1.46482
AAExp = 1
GaussianAA = false
iMouse = 0,0,0
iterations = 17
formuparam = 0.53
volsteps = 20
zoom = 0.8
tile = 0.85
speed = 0.01
brightness = 0.0015
darkmatter = 0.3
distfading = 0.73
saturation = 0.85
stepsize = 0.1
#endpreset
« Last Edit: April 09, 2015, 02:18:19 PM by SCORPION » Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #2 on: April 09, 2015, 12:48:11 PM »

Nice conversion, thanks!  A Beer Cup

Had to fix "return v*.01" instead of "return vec4(v*.01,1.)", could you edit your posted code?
Logged

SCORPION
Conqueror
*******
Posts: 104


« Reply #3 on: April 09, 2015, 02:22:06 PM »

I corrected! Thank you Kali
Logged
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #4 on: September 14, 2015, 06:24:10 PM »

Very nice and very quickly script! Thank you for sharing this.
Logged

Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
having fun with fragmentarium Images Showcase (Rate My Fractal) ker2x 5 2246 Last post January 14, 2012, 12:26:39 PM
by ker2x
Fragmentarium 0.9.1 Released Fragmentarium « 1 2 » Syntopia 19 4573 Last post June 10, 2012, 10:27:46 AM
by Syntopia
Fragmentarium v0.9.12 released Fragmentarium Syntopia 6 2731 Last post November 06, 2012, 05:27:35 PM
by Syntopia
Help in Fragmentarium Fragmentarium Tim Emit 2 832 Last post January 15, 2013, 10:05:24 PM
by Tim Emit
Fragmentarium español Leonrott 4 3439 Last post January 09, 2014, 02:07:16 PM
by stereoman

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