![](../../I/Screenshot_20170818_214104.png.webp)
Fragmentarium is an open source, cross-platform IDE by Mikael Hvidtfeldt Christensen [1] for exploring pixel based graphics on the GPU. It is inspired by Adobe's Pixel Bender, but uses GLSL, and is created specifically with fractals and generative systems in mind."
Features:
- Multi-tabbed IDE, with GLSL syntax highlighting
- User widgets to manipulate parameter settings.
- Different 'mouse to GLSL' mapping schemes
- Modular GLSL programming - include other fragments
- Includes simple raytracer for distance estimated systems
- Many examples including Mandelbulb, Mandelbox, Kaleidoscopic IFS, and Julia Quaternion.
Licensed and distributed under the LPGL or GPL license.
Notice: some fragment (GLSL) shaders are copyright by other authors, and may carry other licenses. Please check the fragment file header before redistributing.
Please read the FAQ, before asking questions. [2]
For examples of images take a look at the FF Fragmentarium galleries.[3][4]
More information can be found at: FractalForums.com -> Fragmentarium [5] and FractalForums.org -> Fragmentarium[6]
This the unofficial wiki about it.
Intro
Fragmentarium comes in a few different flavors. The major differences are...
- Version 1.0 has only the "time" variable for animating.
- Version 1.0.31 introduces camera position Catmull-Rom spline based keyframing, parameter morphing with easing curves, target tracking auto focus, OpenEXR format input for textures and output for images, along with German, Dutch and Russian translations.
- Version 2.0.0 brings samplerCube textures and double precision uniform widgets.
Get v1.0
Precompiled Mac and Windows executable packages can be found at syntopia.github[7]
or on Ubuntu Linux...
Prerequisites
cmake 3 Qt 4 C++ compiler OpenGL development libs Git (if fetching the source directly from the repository) sudo apt-get install build-essential libx11-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libxext-dev libqt4-opengl-dev git clone https://github.com/Syntopia/Fragmentarium
Build
cd Fragmentarium-master cd Fragmentarium-Source cd "Build - Linux" ( there are also build folders for Mac OSX, Windows and QCreator with build scripts. ) sh build.sh
Run
Go to the ~/Fragmentarium-master/Fragmentarium-Source directory, then run Gui program :
cd ~/Fragmentarium-master/Fragmentarium-Source ./Fragmentarium-Source
Note: at this point it would be a good idea to move the Examples, Icons and Misc folders with the Fragmentarium executable into a suitable working folder and change the name of the Fragmentarium-Source.exe file.
Get v1.0.31
Windows installer can be found at Digilanti.org[8]
Windows users can download the 6.0M Fragmentarium Installer and run it by navigating to your Downloads folder and clicking the installer icon.
This will install the Windows Executable + Examples Includes and Misc folders + Qt 5.6.2 runtime DLLs + GUI translation files into a working folder in your home folder with startmenu shortcuts to the executable and the Maintenance program.
Source Code
Download Fragmentarium 1.0.31 sources bundled with OpenEXR sources or the smaller archive with precompiled static OpenEXR libs.
For windows the compile scripts expect to find the source in top level of C: drive so extract the archive there or adjust the pathnames in the windows bat file.
Note: the v1.0.31 sources are available on request as development is in the v2.0 branch from here on.
Prerequisites
CMake 3 + CMake-gui Qt 5.6 C++ compiler OpenGL
The above packages should be installed along with their corresponding development packages.
Git (if fetching the source directly from the repository)
Build
Windows
After installing Qt v5.6 and MinGW v4.9.2
Start Menu/Programs/Qt Tools/5.6/MinGW 4.9.2 (32-bit)/Qt 5.6 for Desktop (MinGW 4.9.2 32 bit) cd C:/Fragmentarium-1.0.31-3Dickulus/ mkmingw
This will build OpenEXR and the Fragmentarium project and install the executable with support files to C:/Fragmentarium-1.0.31-3Dickulus/Fragmentarium folder, this folder can then be relocated to wherever you like.
Linux
The archive can be extracted anywhere and the standard development environment with Qt5 OpenGL and OpenEXR should suffice.
cd <wherever>/Fragmentarium-1.0.31-3Dickulus/ sh ./mklinux.sh
This will build OpenEXR and the Fragmentarium project and install the executable and support files to <wherever>/Fragmentarium-1.0.31-3Dickulus/Fragmentarium folder, this folder can then be relocated to wherever you like.
To build Fragmentarium only, after running one of the scripts...
cd <wherever>/Fragmentarium-1.0.31-3Dickulus/Fragmentarium-Source/build cmake-gui .. ( to change any paths or precompile flags like the install prefix ) cmake-gui->configure cmake-gui->generate cmake-gui->quit make install
Get v2.0.0
Ubuntu
Precompiled Ubuntu 14.04.5 package at github.com [9] requires Qt v5.7
or to compile from source on Ubuntu "trusty"
Install gcc-4.8
sudo add-apt-repository -y ppa:ubuntu-sdk-team/ppa sudo apt-get update -qq sudo apt-get -qq install g++-4.8 libc6-i386
Install Qt-5.7
sudo apt-add-repository -y ppa:beineri/opt-qt571-trusty sudo apt-get update -qq sudo apt-get install qtcreator-latest
Install openexr-2.2 development + runtime
sudo apt-add-repository -y ppa:thomas-schiex/blender sudo apt-get update -qq sudo apt-get install libilmbase-dev sudo apt-get install libopenexr-dev sudo apt-get install libilmbase12 sudo apt-get install libopenexr22
Install Extra-CMake-Modules for FindOpenEXR()
sudo apt-get install extra-cmake-modules source /opt/qt57/bin/qt57-env.sh
Grab the source
git clone https://github.com/3Dickulus/FragM
Build and install
cd FragM/Fragmentarium-Source mkdir build cd build cmake -DNVIDIAGL4PLUS=ON -DUSE_OPEN_EXR=ON -DCMAKE_INSTALL_PREFIX=~/ .. make install
- The above will install in /home/username/Fragmentarium folder with includes and support files.
- To install for all users change -DCMAKE_INSTALL_PREFIX=~/ to -DCMAKE_INSTALL_PREFIX=/usr/local and use sudo make install
SuSE Leap 42.2
Prerequisites for Linux SuSE Leap 42.2 rpm package at github.com [10]
System Desktop
OpenEXR 2.1
Qt 5.6
Build
Install git and the latest CMake and CMake-GUI programs along with ECM (Extra CMake Modules) and the standard development environment for Qt5 and OpenEXR
git clone https://github.com/3Dickulus/FragM cd FragM/Fragmentarium-Source mkdir build cd build cmake-gui .. (note: set USE_OPEN_EXR=OFF when OpenEXR is not available/desired) make -j4 make install (note: set the install prefix in cmake-gui before running make install, it will install to /usr/local by default, user home folder is OK.)
Mac OSX dmg
Prerequisites for Mac OSX (this is what was required to build on travis-ci.org)
brew update brew tab homebrew/versions brew unlink gcc brew install gcc48 brew install qt5 brew install ilmbase openexr brew unlink openexr brew link --overwrite openexr brew unlink ilmbase brew link --overwrite ilmbase brew unlink cmake brew install cmake brew install git
Before calling cmake these env vars need to be set...
export PATH="$QTDIR/bin:$PATH" export PATH=/usr/local/bin:$PATH export CC=/usr/local/bin/gcc-4.8 export CXX=/usr/local/bin/g++-4.8 export QTDIR="/usr/local/opt/qt" export LDFLAGS="-L/usr/local/opt/qt/lib" export CPPFLAGS="-I/usr/local/opt/qt/include"
Grab the source...
git clone https://github.com/3Dickulus/FragM
Then to build, execute the following...
cd FragM/Fragmentarium-Source mkdir build cd build cmake -DNVIDIAGL4PLUS=ON -DUSE_OPEN_EXR=ON -DCMAKE_INSTALL_PREFIX=../../ .. make install
And to build a dmg archive...
cd ../../Fragmentarium-2.0.b macdeployqt ./Fragmentarium-2.0.b.app -dmg mv ./Fragmentarium-2.0.b.dmg ../Fragmentarium-Source/build/Fragmentarium-2.0.b-my_build.dmg cd ../Fragmentarium-Source/build
...this should create a file named Fragmentarium-2.0.b-my_build.dmg in the build folder.
Now that you have it installed ;)
Open syntopia.github[11] in your browser to learn about preprocessor commands, magical uniforms and GUI elements.
Open blog.hvidtfeldts[12] in your browser to learn about the math behind path tracing 3D fractals and the GLSL code.
The information found at the v1.0 Syntopia links is valid for all versions of Fragmentarium.
GUI Usage
Run from the desktop by clicking the icon for the executable file. You can drag and drop .frag , .fragparams and .png screenshot files onto the main window and Fragmentarium will open a new tab for a .frag file or apply the parameter settings to the current fragment. Settings are stored in screen shot png files in a chunk named "frAg" and are automatically recognized by Fragmentarium.
Commandline Usage
./Fragmentarium-2.0.b [options] [filename.frag] <enter> Output: Fragmentarium is a cross-platform IDE for exploring pixel based GPU graphics. Options: -h, --help Displays this help. -v, --version Displays version information. --style <style> sets the application GUI style. Possible values are 'Breeze','Windows','GTK+','Fusion'. -l, --language <language> sets the application language. Possible values are 'en','de','ru','nl'. -s, --script <script> Fragmentarium command script file to load. Arguments: filename.frag initial fragment to open.
Troubleshooting
OpenGL version mismatch
FragM 2 expects an OpenGL 4.1 Compatibility Profile context. Some drivers provide a lower version in Compatibility Profile, reserving higher versions for Core Profile.
Check it :
glxinfo | grep "core profile"
Unfortunately if FragM gets a lower version, it can crash on startup with a segmentation fault.
Mesa
Check if you are using MESA:
glxinfo | grep version
If using Mesa for OpenGL (most commonly on Linux with Free/Libre Open Source drivers) you can force Mesa to lie about its capabilities by setting an environment variable in the shell before launching FragM:
export MESA_GL_VERSION_OVERRIDE="4.6COMPAT"
This may however merely postpone crashes until unsupported features are invoked. Use at your own risk.
Files & Folders
Examples
Contains 233 files in 16 sub-folders, this tree is duplicated in the Examples menu, just select one and it will be loaded into a new tab.
Examples/Tutorials
Contains 19 tutorial frags that demonstrate specific features or techniques.
The rest of the folders in Examples/ contain frags from a number of contributors, see Acknowledgements
fqScript
Contains some example Fragmentarium Qt Script files that can be loaded, edited, executed and saved from within Fragmentarium.
Misc
Contains options files for the video encoders, this folder is also intended for tool scripts like mkcombined.sh and the glsl.xml that describes highlighting for the code editor, at the end of glsl.xml there are places for user selectable colors and style hints so one can customize the highlighting to their own tastes.
Languages
Contains GUI translation files for Dutch, German and Russian contributed by Sabine, Crist-JRoger and SCORPION.
Main Window
![](../../I/Screenshot_20170818_214104.png.webp)
Top , Program Menus and dynamic menus
Tool Bar , Buffer size, Build, Progressive/Animation stop start rewind, Subframe setting and readout, Current time setting and readout.
Left , Fragment editor, hide by dragging the splitter bar all the way to the left
Middle , GL rendering area
Right , Variable widgets (uniforms) dock window, can float or be hidden
Bottom , Log dock window, can float or be hidden
Status Bar , relays info messages, has XYZ readout for cursor pos, rendered frames per second.
Menus
File
New : Creates a new tab with a simple DE function. Open : Creates a new tab and loads the selected fragment file. Save : Writes the currently active tab to file. Save As : Writes the currently active tab to filename selected by user. Recent files list : History. Close Tab : Closes the currently active tab and associated windows. Exit Application : Quits Framentarium, user will be prompted if there are unsaved changes.
Edit
Cut : Cuts selected text to clipboard. Copy : Copies selected text to clipboard. Paste : Pastes current clipboard contents. Find : Locate selected text, if no selected text request user input. Shader Asm : Displays GPU assembler code for currently active shaders. (nVidia only) Indent Script : Indent selected text. Insert Command -> Preprocessor Commands : Inserts the selected preprocessor command at the cursor or replaces selected text. Special Uniforms : Inserts the selected uniform variable at the cursor or replaces selected text. Include File (from Preferences Path) : Creates an #include fileName statement at the current cursor position. Insert Preset (from Current Settings) : Appends a new named preset to the text editor. Add Easing Curve : Creates easingcurve settings for the currently selected slider. Add Key Frame : Appends a preset with only camera position information. Select Key Frame : Highlights the text associated with the currently listed keyframe from the variable editor pulldown menu. Preferencess : Global program settings.
Render
Build Systems : Compiles the shaders. High Resolution and Animation Render : Opens the rendering dialog. Output Preprocessed Script (debug) : Creates a new tab with the main fragment script after parsing all included files. Full Screen (ESC key toggle) : Switch to full screen mode. Save Screen Shot : Saves the current GL area. When image format is png the settings are saved in the "fRAg" chunk, Fragmentarium will recognize this chunk if the screen shot png file is dragged and dropped onto the main window and will attempt to apply those settings to the current fragment. Edit Command Script : Opens a simple editor and allows creating, loading and running a .fqs file, see fqScript folder for examples. Video Encoding : Opens a dialog where the user can select mencoder or ffmpeg to create videos from a folder of generated images.
Parameters
Reset All : Resets all uniforms to their specified default values. Copy Settings : Copies all variable settings to the clipboard. Copy Group : Copies a single group (variable editor tab) to the clipboard. Paste from Clipboard : Pastes clipbaord contents into variable editor. Paste Selected Text : Pastes the selected text (usually from a preset in the code window) into the variable editor. Save to File : Creates a parameters file. Load from File : Loads a parameters file.
Examples
This menu is populated dynamically at runtime from the contents of the currently active Examples folder. Selecting a fragment will load the file into a new tab and execute build.
Windows
These are parts of the main window that can be displayed or hidden. Right mouse button click in the empty part of the menu bar will show this menu as a popup.
Log Variable Editor (uniforms) File Toolbar Edit Toolbar Buffer Dimensions Render Toolbar Rendering Mode Zappa Tools Time
Help
These should be self explanitory.
About Show Welcome Note Mouse and Keyboard Help Scripting General Help Scripting Parameter Help Scripting Image Anim Dialog Help Scripting Control Help Clear Texture Cache Project Homepage (web link) Fragmentarium@FractalForums (web link) Fragmentarium 3Dickulus (web link) Flickr Fragmentarium Group (web link) GLSL Specifications (web link) Introduction to Distance Estimated Fractals (web link) Fragmentarium FAQ (web link)
EXR Tools
When OpenEXR is installed on your system this menu should be populated with these commands. Selecting a command from this menu will display a usage help dialog, these are all commandline programs and only information about the command is shown here.
exrenvmap exrheader exrmakepreview exrmaketiled exrmultipart exrmultiview exrstdattr
If the EXR Tools menu exists but shows no entries you can set the EXR binaries path via Preferences... from the Edit menu.
Main Window Dialogs
High Resolution and Animation Render : Opens the render dialog. Here you can render a single image or a range of images for animation. | ![]() High Resolution and Animation Dialog |
Easing Curves : This dialog represents the easing options available for the currently selected slider. | ![]() Easing Curve Dialog |
Timeline : A crude representation of keframes and easing curves, still under development. | ![]() Timeline Dialog |
Preferences : Main program global options. | ![]() Preferences Dialog |
Video Encoding : To setup mencoder or ffmpeg, some example options files are in the Misc folder. | ![]() Video Encoding Dialog |
Scripting
Fragmentarium can be controlled via scripting commands available in fqscript files.
General commands
void setFrame(int);
Sets the current frame number.
int getFrame();
Returns the current frame number.
void loadFragFile(String);
Opens a new editor tab, loads the named fragment file, initializes default preset, initializes keyframes and easing curves if the file contains these settings.
bool initializeFragment();
Returns success or fail. Must be called after altering a locked variable before rendering an image.
Parameter commands
void setParameter(String);
Set a parameter from String in the form of "parameter = value" also accepts parameter file formated string.
void setParameter(String, bool);
Sets a boolean parameter where String is the parameter name and bool is TRUE or FALSE
void setParameter(String, int);
Sets an integer parameter where String is the parameter name and int is any integer.
void setParameter(String, x);
Sets a float parameter where String is the parameter name and x is any floating point number.
void setParameter(String, x, y);
Sets a float2 parameter where String is the parameter name and x,y are any floating point numbers.
void setParameter(String, x, y, z);
Sets a float3 parameter where String is the parameter name and x,y,z are any floating point numbers.
void setParameter(String, x, y, z, w);
Sets a float4 parameter where String is the parameter name and x,y,z,w are any floating point numbers.
String getParameter(String);
Returns a string representing the value(s) for the named parameter, user must parse this into usable values.
void applyPresetByName(String);
Applies the named preset.
Hires image and animation dialog commands
void setAnimationLength(int);
Sets the total animation duration in seconds.
void setTileWidth(int); void setTileHeight(int);
Sets the tile width and height.
void setTileMax(int);
Sets the number of row and column tiles, this value squared = total tiles.
void setSubFrames(int);
Sets the number of frames to accumulate.
void setOutputBaseFileName(String);
Sets the filename for saved image, if script has total control this must be set by the script for every frame, if animation is using frag file settings, keyframes etc., then this only needs to be set once to basename and Fragmentarium will add an index padded to 5 digits.
void setFps(int);
Sets the frames per second for rendering.
void setStartFrame(int);
Sets the start frame number for rendering a range of frames.
void setEndFrame(int);
Sets the end frame number for rendering a range of frames.
void setAnimation(bool);
FALSE sets animation to script control exclusively. TRUE enables control from keyframes and easing curves.
void setPreview(bool);
TRUE will preview frames in a window on the desktop instead of saving image files.
Control commands
bool scriptRunning();
Returns FALSE when the user selects the [Stop] button in the script editor. For user implemented test in script to break out of the script control loop.
void stopScript();
For user implemented test in script to break out of the script control loop or error like file not found, initialization fail etc.
void tileBasedRender();
Begins rendering the current frame or range of frames applying the current state for keyframes and active easing settings.
Preprocessor Commands
(from syntopia.github.io) Fragmentarium adds a few additional preprocessor commands.
#include "some.frag"
Simply includes the referenced file. If the filename is a relative filename, Fragmentarium first searches for the file relative to the location of the current executing file (if it is saved), otherwise the paths specified in the 'include path' preference are searched.
#camera 3D
Tells Fragmentarium to setup a 3D camera model, making it possible to adjust the camera using the mouse on the canvas.
#camera 2D
Tells Fragmentarium to setup a 2D camera model.
#group parameter group name
Makes it possible to order GUI elements in groups.
#info "hello there"
Outputs info when compiling the fragment. Useful for attributions.
#includeonly "some.frag"
Experimental. Includes 'some.frag', but will ignore any 'include' commands in that file.
#replace "before" "after"
Experimental. Replaces the given patterns in all subsequent read lines (not in previously parsed lines).
#donotrun
Tells Fragmentarium that it should not attempt to run this file - it is meant be included from another file.
#preset name
Marks the beginning of a section with parameter settings. These will appear in a drop-down combobox in the parameter editor window.
#endpreset
Marks the end of a section with parameter settings.
Uniform Widgets
The line: uniform float Angle; slider[45.00,0,360] in the GLSL editor will make a simple variable editor widget appear.
To create widgets for other types of uniforms...
uniform type name ; widget[min,default,max] locktype
The keyword uniform must always be present at the beginning of the line.
locktype can be one of locked notlocked notlockable alwayslocked defaults to notlocked
In the Menu/Edit/Preferences dialog you can select the behavior of lock handling.
"Locked" uniforms can be interpreted as "#define"s or as "const"s in the final GLSL code that gets sent to the GPU.
type and widget can be one of these GLSL valid types and corresponding Fragmentarium widgets...
v1.0 - v1.0.31
Type | Widget | ||
---|---|---|---|
uniform | int | name; | slider[min,default,max] |
uniform | bool | name; | checkbox[true or false] |
uniform | float | name; | slider[min,default,max] |
uniform | vec2 | name; | slider[(min,min),(default,default),(max,max)] |
uniform | vec3 | name; | slider[(min,min,min),(default,default,default),(max,max,max)] |
uniform | vec4 | name; | slider[(min,min,min,min),(default,default,default,default),(max,max,max,max)] |
uniform | vec3 | name; | color[R,G,B] color selector only |
uniform | vec4 | name; | color[min,default,max, R, G, B] slider with color selector |
uniform | sampler2D | name; | file[imageFileName] can be any supported format |
v2.0
All of v1.0 - v1.0.31 plus these...
Type | Widget | ||
---|---|---|---|
uniform | samplerCube | name; | file[cubemap.png] |
uniform | double | name; | slider[min,default,max] |
uniform | dvec2 | name; | slider[(min,min),(default,default),(max,max)] |
uniform | dvec3 | name; | slider[(min,min,min),(default,default,default),(max,max,max)] |
uniform | dvec4 | name; | slider[(min,min,min,min),(default,default,default,default),(max,max,max,max)] |
uniform | dvec3 | name; | color[R,G,B] color selector only |
uniform | dvec4 | name; | color[min,default,max, R, G, B] slider with color selector |
All float type sliders have 7 decimal places while double types have 14.
Tutorials
00 - Simple 2D system.frag |
---|
00 - Simple 2D system.frag |
1 #include "2D.frag"
2
3 // The simplest way to draw something in Fragmentarium,
4 // is to include the "2D.frag" header.
5 //
6 // Now, we can implement a simple 'color' function,
7 // which for each point in the plane returns a RGB color.
8 //
9 // Notice, that you can zoom using the mouse or the keyboard.
10 // (A,S,D,W,Q,E,1,3)
11
12 vec3 color(vec2 c) {
13 return vec3(cos(c.x),sin(c.y),sin(c.x*c.y));
14 }
|
01 - Simple 2D Escape Time Fractal.frag |
---|
01 - Simple 2D Escape Time Fractal.frag |
1 #include "2DJulia.frag"
2 #include "Complex.frag"
3
4 // Escape time fractals iterate a functions for each point
5 // in the plane, and check if the sequence generated converges.
6 //
7 // The "2DJulia.frag" helper file makes it easy to generate
8 // these kind of systems.
9 //
10 // Just implement the 'formula' function below.
11 // It is possible to draw Mandelbrots and Julias
12 // and customize the coloring.
13 //
14 // Here is an example of a Mandelbrot:
15
16 vec2 formula(vec2 z, vec2 offset) {
17 z = cMul(z,z)+offset;
18 return z;
19 }
|
02 - User Variables and Presets.frag |
---|
02 - User Variables and Presets.frag |
1 #include "2D.frag"
2
3 // It is easy to create custom variables,
4 // and tie them to sliders in the user interface.
5 //
6 // Hint: use the context menu to quickly
7 // insert templates for different variable types.
8 // Here you can also see the different types
9 // of variables.
10
11 // Organize controls by grouping them
12 #group MySystem
13
14 // Creates a floating point variable,
15 // with a slider with minimum = 0,
16 // default = 1, and maximum 10.
17 uniform float X; slider[0,1,10]
18 uniform float Y; slider[0,1,10]
19
20 // Use the variable like any other in the code
21 // (But don't assign to them)
22 vec3 color(vec2 c) {
23 return vec3(cos(c.x*X)+sin(c.y*Y),
24 sin(c.x*Y)+cos(c.y*X),
25 sin(c.x*c.y));
26 }
27
28 // It is possible to store one or more user variable
29 // settings in a Preset.
30 //
31 // Preset are parsed at build time, and will
32 // appear in the drop-down box in the Parameter
33 // window, where they can be quickly applied.
34
35 // Presets with the name 'Default'
36 // will be automatically assigned,
37 // when the system is built the first time.
38 #preset Default
39 Center = -0.221053,0.488189
40 Zoom = 0.186907
41 AntiAliasScale = 1
42 AntiAlias = 1
43 X = 1.2977
44 #endpreset
45
46 // Create presets by using the
47 // 'Copy to Clipboard' button in the
48 // Parameter window.
49 #preset Preset 2
50 Center = -0.221053,0.488189
51 Zoom = 0.335658
52 AntiAliasScale = 1
53 AntiAlias = 1
54 X = 6.8702
55 Y = 0.3053
56 Y = 6.3359
57 #endpreset
|
03 - Dynamic Systems.frag |
---|
03 - Dynamic Systems.frag |
1 #include "2D.frag"
2
3 // It is possible to change variables
4 // based on a special uniform 'time' variable.
5 //
6 // To see this in action, you must
7 // change the Render mode to 'Animation (time)' -
8 // otherwise the system will only render changes
9 // when something changes.
10
11 #group MySystem
12
13 uniform float X; slider[0,1,10]
14 uniform float Y; slider[0,1,10]
15 uniform float time;
16
17 vec3 color(vec2 c) {
18 return vec3(cos(c.x*X+time)+sin(c.y*Y+time*2.0),
19 sin(c.x*Y)+cos(c.y*X+time),
20 sin(c.x*c.y+time));
21 }
22
23 #preset Default
24 Center = -1.87816,-0.786641
25 Zoom = 0.214943
26 AntiAliasScale = 1
27 AntiAlias = 1
28 X = 5.0382
29 Y = 3.0534
30 #endpreset
|
04 - Textures.frag |
---|
04 - Textures.frag |
1 #include "2D.frag"
2
3 // It is possible to read from external bitmaps
4 // from Fragmentarium using textures.
5 // Set up a sampler2D as below,
6 // and read using the texture2D command.
7 #group MySystem
8
9 uniform float T ;slider[0,4,10]
10 uniform float R; slider[0,2,10]
11 uniform float step; slider[0,0.004,0.01]
12 uniform float time;
13
14 // Here we read from a texture
15 // Files locations are resolved relative to the current file,
16 // and to the include path set in the settings.
17 uniform sampler2D texture; file[texture2.jpg]
18
19 // You can set texture parameters directly:
20 #TexParameter texture GL_TEXTURE_MAG_FILTER GL_LINEAR
21 #TexParameter texture GL_TEXTURE_WRAP_S GL_REPEAT
22 #TexParameter texture GL_TEXTURE_WRAP_T GL_REPEAT
23
24 // A simple system based on the 'tunnel' system by Inigo Quilez:
25 // http://www.iquilezles.org/apps/shadertoy/
26 vec3 color(vec2 c) {
27 c*= 1.3+cos(time*2.0);
28 vec2 uv;
29
30 float a = atan(c.y,c.x);
31 float r = length(c);
32
33 uv.x = .5*time+.1/r;
34 uv.y = a/3.1416 + time*0.1;
35 vec2 dd = vec2(step,0.0);
36 vec2 d =uv;
37 vec3 col = texture2D(texture,d).xyz;
38 vec3 colX = texture2D(texture,d+dd.xy).xyz;
39 vec3 colMX = texture2D(texture,d-dd.xy).xyz;
40 vec2 g;
41 g.x = length(colMX)-length(colX);
42 vec3 colY = texture2D(texture,d+dd.yx).xyz;
43 vec3 colMY = texture2D(texture,d-dd.yx).xyz;
44 g.y = length(colMY)-length(colY);
45 g = normalize(g);
46 vec2 light = vec2(cos(time*T),sin(time*T))*R;
47 return mix(col,r*col* max(-1.0,dot(light,g)),0.9);
48 }
49
50 #preset Default
51 Center = -0.0214904,-0.00195827
52 Zoom = 2.34384
53 AntiAliasScale = 1
54 AntiAlias = 1
55 T = 4.3511
56 R = 2.2308
57 step = 0.0041
58 #endpreset
|
10 - Simple Distance Estimated 3D system.frag |
---|
10 - Simple Distance Estimated 3D system.frag |
1 #define providesColor
2 #include "Soft-Raytracer.frag"
3
4 // This is an example of
5 // a simple distance estimated system.
6 //
7 // The function "DE" must return
8 // the distance to the closest
9 // point on any objects in any direction.
10 vec3 baseColor(vec3 p, vec3 n) {
11 if (mod(length(p*10.0),2.0)<1.0) return vec3(1.0);
12 return vec3(0.0);
13 }
14
15 float DE(vec3 z) {
16 float d = (length(z-vec3(1.0,0.0,0.0))-1.0); // A sphere
17 d = max(d,- (length(z.xy-vec2(1.,0.0))-0.4)); // minus a tube
18 d = max(d,- (length(z.yz-vec2(0.,0.0))-0.4)); // minus a tube
19 d = max(d,- (length(z.xz-vec2(1.,0.0))-0.4)); // minus a tube
20 d = min(d, z.x); // plus a ground plane
21 d = min(d, length(z.yz-vec2(1.,1.0))-0.3); // plus a tube
22 return d;
23 }
24
25 #preset Default
26 FOV = 0.4
27 Eye = 4.76415,-4.09381,3.08941
28 Target = -1.17452,2.39263,-1.67067
29 Up = 0.803593,0.507247,-0.311349
30 #endpreset
|
11 - Simple Distance Estimated 3D fractal.frag |
---|
11 - Simple Distance Estimated 3D fractal.frag |
1 #include "DE-Raytracer.frag"
2
3 // Here one of the simplest fractals,
4 // a distance estimated Menger cube.
5 #group Menger
6 uniform int Iterations; slider[0,8,100]
7 uniform int ColorIterations; slider[0,8,100]
8 uniform float Scale; slider[0.00,3.0,4.00]
9 uniform vec3 Offset; slider[(0,0,0),(1,1,1),(1,1,1)]
10
11 float DE(vec3 z)
12 {
13 int n = 0;
14 while (n < Iterations) {
15 z = abs(z);
16 if (z.x<z.y){ z.xy = z.yx;}
17 if (z.x< z.z){ z.xz = z.zx;}
18 if (z.y<z.z){ z.yz = z.zy;}
19 z = Scale*z-Offset*(Scale-1.0);
20 if( z.z<-0.5*Offset.z*(Scale-1.0)) z.z+=Offset.z*(Scale-1.0);
21 if (n<ColorIterations) orbitTrap = min(orbitTrap, (vec4(abs(z),dot(z,z))));
22 n++;
23 }
24
25 return abs(length(z)-0.0 ) * pow(Scale, float(-n));
26 }
27
28 #preset Default
29 FOV = 0.4
30 Eye = -3.55741,0.119991,-2.22946
31 Target = 4.91261,-0.165702,3.07876
32 Up = 0.0398762,0.999198,-0.00374516
33 AntiAlias = 1
34 Detail = -2.35396
35 DetailAO = -1.00002
36 FudgeFactor = 1
37 MaxRaySteps = 56
38 BoundingSphere = 3.774
39 Dither = 0.5
40 NormalBackStep = 1
41 AO = 0,0,0,0.7
42 Specular = 0.1666
43 SpecularExp = 16
44 SpotLight = 1,1,1,0.19608
45 SpotLightDir = 0.37142,0.1
46 CamLight = 1,1,1,1.13978
47 CamLightMin = 0.29412
48 Glow = 1,1,1,0.07895
49 GlowMax = 20
50 Fog = 0.4161
51 HardShadow = 0.33846
52 ShadowSoft = 2
53 Reflection = 0
54 BaseColor = 1,1,1
55 OrbitStrength = 0.64935
56 X = 0.5,0.6,0.6,0.2126
57 Y = 1,0.6,0,0.30708
58 Z = 0.8,0.78,1,1
59 R = 0.666667,0.666667,0.498039,0.03174
60 BackgroundColor = 0.6,0.6,0.45
61 GradientBackground = 0.3
62 CycleColors = false
63 Cycles = 6.95699
64 EnableFloor = false
65 FloorNormal = 0,0,0
66 FloorHeight = 0
67 FloorColor = 1,1,1
68 Iterations = 8
69 ColorIterations = 5
70 Scale = 3
71 Offset = 1,1,1
72 #endpreset
|
12 - Faster raytracing of 3D fractals.frag |
---|
12 - Faster raytracing of 3D fractals.frag |
1 // There are different ways to speedup
2 // raytracing.
3 //
4 // 1) Using the 'Preview' sliders to render at lower resolution.
5 // 2) Locking parameters, you do not want to change dynamically, by clicking the padlock next to them, and recompiling
6 // 3) Using another raytracer:
7 //
8 // In this example the 'Fast-Raytracer' is used,
9 // it is faster then the default one, but does
10 // not offer as much flexibility.
11 //
12 // Subblue's raytracer is another faster option.
13 #include "Fast-Raytracer.frag"
14 //#include "Subblue-Raytracer.frag"
15
16 // Here one of the simplest fractals,
17 // a distance estimated Menger cube.
18 #group Menger
19 uniform int Iterations; slider[0,8,100]
20 uniform int ColorIterations; slider[0,8,100]
21 uniform float Scale; slider[0.00,3.0,4.00]
22 uniform vec3 Offset; slider[(0,0,0),(1,1,1),(1,1,1)]
23
24 float DE(vec3 z)
25 {
26 int n = 0;
27 while (n < Iterations) {
28 z = abs(z);
29 if (z.x<z.y){ z.xy = z.yx;}
30 if (z.x< z.z){ z.xz = z.zx;}
31 if (z.y<z.z){ z.yz = z.zy;}
32 z = Scale*z-Offset*(Scale-1.0);
33 if( z.z<-0.5*Offset.z*(Scale-1.0)) z.z+=Offset.z*(Scale-1.0);
34 if (n<ColorIterations) orbitTrap = min(orbitTrap, (vec4(abs(z),dot(z,z))));
35 n++;
36 }
37
38 return abs(length(z)-0.0 ) * pow(Scale, float(-n));
39 }
40
41 #preset Default
42 FOV = 0.4
43 Eye = -3.55741,0.119991,-2.22946
44 Target = 4.91261,-0.165702,3.07876
45 Up = 0.0398762,0.999198,-0.00374516
46 AntiAlias = 1
47 Detail = -2.35396
48 DetailAO = -1.00002
49 FudgeFactor = 1
50 MaxRaySteps = 56
51 BoundingSphere = 3.774
52 Dither = 0.5
53 NormalBackStep = 1
54 AO = 0,0,0,0.7
55 Specular = 0.1666
56 SpecularExp = 16
57 SpotLight = 1,1,1,0.19608
58 SpotLightDir = 0.37142,0.1
59 CamLight = 1,1,1,1.13978
60 CamLightMin = 0.29412
61 Glow = 1,1,1,0.07895
62 GlowMax = 20
63 Fog = 0.4161
64 HardShadow = 0.33846
65 ShadowSoft = 2
66 Reflection = 0
67 BaseColor = 1,1,1
68 OrbitStrength = 0.64935
69 X = 0.5,0.6,0.6,0.2126
70 Y = 1,0.6,0,0.30708
71 Z = 0.8,0.78,1,1
72 R = 0.666667,0.666667,0.498039,0.03174
73 BackgroundColor = 0.6,0.6,0.45
74 GradientBackground = 0.3
75 CycleColors = false
76 Cycles = 6.95699
77 EnableFloor = false
78 FloorNormal = 0,0,0
79 FloorHeight = 0
80 FloorColor = 1,1,1
81 Iterations = 8
82 ColorIterations = 5
83 Scale = 3
84 Offset = 1,1,1
85 #endpreset
|
20 - Progressive 2D.frag |
---|
20 - Progressive 2D.frag |
1 #include "Progressive2D.frag"
2 #include "Complex.frag"
3
4 // An example of using progressive rendering.
5 // Bbuffers are set up by the 'Progressive2D' fragment.
6 //
7 // Remember to set 'Render mode' to 'Progressive'.
8 // Progressive rendering, makes very high-quality AA possible.
9 // Notice, that this is a difficult image to render, due to very high frequency components.
10
11 vec3 color(vec2 v) {
12 vec2 p = (viewCoord+vec2(1.0))/2.0;
13 p=p/pixelSize;
14
15 if (p.y<40.0) {
16 return vec3(pow(0.5,1.0/Gamma));
17 }
18 float r = dot(v,v);
19 float a = 1.0;
20 if (mod(r,1.0)<0.5) a =1.0-a;
21 if (v.y>0.0) a = 1.0-a;
22 return vec3(a);
23 }
24
25
26
27
28 #preset Default
29 Center = 0.0727965,-0.192122
30 Zoom = 0.141329
31 Gamma = 2.2
32 ToneMapping = 1
33 Exposure = 1
34 Brightness = 1
35 Contrast = 1
36 Saturation = 1
37 AARange = 4.15701
38 AAExp = 1.81626
39 GaussianAA = true
40 #endpreset
|
21 - Progressive 2D Escape Time Fractal.frag |
---|
21 - Progressive 2D Escape Time Fractal.frag |
1 #include "Progressive2DJulia.frag"
2 #include "Complex.frag"
3
4 // An example of Escape Time Fractals,
5 // using progressive rendering.
6 // Bbuffers are set up by the 'Progressive2DJulia' fragment.
7 //
8 // Remember to set 'Render mode' to 'Continous'.
9 // Progressive rendering, makes very high-quality AA possible.
10
11 // Fractal by Kali: http://www.fractalforums.com/new-theories-and-research/very-simple-formula-for-fractal-patterns/msg31800/#msg31800
12
13 uniform float MinRadius; slider[0,0,10]
14 uniform float Scaling; slider[-5,0,5]
15
16 vec2 formula(vec2 z,vec2 c) {
17 float m =dot(z,z);
18 if (m<MinRadius) {
19 z = abs(z)/(MinRadius*MinRadius);
20 }else {
21 z = abs(z)/m*Scaling;
22 }
23 return z+c;
24 }
25
26 #preset Default
27 Center = -0.118362,0.0108127
28 Zoom = 10.8053
29 Gamma = 2.5463
30 ToneMapping = 3
31 Exposure = 1.3044
32 Brightness = 1
33 Contrast = 1.0396
34 Saturation = 1.8817
35 AARange = 1
36 AAExp = 1
37 GaussianAA = false
38 Iterations = 1000
39 PreIterations = 15
40 R = 1
41 G = 0.84034
42 B = 0.525
43 C = 0.90756
44 Julia = true
45 JuliaX = 1.43649
46 JuliaY = 2.05404
47 ShowMap = false
48 MapZoom = 2.1
49 EscapeSize = 5
50 ColoringType = 0
51 ColorFactor = 0.5
52 MinRadius = 0
53 Scaling = -1.9231
54 #endpreset
|
22 - Progressive 3D Rendering.frag |
---|
22 - Progressive 3D Rendering.frag |
1 // An example of rendering using the progressive 3D ray tracer,
2 // which makes it possible to use effects like real soft shadows,
3 // better anti-alias, better ambient-occlusion and depth-of-field.
4 // Rendering is much slower, though.
5 //
6 // To use it, just include "Soft-Raytracer" instead of "DE-Raytracer"
7 //
8 // Remember to set 'Render mode' to 'Continous'!
9
10 #info knot thingy by knighty (2012). Based on an idea by DarkBeam from fractalforums (http://www.fractalforums.com/new-theories-and-research/not-fractal-but-funny-trefoil-knot-routine/30/)
11 #include "Soft-Raytracer.frag"
12 #group Trefoil
13
14
15 //Radius of the tubes
16 uniform float tubeRadius; slider[0,0.1,0.5]
17
18 //Radius of the goup of tubes
19 uniform float groupRadius; slider[0,0.4,0.5]
20
21 //Radius of the whole object (because it looks like a torus (-:)
22 uniform float objectRadius; slider[0,1,1]
23
24 //Rotation Numerator X: actually not a rotation. This is frequency in x direction
25 uniform int RotNumeratorX; slider[-10,2,10]
26
27 //Rotation Numerator Y: actually not a rotation. This is frequency in y direction. (lissajou figure)
28 uniform int RotNumeratorY; slider[-10,4,10]
29
30 //Rotation Denominator: this is the rotation "speed" in xz plane
31 uniform int RotDenominator; slider[1,3,20]
32
33 //Rotations number: how many instances to check. related to the period of the knot. Have to find math formula for that.
34 uniform int Rotations; slider[1,1,10]
35
36 float Cylinder(vec2 p){
37 p.x-=groupRadius;
38 return length(p)-tubeRadius;
39 }
40
41 float twist(vec3 p){//seen from above it is a lissajou fugure
42 float ra =p.z*float(RotNumeratorX)/float( RotDenominator);
43 float raz=p.z*float(RotNumeratorY)/float(RotDenominator);
44 return length(p.xy-vec2(groupRadius*cos(ra)+objectRadius,groupRadius*sin(raz)+objectRadius))-tubeRadius;
45 }
46
47 vec3 bend2PI(vec3 p){
48 return vec3(length(p.xz),p.y,atan(p.z,p.x));
49 }
50
51 float DE(vec3 p) {
52 float r=length(p.xz), ang=atan(p.z,p.x),y=p.y;
53 float d=10000.;
54 for(int i=0; i<Rotations;i++){
55 vec3 p=vec3(r,y,ang+2.*PI*float(i));
56 p.x-=objectRadius;
57 d=min(d,twist(p));
58 }
59 return min(d,p.y);
60 }
61
62 #preset default
63 FOV = 0.62536
64 Eye = 0.77939,1.62364,1.44633
65 Target = -2.86937,-4.53699,-3.77496
66 Up = -0.312624,0.711048,-0.620502
67 EquiRectangular = false
68 FocalPlane = 1.4674
69 Aperture = 0.02
70 Gamma = 2.2685
71 ToneMapping = 2
72 Exposure = 0.9783
73 Brightness = 1
74 Contrast = 1.0891
75 Saturation = 1.4516
76 GaussianWeight = 1
77 AntiAliasScale = 2
78 Detail = -3
79 DetailAO = -0.14287
80 FudgeFactor = 0.66265
81 MaxRaySteps = 132
82 BoundingSphere = 4 Locked
83 Dither = 0 Locked
84 NormalBackStep = 1
85 AO = 0,0,0,0.61224
86 Specular = 0.3797
87 SpecularExp = 51.389
88 SpotLight = 0.811765,1,0.819608,2.2222
89 SpotLightPos = 5,2.676,-0.7042
90 SpotLightSize = 1.25157
91 CamLight = 0.0980392,0.713725,1,0.53846
92 CamLightMin = 0
93 Glow = 1,1,1,0
94 GlowMax = 20
95 Fog = 0
96 Shadow = 0.86364 NotLocked
97 Sun = 0.84582,1.57
98 SunSize = 0.01
99 Reflection = 0
100 BaseColor = 0.701961,0.701961,0.701961
101 OrbitStrength = 0
102 X = 0.411765,0.6,0.560784,0.41748
103 Y = 0.666667,0.666667,0.498039,-0.16504
104 Z = 1,0.258824,0.207843,1
105 R = 0.0823529,0.278431,1,0.82352
106 BackgroundColor = 0,0,0
107 GradientBackground = 0.3261
108 CycleColors = true
109 Cycles = 4.04901
110 EnableFloor = false
111 FloorNormal = 0,0,0
112 FloorHeight = 0
113 FloorColor = 1,1,1
114 tubeRadius = 0.07534
115 groupRadius = 0.29851
116 objectRadius = 0.43077
117 RotNumeratorX = -2
118 RotNumeratorY = -4
119 RotDenominator = 3
120 Rotations = 3
121 #endpreset
|
23 - Working with the back buffer.frag |
---|
23 - Working with the back buffer.frag |
1 #buffer RGBA16
2 #include "2D.frag"
3
4 // A 'Game of Life' implementation
5 // demonstrating how to work with a pixel-accurate
6 // back buffer.
7 // Switch to Continuous mode. Set Subframe max to zero!
8 // Make sure AntiAlias is off (set to 1).
9 //
10
11 uniform sampler2D backbuffer;
12 uniform float time;
13
14 /*
15 From Wikipedia:
16 Any live cell with fewer than two live neighbours dies, as if caused by under-population.
17 Any live cell with two or three live neighbours lives on to the next generation.
18 Any live cell with more than three live neighbours dies, as if by overcrowding.
19 Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
20 */
21
22 vec2 position = (viewCoord*1.0+vec2(1.0))/2.0;
23
24
25 float rand(vec2 co){
26 // implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
27 return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
28 }
29
30
31 #define SubframeMax 0
32 #define IterationsBetweenRedraws 20
33
34 #TexParameter backbuffer GL_TEXTURE_MAG_FILTER GL_NEAREST
35 #TexParameter backbuffer GL_TEXTURE_WRAP_S GL_REPEAT
36 #TexParameter backbuffer GL_TEXTURE_WRAP_T GL_REPEAT
37
38 void isAlive(float dx, float dy, inout int count) {
39 vec4 v1 = texture2D( backbuffer, position + pixelSize*vec2( dx, dy ) );
40 if (v1.x==1.0) count++;
41 }
42
43
44 vec3 color(vec2 z) {
45 if (length(z)<0.1 && length(z)>0.08) return (rand(time*z) < 0.5 ? vec3(1.0,0.0,0.0) : vec3(0.0));
46 vec4 v1 = texture2D( backbuffer, mod ( position , 1.0 ) );
47 int neighbours = 0;
48 int alive =0;
49 isAlive(0.0,0.0,alive);
50
51 // Count neighbours
52 isAlive(1.0,0.0, neighbours);
53 isAlive(1.0,1.0, neighbours);
54 isAlive(1.0,-1.0, neighbours);
55 isAlive(0.0,1.0, neighbours);
56 isAlive(0.0,-1.0, neighbours);
57 isAlive(-1.0,1.0, neighbours);
58 isAlive(-1.0,0.0, neighbours);
59 isAlive(-1.0,-1.0, neighbours);
60
61 // Rules
62 if (alive==1) {
63 if (neighbours<2) return vec3(v1.x*0.99,v1.y*0.99,v1.z);
64 else if (neighbours<4) return vec3(1.0);
65 } else {
66 if (neighbours==3) return vec3(1.0);
67 }
68
69 return vec3(v1.x*0.95,v1.y*0.98,v1.z*0.999) ;
70 }
71
72
73 #preset Default
74 Center = 0,0
75 Zoom = 6.15279
76 AntiAliasScale = 1
77 AntiAlias = 1
78 #endpreset
|
24 - Pure 3D.frag |
---|
24 - Pure 3D.frag |
1 #include "3D.frag"
2 uniform sampler2D texture; file[Ditch-River_2k.hdr]
3 uniform sampler2D texture2; file[Ditch-River_Env.hdr]
4
5 // An example of working with 3D without a distance estimator
6
7 // Free HDRI's: http://www.hdrlabs.com/sibl/archive.html
8
9 float sphereLine(vec3 pos, vec3 dir, vec3 center, float radius, out vec3 normal) {
10 vec3 sd=center-pos;
11 float b = dot(dir,sd);
12 float temp = b*b+radius*radius-dot(sd,sd);
13 if (temp>0.0) {
14 temp = b - sqrt(temp); // intersection distance
15 normal = normalize((pos+temp*dir)-center);
16 return temp;
17 }
18 normal = vec3(0.0);
19 return -1.;
20 }
21
22 #define PI 3.14159265358979323846264
23
24 vec3 equirectangularMap(vec3 dir, sampler2D sampler) {
25 dir = normalize(dir);
26 vec2 longlat = vec2(atan(dir.y,dir.x),acos(dir.z));
27 return texture2D(sampler,longlat/vec2(2.0*PI,PI) ).xyz;
28
29 }
30
31 uniform float Specular; slider[0,1,1]
32 uniform float Diffuse;slider[0,1,1]
33
34 vec3 color(vec3 pos, vec3 dir) {
35
36 vec3 normal = vec3(1.0,1.0,1.0);
37 float intersect = 10000.0;
38 vec3 finalNormal = vec3(0.0);
39 for (int j = 0; j < 6; j++) {
40 float z = (float(j)-6.0)/2.0;
41 float i = sphereLine(pos,normalize(dir),vec3(1.0,0.0+float(j),z),0.5, normal);
42 if (i<intersect && i>0.) {
43 intersect =i;
44 finalNormal = normal;
45 }
46 }
47
48 if (intersect<10000.) {
49 vec3 reflected = -2.0*dot(dir,finalNormal)*finalNormal+dir;
50 vec3 col = Specular*equirectangularMap(reflected, texture);
51 vec3 col2 = Diffuse*equirectangularMap(finalNormal, texture2);
52 return col+col2;
53 }
54 vec3 col =equirectangularMap(dir,texture);
55 return col;
56 }
57
58
59
60 #preset Default
61 FOV = 0.4
62 Eye = 8.42062,8.55686,-1.41974
63 Target = 0.781867,2.10355,-1.35523
64 Up = 0.0291443,-0.024509,0.999275
65 EquiRectangular = false
66 FocalPlane = 1
67 Aperture = 0
68 Gamma = 2.2222
69 ToneMapping = 3
70 Exposure = 1
71 Brightness = 1
72 Contrast = 1
73 Saturation = 1
74 GaussianWeight = 1
75 AntiAliasScale = 2
76 texture = Ditch-River_2k.hdr
77 texture2 = Ditch-River_Env.hdr
78 Specular = 1,0
79 Diffuse = 1,0,1
80 #endpreset
|
25 - Image Based Lighting.frag |
---|
25 - Image Based Lighting.frag |
1 // An example of Image Based Lighting.
2 //
3 // NOTICE:
4 // The Ditch-River Panorama HDR is authored by 'Blotchi' and copyrighted by http://www.hdrlabs.com/sibl/archive.html
5 // It is licensed under a CC3.0 license: http://creativecommons.org/licenses/by-nc-sa/3.0/us/
6 #include "IBL-Raytracer.frag"
7 #include "QuilezLib.frag"
8 #group TestScene
9 uniform float TextureScale; slider[0,1,40]
10
11 // Just a simple test scene...
12 float DE(vec3 p)
13 {
14 p.xy=p.yx;
15 float d = length(p+vec3(0.0,0.0,-0.25))-0.25; // sphere
16 d= min(d, udRoundBox(p+vec3(0.2,1.0,-0.25),vec3(0.2),0.05)); // rounded box
17 d =min(d, sdCone(p+vec3(1.,1.,-0.5),vec2(0.95,0.45))); // cone
18 d = min(d, sdTorus88(p+vec3(-1.4,1.,-0.6),vec2(0.5,0.1))); // torus
19 return min(p.z,d);// distance estimate
20 }
21
22 #preset Default
23 FOV = 0.58536
24 Eye = 0.246321,-1.72201,0.434156
25 Target = -5.5875,6.37903,-0.148662
26 Up = -0.00420879,0.0687221,0.997349
27 EquiRectangular = false
28 FocalPlane = 1
29 Aperture = 0
30 Gamma = 2.2685
31 ToneMapping = 3
32 Exposure = 0.82653
33 Brightness = 1
34 Contrast = 1
35 Saturation = 1
36 GaussianWeight = 1
37 AntiAliasScale = 2
38 Detail = -3.65484
39 DetailAO = -1.14289
40 FudgeFactor = 1
41 MaxRaySteps = 198
42 BoundingSphere = 4.3373
43 Dither = 0.5
44 NormalBackStep = 1
45 AO = 0,0,0,1
46 CamLight = 1,1,1,0
47 CamLightMin = 0
48 Glow = 1,1,1,0
49 GlowMax = 20
50 Fog = 0
51 Shadow = 0.70455
52 Background = Ditch-River_2k.hdr
53 Specular = Ditch-River_Env.hdr
54 Diffuse = Ditch-River_Env.hdr
55 EnvSpecular = 1.8
56 EnvDiffuse = 0
57 SpecularMax = 100
58 Sun = 1.38949,1.02653
59 SunSize = 0.0045
60 DebugSun = true
61 BaseColor = 1,1,1
62 OrbitStrength = 0
63 X = 0.5,0.6,0.6,0.2126
64 Y = 1,0.6,0,0.30708
65 Z = 0.8,0.78,1,0.35434
66 R = 0.666667,0.666667,0.498039,0.03174
67 BackgroundColor = 1,1,1
68 GradientBackground = 0.4348
69 CycleColors = false
70 Cycles = 1.1
71 EnableFloor = true
72 FloorNormal = 0,0,0.17074
73 FloorHeight = 0
74 FloorColor = 1,1,1
75 ShowFloor = false
76 TextureScale = 1
77 #endpreset
|
26 - 3D fractals without a DE.frag |
---|
26 - 3D fractals without a DE.frag |
1 #info Mandelbulb without Distance Estimator
2
3 #define providesInside
4
5 #define providesColor
6
7 #include "Brute-Raytracer.frag"
8 #group Mandelbulb
9 //#define IterationsBetweenRedraws 5
10
11 // Number of fractal iterations.
12 uniform int Iterations; slider[0,9,100]
13
14 // Mandelbulb exponent (8 is standard)
15 uniform float Power; slider[-10,8,10]
16
17 // Bailout radius
18 uniform float Bailout; slider[0,5,30]
19
20 uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
21
22 uniform float RotAngle; slider[0.00,0,180]
23
24 uniform bool Julia; checkbox[false]
25 uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
26
27 vec3 color(vec3 p) {
28 return abs(vec3(p));
29 }
30
31 void powN2(inout vec3 z, float zr0) {
32 float zo0 = asin( z.z/zr0 );
33 float zi0 = atan( z.y,z.x );
34 float zr = pow( zr0, Power-1.0 );
35 float zo = zo0 * Power;
36 float zi = zi0 * Power;
37 zr *= zr0;
38 z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
39 }
40
41
42 bool inside(vec3 pos) {
43 vec3 z=pos;
44 float r;
45 int i=0;
46 r=length(z);
47 while(r<Bailout && (i<Iterations)) {
48 powN2(z,r);
49 z+=(Julia ? JuliaC : pos);
50 r=length(z);
51 i++;
52 }
53 return (r<Bailout);
54
55 }
56
57 #preset Default
58 FOV = 0.62536
59 Eye = 0.137861,0.380908,-1.90454
60 Target = -1.05894,-1.3684,6.69989
61 Up = -0.970103,0.225702,-0.0892076
62 EquiRectangular = false
63 Gamma = 2.5
64 ToneMapping = 3
65 Exposure = 1.34694
66 Brightness = 1
67 Contrast = 0.9901
68 Saturation = 1
69 Near = 0.7368
70 Far = 2.45904
71 NormalScale = 0.58825
72 AOScale = 1.0194
73 Glow = 0.34167
74 AOStrength = 0.86047
75 Samples = 100
76 Stratify = true
77 DebugInside = false
78 SampleNeighbors = true
79 Specular = 0
80 SpecularExp = 5.455
81 SpotLight = 1,0.678431,0.494118,0.78431
82 SpotLightDir = 1,0.78126
83 CamLight = 1,1,1,0.38462
84 CamLightMin = 0
85 Fog = 0
86 ShowDepth = false
87 DebugNormals = false
88 BaseColor = 1,1,1
89 OrbitStrength = 0
90 X = 1,1,1,1
91 Y = 0.345098,0.666667,0,0.02912
92 Z = 1,0.666667,0,1
93 R = 0.0784314,1,0.941176,-0.0194
94 BackgroundColor = 0.607843,0.866667,0.560784
95 GradientBackground = 0.86955
96 CycleColors = false
97 Cycles = 1.1
98 Iterations = 9
99 Power = 8
100 Bailout = 5
101 RotVector = 1,1,1
102 RotAngle = 0
103 Julia = false
104 JuliaC = 0,0,0
105 #endpreset
|
30 - Simple Keyframe Animation.frag |
---|
30 - Simple Keyframe Animation.frag
How-To create a KeyFrame Animation:
|
1 #info Mandelbulb Anim Fragment
2 #info http://www.fractalforums.com/index.php?topic=16405.0
3 #define providesInit
4 #group Raytracer
5 // Sets focal plane to Target location
6 uniform bool AutoFocus; checkbox[false]
7 #include "DE-Raytracer-v0.9.10.frag"
8 #include "MathUtils.frag"
9 #group Mandelbulb
10
11
12 // Number of fractal iterations.
13 uniform int Iterations; slider[0,9,100]
14
15 // Number of color iterations.
16 uniform int ColorIterations; slider[0,9,100]
17
18 // Mandelbulb exponent (8 is standard)
19 uniform float Power; slider[0,8,16]
20
21 // Bailout radius
22 uniform float Bailout; slider[0,5,30]
23
24 // Alternate is slightly different, but looks more like a Mandelbrot for Power=2
25 uniform bool AlternateVersion; checkbox[false]
26
27 uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
28
29 uniform float RotAngle; slider[0.00,0,180]
30
31
32 #group Translation
33 uniform vec3 TransVector; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
34 uniform float TransSpeed; slider[0,0,1]
35 uniform float ImpulseStrength; slider[0,0,10]
36 uniform float ImpulseRate; slider[0,0,10]
37 uniform float ImpulseOffset; slider[0,0,10]
38 uniform vec3 TRotVector; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
39 uniform float TRotSpeed; slider[0,0,45]
40
41 mat3 rot;
42 uniform float time;
43
44 void init() {
45 rot = rotationMatrix3(normalize(RotVector), RotAngle);
46 }
47
48 // This is my power function, based on the standard spherical coordinates as defined here:
49 // http://en.wikipedia.org/wiki/Spherical_coordinate_system
50 //
51 // It seems to be similar to the one Quilez uses:
52 // http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
53 //
54 // Notice the north and south poles are different here.
55 void powN1(inout vec3 z, float r, inout float dr) {
56 // extract polar coordinates
57 float theta = acos(z.z/r);
58 float phi = atan(z.y,z.x);
59 dr = pow( r, Power-1.0)*Power*dr + 1.0;
60
61 // scale and rotate the point
62 float zr = pow( r,Power);
63 theta = theta*Power;
64 phi = phi*Power;
65
66 // convert back to cartesian coordinates
67 z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
68 }
69
70 // This is a power function taken from the implementation by Enforcer:
71 // http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
72 //
73 // I cannot follow its derivation from spherical coordinates,
74 // but it does give a nice mandelbrot like object for Power=2
75 void powN2(inout vec3 z, float zr0, inout float dr) {
76 float zo0 = asin( z.z/zr0 );
77 float zi0 = atan( z.y,z.x );
78 float zr = pow( zr0, Power-1.0 );
79 float zo = zo0 * Power;
80 float zi = zi0 * Power;
81 dr = zr*dr*Power + 1.0;
82 zr *= zr0;
83 z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
84 }
85
86
87
88 uniform bool Julia; checkbox[false]
89 uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
90
91 // Compute the distance from `pos` to the Mandelbox.
92 float DE(vec3 pos) {
93 vec3 z=pos;
94 float r;
95 float dr=1.0;
96 int i=0;
97
98 if (TRotSpeed>0.0) {
99 rot=rotationMatrix3(normalize(TRotVector),TRotSpeed*time);
100 z*=rot;
101 }
102 if (TransSpeed>0.0) {
103 z+=normalize(TransVector)*time*TransSpeed*10.0;
104 }
105 if (ImpulseStrength>0.0) {
106 z+=normalize(TransVector)*(0.8+sin(time*ImpulseRate+ImpulseOffset))*ImpulseStrength;
107 }
108
109 r=length(z);
110 while(r<Bailout && (i<Iterations)) {
111 if (AlternateVersion) {
112 powN2(z,r,dr);
113 } else {
114 powN1(z,r,dr);
115 }
116 z+=(Julia ? JuliaC : pos);
117 r=length(z);
118 z*=rot;
119 if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
120 i++;
121 }
122
123 // if ((type==1) && r<Bailout) return 0.0;
124 return 0.5*log(r)*r/dr;
125 /*
126 Use this code for some nice intersections (Power=2)
127 float a = max(0.5*log(r)*r/dr, abs(pos.y));
128 float b = 1000;
129 if (pos.y>0) b = 0.5*log(r)*r/dr;
130 return min(min(a, b),
131 max(0.5*log(r)*r/dr, abs(pos.z)));
132 */
133 }
134
135 float dummy(vec3 p){
136 p*=time;
137 return time;
138 }
139
140
141 #preset Default
142 FOV = 0.62536
143 Eye = 1.65826,-1.22975,0.277736
144 Target = -5.2432,4.25801,-0.607125
145 Up = 0.401286,0.369883,-0.83588
146 EquiRectangular = false
147 FocalPlane = 1
148 AutoFocus = false
149 Aperture = 0
150 Gamma = 2.08335
151 ToneMapping = 3
152 Exposure = 0.6522
153 Brightness = 1
154 Contrast = 1
155 Saturation = 1
156 GaussianWeight = 1
157 AntiAliasScale = 2
158 Detail = -2.84956
159 DetailAO = -1.35716
160 FudgeFactor = 1
161 MaxRaySteps = 164
162 BoundingSphere = 10
163 Dither = 0.51754
164 NormalBackStep = 1
165 AO = 0,0,0,0.85185
166 Specular = 1.6456
167 SpecularExp = 16.364
168 SpecularMax = 10
169 SpotLight = 1,1,1,1
170 SpotLightDir = -0.22666,0.5
171 CamLight = 1,1,1,1.53846
172 CamLightMin = 0.12121
173 Glow = 1,1,1,0.43836
174 GlowMax = 52
175 Fog = 0
176 HardShadow = 0.35385
177 ShadowSoft = 12.5806
178 Reflection = 0
179 BaseColor = 1,1,1
180 OrbitStrength = 0.14286
181 X = 1,1,1,1
182 Y = 0.345098,0.666667,0,0.02912
183 Z = 1,0.666667,0,1
184 R = 0.0784314,1,0.941176,-0.0194
185 BackgroundColor = 0.607843,0.866667,0.560784
186 GradientBackground = 0.3261
187 CycleColors = false
188 Cycles = 4.04901
189 EnableFloor = true
190 FloorNormal = 0,1,0
191 FloorHeight = -2
192 FloorColor = 1,1,1
193 Iterations = 12
194 ColorIterations = 8
195 Power = 8
196 Bailout = 6.279
197 AlternateVersion = true
198 RotVector = 1,1,1
199 RotAngle = 0
200 Julia = false
201 JuliaC = 0,0,0
202 #endpreset
203
204
205 #preset KeyFrame.001
206 FOV = 0.62536
207 Eye = 1.65826,-1.22975,0.277736
208 Target = -5.2432,4.25801,-0.607125
209 Up = 0.401286,0.369883,-0.83588
210 #endpreset
211
212 #preset KeyFrame.002
213 FOV = 0.62536
214 Eye = 3.96463,0.917888,0.279432
215 Target = -4.74042,-0.257782,-0.320685
216 Up = -0.709039,0.700838,-0.0780331
217 #endpreset
218
219 #preset KeyFrame.003
220 FOV = 0.62536
221 Eye = 1.33376,0.978975,2.81437
222 Target = -2.37223,0.395544,-5.15089
223 Up = 0.0655203,0.994792,0.0780753
224 #endpreset
225
226 #preset KeyFrame.004
227 FOV = 0.62536
228 Eye = -0.146262,0.991041,-0.550259
229 Target = -7.41034,2.09513,-5.36868
230 Up = 0.0484982,0.797152,0.601827
231 #endpreset
|
31 - Simple Focal Plane Tracking Target.frag |
---|
31 - Simple Focal Plane Tracking Target.frag
How-To Enable Auto Focus Add this line to your frag code, preferably in the "Camera" group if the AutoFocus widget doesn't already exist... uniform bool AutoFocus; checkbox[false] Now you can enable/disable focal plane target tracking, the focal plane default maximum distance is 5, if you need more than that open the .frag file that contains the "FocalPlane" widget and edit the maximum... uniform float FocalPlane; slider[0,1,5] to what ever you need like... uniform float FocalPlane; slider[0,1,50]
|
1 #info Mandelbulb Anim Fragment
2 #info http://www.fractalforums.com/index.php?topic=16405.0
3 #define providesInit
4
5 #group Raytracer
6 // Sets focal plane to Target location
7 //uniform bool AutoFocus; checkbox[false]
8
9 #include "DE-Raytracer-v0.9.10.frag"
10 #include "MathUtils.frag"
11
12 #group Mandelbulb
13
14 // Number of fractal iterations.
15 uniform int Iterations; slider[0,9,100]
16
17 // Number of color iterations.
18 uniform int ColorIterations; slider[0,9,100]
19
20 // Mandelbulb exponent (8 is standard)
21 uniform float Power; slider[0,8,16]
22
23 // Bailout radius
24 uniform float Bailout; slider[0,5,30]
25
26 // Alternate is slightly different, but looks more like a Mandelbrot for Power=2
27 uniform bool AlternateVersion; checkbox[false]
28
29 uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
30
31 uniform float RotAngle; slider[0.00,0,180]
32
33 #group Translation
34 uniform vec3 TransVector; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
35 uniform float TransSpeed; slider[0,0,1]
36 uniform float ImpulseStrength; slider[0,0,10]
37 uniform float ImpulseRate; slider[0,0,10]
38 uniform float ImpulseOffset; slider[0,0,10]
39 uniform vec3 TRotVector; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
40 uniform float TRotSpeed; slider[0,0,45]
41
42 mat3 rot;
43 uniform float time;
44
45 void init() {
46 rot = rotationMatrix3(normalize(RotVector), RotAngle);
47 }
48
49 // This is my power function, based on the standard spherical coordinates as defined here:
50 // http://en.wikipedia.org/wiki/Spherical_coordinate_system
51 //
52 // It seems to be similar to the one Quilez uses:
53 // http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
54 //
55 // Notice the north and south poles are different here.
56 void powN1(inout vec3 z, float r, inout float dr) {
57 // extract polar coordinates
58 float theta = acos(z.z/r);
59 float phi = atan(z.y,z.x);
60 dr = pow( r, Power-1.0)*Power*dr + 1.0;
61
62 // scale and rotate the point
63 float zr = pow( r,Power);
64 theta = theta*Power;
65 phi = phi*Power;
66
67 // convert back to cartesian coordinates
68 z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
69 }
70
71 // This is a power function taken from the implementation by Enforcer:
72 // http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
73 //
74 // I cannot follow its derivation from spherical coordinates,
75 // but it does give a nice mandelbrot like object for Power=2
76 void powN2(inout vec3 z, float zr0, inout float dr) {
77 float zo0 = asin( z.z/zr0 );
78 float zi0 = atan( z.y,z.x );
79 float zr = pow( zr0, Power-1.0 );
80 float zo = zo0 * Power;
81 float zi = zi0 * Power;
82 dr = zr*dr*Power + 1.0;
83 zr *= zr0;
84 z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
85 }
86
87
88
89 uniform bool Julia; checkbox[false]
90 uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
91
92 // Compute the distance from `pos` to the Mandelbox.
93 float DE(vec3 pos) {
94 vec3 z=pos;
95 float r;
96 float dr=1.0;
97 int i=0;
98
99 if (TRotSpeed>0.0) {
100 rot=rotationMatrix3(normalize(TRotVector),TRotSpeed*time);
101 z*=rot;
102 }
103 if (TransSpeed>0.0) {
104 z+=normalize(TransVector)*time*TransSpeed*10.0;
105 }
106 if (ImpulseStrength>0.0) {
107 z+=normalize(TransVector)*(0.8+sin(time*ImpulseRate+ImpulseOffset))*ImpulseStrength;
108 }
109
110 r=length(z);
111 while(r<Bailout && (i<Iterations)) {
112 if (AlternateVersion) {
113 powN2(z,r,dr);
114 } else {
115 powN1(z,r,dr);
116 }
117 z+=(Julia ? JuliaC : pos);
118 r=length(z);
119 z*=rot;
120 if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
121 i++;
122 }
123
124 // if ((type==1) && r<Bailout) return 0.0;
125 return 0.5*log(r)*r/dr;
126 /*
127 Use this code for some nice intersections (Power=2)
128 float a = max(0.5*log(r)*r/dr, abs(pos.y));
129 float b = 1000;
130 if (pos.y>0) b = 0.5*log(r)*r/dr;
131 return min(min(a, b),
132 max(0.5*log(r)*r/dr, abs(pos.z)));
133 */
134 }
135
136 float dummy(vec3 p){
137 p*=time;
138 return time;
139 }
140
141 #preset Default
142 FOV = 0.62536
143 Eye = 1.65826,-1.22975,0.277736
144 Target = -5.2432,4.25801,-0.607125
145 Up = 0,1,0
146 EquiRectangular = false
147 AutoFocus = true
148 FocalPlane = 1
149 Aperture = 0.05
150 Gamma = 2.08335
151 ToneMapping = 3
152 Exposure = 0.6522
153 Brightness = 1
154 Contrast = 1
155 Saturation = 1
156 GaussianWeight = 1
157 AntiAliasScale = 2
158 Detail = -2.84956
159 DetailAO = -1.35716
160 FudgeFactor = 1
161 MaxRaySteps = 164
162 BoundingSphere = 10
163 Dither = 0.51754
164 NormalBackStep = 1
165 AO = 0,0,0,0.85185
166 Specular = 1.6456
167 SpecularExp = 16.364
168 SpecularMax = 10
169 SpotLight = 1,1,1,1
170 SpotLightDir = -0.22666,0.5
171 CamLight = 1,1,1,1.53846
172 CamLightMin = 0.12121
173 Glow = 1,1,1,0.43836
174 GlowMax = 52
175 Fog = 0
176 HardShadow = 0.35385
177 ShadowSoft = 12.5806
178 Reflection = 0
179 BaseColor = 1,1,1
180 OrbitStrength = 0.14286
181 X = 1,1,1,1
182 Y = 0.345098,0.666667,0,0.02912
183 Z = 1,0.666667,0,1
184 R = 0.0784314,1,0.941176,-0.0194
185 BackgroundColor = 0.607843,0.866667,0.560784
186 GradientBackground = 0.3261
187 CycleColors = false
188 Cycles = 4.04901
189 EnableFloor = true
190 FloorNormal = 0,1,0
191 FloorHeight = -2
192 FloorColor = 1,1,1
193 Iterations = 12
194 ColorIterations = 8
195 Power = 8
196 Bailout = 6.279
197 AlternateVersion = true
198 RotVector = 1,1,1
199 RotAngle = 0
200 TransVector = 1,0,0
201 TransSpeed = 0
202 ImpulseStrength = 0
203 ImpulseRate = 0
204 ImpulseOffset = 0
205 TRotVector = 1,0,0
206 TRotSpeed = 0
207 Julia = false
208 JuliaC = 0,0,0
209 #endpreset
210
211
212 #preset KeyFrame.001
213 FOV = 0.62536
214 Eye = 2,0,0
215 Target = 1,0,0
216 Up = 0,1,0
217 #endpreset
218
219 #preset KeyFrame.002
220 FOV = 0.62536
221 Eye = 0.73087,0.0286388,1.42303
222 Target = 0.31975,-0.0253,0.62258
223 Up = 0,1,0
224 #endpreset
225
226 #preset KeyFrame.003
227 FOV = 0.62536
228 Eye = 0.034575,-0.00331298,1.59962
229 Target = 0.0,0.0,0.0
230 Up = -0.368,1,0
231 #endpreset
232
233 #preset KeyFrame.004
234 FOV = 0.62536
235 Eye = 0.034575,-0.00331298,1.59962
236 Target = 0.05491,-0.00217,0.99997
237 Up = 0.17544,1,0
238 #endpreset
239
240 #preset KeyFrame.005
241 FOV = 0.62536
242 Eye = 0.0244074,-0.00388447,1.89945
243 Target = 0.05491,-0.00217,0.99997
244 Up = 0,1,0
245 #endpreset
246
247 #preset KeyFrame.006
248 FOV = 0.62536
249 Eye = 0.0108507,-0.00464646,2.29922
250 Target = 0.05491,-0.00217,0.99997
251 Up = 0,1,0
252 #endpreset
253
254 #preset KeyFrame.007
255 FOV = 0.62536
256 Eye = 0.0108507,-0.00464646,2.29922
257 Target = 0.02745,-0.0018,0.454545
258 Up = 0,1,0
259 #endpreset
260
261 #preset KeyFrame.008
262 FOV = 0.62536
263 Eye = 0.0108507,-0.00464646,2.29922
264 Target = 0,0,0
265 Up = 0,1,0
266 #endpreset
267
268 #preset KeyFrame.009
269 FOV = 0.62536
270 Eye = 0.0108507,-0.00464646,2.29922
271 Target = 0.05491,-0.00217,0.99997
272 Up = 0,1,0
273 #endpreset
274
275 #preset KeyFrame.010
276 FOV = 0.62536
277 Eye = 0.0108507,-0.00464646,2.29922
278 Target = 0.05491,-0.00217,0.99997
279 Up = 0,1,0
280 #endpreset
|
32 - Simple Multi-Parameter Easing Animation.frag |
---|
32 - Simple Multi-Parameter Easing Animation.frag
How-To create a Parameter Morph Animation These settings can be saved by using "Range" in the preset name like "#preset Range-100-200", the frame numbers have no impact on the easing curve values and are ignored, they are so the human can be reminded of what this range covers, allows for unique names like "Range-fogIn" "Range-fogOut" etc., these ranges can also be applied via fqScript eg: applyPresetByName("Range-fogIn")
Cycles1:CosineCurve:44:1:24:1:240:0.3:1:1.7:1:0 Power1:SineCurve:43:1:6:20:220:0.3:1:1.7:1:0 RotAngle1:OutInBack:36:0:360:40:200:0.3:1:1.7:1:0
[Variable Name]:[Ease Name]:[Ease Type]:[start frame]:[end frame]:[begin parameter value]:[end parameter value]:[period]:[amplitude]:[overshoot]:[loops]:[pong]
Frames before start frame will use start value until start frame is reached. Frames after finish frame will use finish value until end of animation is reached. These become active when the animation is playing. When you do this to a variable that already has a curve you will be prompted "Apply" "Discard" "Cancel" "Apply" will change these settings for this variable (like it, keep it) "Discard" will delete the settings for this variable (clean up, no animating) "Cancel" does nothing This only saves the changes internally!!! if you like the result then...
this folder will have all of your var morph settings in a single default preset and campath keyframes Parameter morph settings should all be in one named (not keyframe) preset. |
1 #info Mandelbulb Anim Fragment
2 #info http://www.fractalforums.com/index.php?topic=16405.0
3 #define providesInit
4
5 #group Raytracer
6 // Sets focal plane to Target location
7 //uniform bool AutoFocus; checkbox[false]
8
9 #include "DE-Raytracer.frag"
10 #include "MathUtils.frag"
11
12 #group Mandelbulb
13
14 // Number of fractal iterations.
15 uniform int Iterations; slider[0,9,100]
16
17 // Number of color iterations.
18 uniform int ColorIterations; slider[0,9,100]
19
20 // Mandelbulb exponent (8 is standard)
21 uniform float Power; slider[0,8,16]
22
23 // Bailout radius
24 uniform float Bailout; slider[0,5,30]
25
26 // Alternate is slightly different, but looks more like a Mandelbrot for Power=2
27 uniform bool AlternateVersion; checkbox[false]
28
29 uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
30
31 uniform float RotAngle; slider[0.00,0,360]
32
33 mat3 rot;
34 uniform float time;
35
36 void init() {
37 rot = rotationMatrix3(normalize(RotVector), RotAngle);
38 }
39
40 // This is my power function, based on the standard spherical coordinates as defined here:
41 // http://en.wikipedia.org/wiki/Spherical_coordinate_system
42 //
43 // It seems to be similar to the one Quilez uses:
44 // http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
45 //
46 // Notice the north and south poles are different here.
47 void powN1(inout vec3 z, float r, inout float dr) {
48 // extract polar coordinates
49 float theta = acos(z.z/r);
50 float phi = atan(z.y,z.x);
51 dr = pow( r, Power-1.0)*Power*dr + 1.0;
52
53 // scale and rotate the point
54 float zr = pow( r,Power);
55 theta = theta*Power;
56 phi = phi*Power;
57
58 // convert back to cartesian coordinates
59 z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
60 }
61
62 // This is a power function taken from the implementation by Enforcer:
63 // http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
64 //
65 // I cannot follow its derivation from spherical coordinates,
66 // but it does give a nice mandelbrot like object for Power=2
67 void powN2(inout vec3 z, float zr0, inout float dr) {
68 float zo0 = asin( z.z/zr0 );
69 float zi0 = atan( z.y,z.x );
70 float zr = pow( zr0, Power-1.0 );
71 float zo = zo0 * Power;
72 float zi = zi0 * Power;
73 dr = zr*dr*Power + 1.0;
74 zr *= zr0;
75 z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
76 }
77
78
79
80 uniform bool Julia; checkbox[false]
81 uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
82
83 // Compute the distance from `pos` to the Mandelbox.
84 float DE(vec3 pos) {
85 vec3 z=pos;
86 float r;
87 float dr=1.0;
88 int i=0;
89
90 r=length(z);
91 while(r<Bailout && (i<Iterations)) {
92 if (AlternateVersion) {
93 powN2(z,r,dr);
94 } else {
95 powN1(z,r,dr);
96 }
97 z+=(Julia ? JuliaC : pos);
98 r=length(z);
99 z*=rot;
100 if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
101 i++;
102 }
103
104 // if ((type==1) && r<Bailout) return 0.0;
105 return 0.5*log(r)*r/dr;
106 /*
107 Use this code for some nice intersections (Power=2)
108 float a = max(0.5*log(r)*r/dr, abs(pos.y));
109 float b = 1000;
110 if (pos.y>0) b = 0.5*log(r)*r/dr;
111 return min(min(a, b),
112 max(0.5*log(r)*r/dr, abs(pos.z)));
113 */
114 }
115
116 float dummy(vec3 p){
117 p*=time;
118 return time;
119 }
120
121 #preset Default
122 FOV = 0.62536
123 Eye = 2.42106,0.501576,0.263686
124 Target = -6.2468,-0.836125,-0.622262
125 Up = 0,1,0
126 EquiRectangular = false
127 AutoFocus = false
128 FocalPlane = 1
129 Aperture = 0
130 Gamma = 2.08335
131 ToneMapping = 3
132 Exposure = 0.6522
133 Brightness = 1
134 Contrast = 1
135 Saturation = 1
136 GaussianWeight = 1
137 AntiAliasScale = 2
138 Detail = -2.84956
139 DetailAO = -1.35716
140 FudgeFactor = 1
141 MaxRaySteps = 164
142 BoundingSphere = 10
143 Dither = 0.51754
144 NormalBackStep = 1
145 AO = 0,0,0,0.85185
146 Specular = 1.6456
147 SpecularExp = 16.364
148 SpecularMax = 10
149 SpotLight = 1,1,1,1
150 SpotLightDir = 0.22666,0.5
151 CamLight = 1,1,1,1.53846
152 CamLightMin = 0.12121
153 Glow = 1,1,1,0.43836
154 GlowMax = 52
155 Fog = 0
156 HardShadow = 0.35385
157 ShadowSoft = 12.5806
158 Reflection = 0
159 BaseColor = 1,1,1
160 OrbitStrength = 1
161 X = 1,1,1,1
162 Y = 0.345098,0.666667,0,0.02912
163 Z = 1,0.666667,0,1
164 R = 0.0784314,1,0.941176,-0.0194
165 BackgroundColor = 0.607843,0.866667,0.560784
166 GradientBackground = 0.3261
167 CycleColors = true
168 Cycles1:CosineCurve:44:1:24:1:240:0.3:1:1.7:1:0
169 Cycles = 12.4928
170 EnableFloor = true
171 FloorNormal = 0,1,0
172 FloorHeight = -2
173 FloorColor = 1,1,1
174 Iterations = 12
175 ColorIterations = 8
176 Power1:SineCurve:43:1:6:20:220:0.3:1:1.7:1:0
177 Power = 1
178 Bailout = 6.279
179 AlternateVersion = true
180 RotVector = 1,1,1
181 RotAngle1:OutInBack:36:0:360:40:200:0.3:1:1.7:1:0
182 RotAngle = 0.0
183 Julia = false
184 JuliaC = 0,0,0
185 #endpreset
186
187 #preset KeyFrame.001
188 FOV = 0.62536
189 Eye = 2.42106,0.501576,0.263686
190 Target = -6.2468,-0.836125,-0.622262
191 Up = 0,1,0
192 #endpreset
193
194 #preset KeyFrame.002
195 FOV = 0.62536
196 Eye = 2.42106,0.501576,0.263686
197 Target = -6.2468,-0.836125,-0.622262
198 Up = 0,1,0
199 #endpreset
|
33 - Simple Skybox.frag |
---|
33 - Simple Skybox.frag |
1 #info Mandelbulb Distance Estimator
2 #define providesInit
3
4 #define providesBackground
5 #define providesColor
6
7 #include "MathUtils.frag"
8 #include "DE-Raytracer.frag"
9
10 #group Skybox
11 uniform samplerCube skybox; file[cubemap.png]
12 vec3 backgroundColor(vec3 dir) {
13 float t = length(from-dir);
14 dir *= -1.;
15 return mix(textureCube(skybox, dir.xzy).rgb, BackgroundColor, 1.0-exp(-pow(Fog,4.0)*t*t));
16 }
17
18 uniform float RefractiveIndex; slider[0,1,10]
19 vec3 baseColor(vec3 point, vec3 N){
20 float ratio = 1.00 / RefractiveIndex;
21 vec3 I = (point - from);
22 vec3 R = refract(I, -N, ratio);
23 return textureCube(skybox, R.xzy).rgb;
24 }
25
26 #group Mandelbulb
27
28 // Number of fractal iterations.
29 uniform int Iterations; slider[0,9,100]
30
31 // Number of color iterations.
32 uniform int ColorIterations; slider[0,9,100]
33
34 // Mandelbulb exponent (8 is standard)
35 uniform float Power; slider[0,8,16]
36
37 // Bailout radius
38 uniform float Bailout; slider[0,5,30]
39 // mermelada's tweak Derivative bias
40 uniform float DerivativeBias; slider[0,1,10]
41
42 // Alternate is slightly different, but looks more like a Mandelbrot for Power=2
43 uniform bool AlternateVersion; checkbox[false]
44
45 uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
46
47 uniform float RotAngle; slider[0.00,0,180]
48
49 uniform bool Julia; checkbox[false]
50 uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
51
52 uniform float time;
53 mat3 rot;
54 void init() {
55 rot = rotationMatrix3(normalize(RotVector), RotAngle);
56 }
57
58 // This is my power function, based on the standard spherical coordinates as defined here:
59 // http://en.wikipedia.org/wiki/Spherical_coordinate_system
60 //
61 // It seems to be similar to the one Quilez uses:
62 // http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
63 //
64 // Notice the north and south poles are different here.
65 void powN1(inout vec3 z, float r, inout float dr) {
66 // extract polar coordinates
67 float theta = acos(z.z/r);
68 float phi = atan(z.y,z.x);
69 // mermelada's tweak
70 // http://www.fractalforums.com/new-theories-and-research/error-estimation-of-distance-estimators/msg102670/?topicseen#msg102670
71 dr = max(dr*DerivativeBias,pow( r, Power-1.0)*Power*dr + 1.0);
72 // scale and rotate the point
73 float zr = pow( r,Power);
74 theta = theta*Power;
75 phi = phi*Power;
76
77 // convert back to cartesian coordinates
78 z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
79 }
80
81 // This is a power function taken from the implementation by Enforcer:
82 // http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
83 //
84 // I cannot follow its derivation from spherical coordinates,
85 // but it does give a nice mandelbrot like object for Power=2
86 void powN2(inout vec3 z, float zr0, inout float dr) {
87 float zo0 = asin( z.z/zr0 );
88 float zi0 = atan( z.y,z.x );
89 float zr = pow( zr0, Power-1.0 );
90 float zo = zo0 * Power;
91 float zi = zi0 * Power;
92 // mermelada's tweak
93 // http://www.fractalforums.com/new-theories-and-research/error-estimation-of-distance-estimators/msg102670/?topicseen#msg102670
94 dr = max(dr*DerivativeBias,zr*dr*Power + 1.0);
95
96 zr *= zr0;
97 z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
98 }
99
100
101
102 // Compute the distance from `pos` to the Mandelbox.
103 float DE(vec3 pos) {
104 vec3 z=pos;
105 float r;
106 float dr=1.0;
107 int i=0;
108 r=length(z);
109 while(r<Bailout && (i<Iterations)) {
110 if (AlternateVersion) {
111 powN2(z,r,dr);
112 } else {
113 powN1(z,r,dr);
114 }
115 z+=(Julia ? JuliaC : pos);
116 r=length(z);
117 z*=rot;
118 if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
119 i++;
120 }
121 // if ((type==1) && r<Bailout) return 0.0;
122 return 0.5*log(r)*r/dr;
123 /*
124 Use this code for some nice intersections (Power=2)
125 float a = max(0.5*log(r)*r/dr, abs(pos.y));
126 float b = 1000;
127 if (pos.y>0) b = 0.5*log(r)*r/dr;
128 return min(min(a, b),
129 max(0.5*log(r)*r/dr, abs(pos.z)));
130 */
131 }
132
133 #preset Default
134 FOV = 0.62536
135 Eye = 1.578295,-2.374888,-0.1754925
136 Target = -2.237496,5.621949,-0.038792
137 Up = 0.0250519,0.0290368,-0.9993381
138 EquiRectangular = false
139 AutoFocus = false
140 FocalPlane = 1
141 Aperture = 0
142 Gamma = 2.08335
143 ToneMapping = 3
144 Exposure = 0.6522
145 Brightness = 1
146 Contrast = 1
147 Saturation = 1
148 GaussianWeight = 1
149 AntiAliasScale = 2
150 DepthToAlpha = false
151 ShowDepth = false
152 DepthMagnitude = 1
153 Detail = -2.84956
154 DetailAO = -1.35716
155 FudgeFactor = 1
156 MaxDistance = 1000
157 MaxRaySteps = 164
158 Dither = 0.51754
159 NormalBackStep = 1
160 AO = 0,0,0,0.85185
161 Specular = 0.336
162 SpecularExp = 16.364
163 SpecularMax = 10
164 SpotLight = 1,1,1,1
165 SpotLightDir = 0.7,-0.42
166 CamLight = 1,1,1,1.53846
167 CamLightMin = 0.12121
168 Glow = 1,1,1,0.43836
169 GlowMax = 52
170 Fog = 0
171 HardShadow = 0.35385
172 ShadowSoft = 12.5806
173 QualityShadows = false
174 Reflection = 0
175 DebugSun = false
176 BaseColor = 1,1,1
177 OrbitStrength = 0
178 X = 1,1,1,1
179 Y = 0.345098,0.666667,0,0.02912
180 Z = 1,0.666667,0,1
181 R = 0.0784314,1,0.941176,-0.0194
182 BackgroundColor = 0.607843,0.866667,0.560784
183 GradientBackground = 0.9701493
184 CycleColors = false
185 Cycles = 4.04901
186 EnableFloor = false
187 FloorNormal = 0,0,-1
188 FloorHeight = -3.095238
189 FloorColor = 1,1,1
190 Iterations = 12
191 ColorIterations = 8
192 Power = 8
193 Bailout = 6.279
194 AlternateVersion = true
195 RotVector = 1,1,1
196 RotAngle = 0
197 Julia = false
198 JuliaC = 0,0,0
199 skybox = cubemap.png
200 RefractiveIndex = 5.604396
201 DerivativeBias = 1
202 #endpreset
203
204 #preset Octobulb
205 FOV = 0.62536
206 Eye = -0.184126,0.843469,1.32991
207 Target = 1.48674,-5.55709,-4.56665
208 Up = 0,1,0
209 AntiAlias = 1
210 Detail = -2.47786
211 DetailAO = -0.21074
212 FudgeFactor = 1
213 MaxRaySteps = 164
214 BoundingSphere = 2
215 Dither = 0.5
216 AO = 0,0,0,0.7
217 Specular = 1
218 SpecularExp = 27.082
219 SpotLight = 1,1,1,0.94565
220 SpotLightDir = 0.5619,0.18096
221 CamLight = 1,1,1,0.23656
222 CamLightMin = 0.15151
223 Glow = 0.415686,1,0.101961,0.18421
224 Fog = 0.60402
225 HardShadow = 0.7230800
226 Reflection = 0.0
227 BaseColor = 1,1,1
228 OrbitStrength = 0.62376
229 X = 0.411765,0.6,0.560784,-0.37008
230 Y = 0.666667,0.666667,0.498039,0.86886
231 Z = 0.666667,0.333333,1,-0.25984
232 R = 0.4,0.7,1,0.36508
233 BackgroundColor = 0.666667,0.666667,0.498039
234 GradientBackground = 0.5
235 CycleColors = true
236 Cycles = 7.03524
237 FloorNormal = 0,0,0
238 FloorHeight = 0
239 FloorColor = 1,1,1
240 Iterations = 14
241 ColorIterations = 6
242 Power = 8.18304
243 Bailout = 6.279
244 AlternateVersion = true
245 RotVector = 1,0,0
246 RotAngle = 77.8374
247 #endpreset
248
249
250 #preset Refraction
251 FOV = 0.807947
252 Eye = 1.49337,-0.0604384,-1.459009
253 Target = -4.526366,-0.2098799,5.042469
254 Up = -0.02031,0.9980528,0.0041359
255 EquiRectangular = false
256 AutoFocus = false
257 FocalPlane = 1
258 Aperture = 0
259 Gamma = 2
260 ToneMapping = 5
261 Exposure = 1
262 Brightness = 1
263 Contrast = 1
264 Saturation = 1
265 GaussianWeight = 1
266 AntiAliasScale = 2
267 DepthToAlpha = false
268 ShowDepth = false
269 DepthMagnitude = 1
270 Detail = -3.601449
271 DetailAO = -1.35716
272 FudgeFactor = 1
273 MaxDistance = 1000
274 MaxRaySteps = 1185
275 Dither = 0.51754
276 NormalBackStep = 1
277 AO = 0,0,0,0
278 Specular = 0
279 SpecularExp = 0
280 SpecularMax = 0
281 SpotLight = 1,1,1,1
282 SpotLightDir = 0.63626,0.5
283 CamLight = 1,1,1,1.53846
284 CamLightMin = 0.12121
285 Glow = 1,1,1,1
286 GlowMax = 1000
287 Fog = 0
288 HardShadow = 0.35385
289 ShadowSoft = 12.5806
290 QualityShadows = false
291 Reflection = 0
292 DebugSun = false
293 BaseColor = 1,1,1
294 OrbitStrength = 1
295 X = 1,1,1,1
296 Y = 0.345098,0.666667,0,0.02912
297 Z = 1,0.666667,0,1
298 R = 0.0784314,1,0.941176,-0.0194
299 BackgroundColor = 0.607843,0.866667,0.560784
300 GradientBackground = 0.3261
301 CycleColors = false
302 Cycles = 4.04901
303 EnableFloor = false
304 FloorNormal = 0,0,0
305 FloorHeight = 0
306 FloorColor = 1,1,1
307 Iterations = 0
308 ColorIterations = 10
309 Power = 8
310 Bailout = 6.279
311 DerivativeBias = 1
312 AlternateVersion = false
313 RotVector = 1,1,1
314 RotAngle = 0
315 Julia = false
316 JuliaC = 1,1,1
317 skybox = cubemap.png
318 RefractiveIndex = 1.52
319 #endpreset
320
321 #preset Reflection
322 FOV = 1
323 Eye = 2.193986,2.218407,0.2322807
324 Target = -5.850334,-1.498805,0.2174372
325 Up = -0.0086972,0.021624,-0.7018754
326 EquiRectangular = false
327 AutoFocus = false
328 FocalPlane = 1
329 Aperture = 0
330 Gamma = 2
331 ToneMapping = 5
332 Exposure = 0.6522
333 Brightness = 1
334 Contrast = 1
335 Saturation = 1
336 GaussianWeight = 1
337 AntiAliasScale = 2
338 DepthToAlpha = false
339 ShowDepth = false
340 DepthMagnitude = 1
341 Detail = -1.318841
342 DetailAO = -1.35716
343 FudgeFactor = 1
344 MaxDistance = 1000
345 MaxRaySteps = 164
346 Dither = 0.51754
347 NormalBackStep = 1
348 AO = 0,0,0,0.85185
349 Specular = 1
350 SpecularExp = 16.364
351 SpecularMax = 10
352 SpotLight = 1,1,1,1
353 SpotLightDir = 0.7,-0.42
354 CamLight = 1,1,1,1.53846
355 CamLightMin = 0.12121
356 Glow = 1,1,1,0.43836
357 GlowMax = 52
358 Fog = 0
359 HardShadow = 0.35385
360 ShadowSoft = 12.5806
361 QualityShadows = false
362 Reflection = 1
363 DebugSun = false
364 BaseColor = 1,1,1
365 OrbitStrength = 0.14286
366 X = 1,1,1,1
367 Y = 0.345098,0.666667,0,0.02912
368 Z = 1,0.666667,0,1
369 R = 0.0784314,1,0.941176,-0.0194
370 BackgroundColor = 0.607843,0.866667,0.560784
371 GradientBackground = 0.3261
372 CycleColors = false
373 Cycles = 4.04901
374 EnableFloor = false
375 FloorNormal = 0,0,0
376 FloorHeight = 0
377 FloorColor = 1,1,1
378 Iterations = 0
379 ColorIterations = 8
380 Power = 8
381 Bailout = 6.279
382 AlternateVersion = true
383 RotVector = 1,1,1
384 RotAngle = 0
385 Julia = true
386 JuliaC = 0,0,0
387 skybox = cubemap.png
388 RefractiveIndex = 1.52
389 DerivativeBias = 0
390 #endpreset
|
Acknowledgements
Much of the inspiration and formulas for Fragmentarium came from the community at FractalForums.com, including Tom Beddard, Jan Kadlec, Iñigo Quilez, Buddhi, Jesse, and others. Special thanks goes out to Knighty and Kali for their great fragments. All fragments should include information about their origins - please notify me, if I made any mis-attributions.
The icons used are part of the Everaldo: Crystal project.
Fragmentarium is built using the Qt cross-platform GUI framework.
Translations by Fractal Forums users:
- Russian SCORPION
- Russian Crist-JRoger
- German Sabine
- Dutch Sabine
Contributors, This means allmost everyone at FractalForums.com over the last 7 years? This list is not complete.
- 3Dickulus
- Adam Majewski
- bermarte
- Buddhi
- cKleinhuis
- Claude
- Crist-JRodger
- DarkBeam
- Eiffie
- Íñigo Quílez
- Jesse
- Kali
- Knighty
- M Benesi
- mclarekin
- Patryk Kizny
- Stefan Gustavson
- Sabine
- SCORPION
- Syntopia
- SubBlue
- tglad
- Tryptophan
- Vinz
- _revers_
...just to name a few, if anyone can add to this list it would be a great help. If you contributed an idea or fix to the GUI or source code then I think your user/name deserves mention here too.
Other Docs
- official pages :
- Fractalforums :
- flicker group [21]
- deviantart
- commons : Category:Fragmentarium
- git forks
References
- ↑ Mikael Hvidtfeldt Christensen
- ↑ Fragmentarium FAQ by Mikael Hvidtfeldt Christensen December 30, 2011
- ↑ FractalForums.com -> Gallery
- ↑ FractalForums.org -> Gallery
- ↑ FractalForums.com -> Fragmentarium
- ↑ FractalForums.org -> Fragmentarium
- ↑ v1.0 github
- ↑ v1.0.31 Digilanti.org
- ↑ Ubuntu github.com
- ↑ SuSE github.com
- ↑ Fragmentarium usage
- ↑ Fragmentarium blog
- ↑ Fragmentarium home page
- ↑ github page
- ↑ Fragmentarium blog
- ↑ Fragmentarium official FAQ
- ↑ 3Dickulus: FragM wiki on github
- ↑ Fractal Forums page
- ↑ programming page
- ↑ FF gallery
- ↑ flicker group
- ↑ deviantart search
- ↑ Fragmentarium deviantart group