分形/fragmentarium
Fragmentarium 是 Mikael Hvidtfeldt Christensen [1] 开发的一款开源跨平台 IDE,用于探索基于 GPU 的像素图形。它受到 Adobe Pixel Bender 的启发,但使用 GLSL,并且专门针对分形和生成系统而创建。
功能
- 多标签 IDE,带有 GLSL 语法高亮
- 用于操作参数设置的用户小部件。
- 不同的“鼠标到 GLSL”映射方案
- 模块化 GLSL 编程 - 包含其他片段
- 包含用于距离估计系统的简单光线追踪器
- 许多示例,包括 Mandelbulb、Mandelbox、万花筒 IFS 和 Julia 四元数。
根据 LPGL 或 GPL 许可证授权和分发。
注意:某些片段(GLSL)着色器受其他作者版权保护,可能附带其他许可证。在重新分发之前,请查看片段文件头。
在提出问题之前,请阅读常见问题解答。[2]
有关图像示例,请查看 FF Fragmentarium 画廊。[3][4]
更多信息可以在以下网站找到:FractalForums.com -> Fragmentarium [5] 和 FractalForums.org -> Fragmentarium[6]
这是关于它的非官方维基。
Fragmentarium 有几种不同的版本。主要区别是...
- 版本 1.0 只有“时间”变量用于动画。
- 版本 1.0.31 引入了基于摄像机位置 Catmull-Rom 样条线的关键帧动画,带有缓动曲线的参数变形,目标跟踪自动对焦,OpenEXR 格式纹理输入和图像输出,以及德语、荷兰语和俄语翻译。
- 版本 2.0.0 带来了 samplerCube 纹理和双精度统一小部件。
可以在 syntopia.github[7] 上找到预编译的 Mac 和 Windows 可执行文件包
或者在 Ubuntu Linux 上...
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
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
转到 ~/Fragmentarium-master/Fragmentarium-Source 目录,然后运行 Gui 程序
cd ~/Fragmentarium-master/Fragmentarium-Source ./Fragmentarium-Source
注意:此时,最好将 Examples、Icons 和 Misc 文件夹与 Fragmentarium 可执行文件一起移动到合适的 рабочая папка 中,并更改 Fragmentarium-Source.exe 文件的名称。
可以在 Digilanti.org[8] 上找到 Windows 安装程序
Windows 用户可以下载 6.0M 的 Fragmentarium 安装程序,并通过导航到您的下载文件夹并单击安装程序图标来运行它。
这将安装 Windows 可执行文件 + 示例 Includes 和 Misc 文件夹 + Qt 5.6.2 运行时 DLL + GUI 翻译文件到您主文件夹中的工作文件夹中,并在开始菜单中创建指向可执行文件和维护程序的快捷方式。
下载与 OpenEXR 源代码捆绑在一起的 Fragmentarium 1.0.31 源代码,或下载包含预编译的静态 OpenEXR 库的较小归档文件。
对于 windows,编译脚本期望在 C: 驱动器的顶层找到源代码,因此将归档文件解压缩到那里,或调整 windows bat 文件中的路径名。
注意:从这里开始,v1.0.31 源代码可根据要求提供,因为开发在 v2.0 分支中。
CMake 3 + CMake-gui Qt 5.6 C++ compiler OpenGL
上述软件包应与相应的开发软件包一起安装。
Git (if fetching the source directly from the repository)
安装 Qt v5.6 和 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
这将构建 OpenEXR 和 Fragmentarium 项目,并将可执行文件与支持文件安装到 C:/Fragmentarium-1.0.31-3Dickulus/Fragmentarium 文件夹中,然后可以将此文件夹重新定位到您喜欢的任何位置。
归档文件可以解压缩到任何位置,标准开发环境(带有 Qt5 OpenGL 和 OpenEXR)就足够了。
cd <wherever>/Fragmentarium-1.0.31-3Dickulus/ sh ./mklinux.sh
这将构建 OpenEXR 和 Fragmentarium 项目,并将可执行文件和支持文件安装到 **<wherever>/Fragmentarium-1.0.31-3Dickulus/Fragmentarium** 文件夹中,此文件夹随后可以重新定位到您喜欢的任何位置。
要仅构建 Fragmentarium,在运行其中一个脚本后...
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
获取 v2.0.0
[edit | edit source]Ubuntu
[edit | edit source]github.com [9] 上的预编译 **Ubuntu 14.04.5** 包需要 Qt v5.7
或者从 Ubuntu "trusty" 上的源代码编译
安装 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
安装 Qt-5.7
sudo apt-add-repository -y ppa:beineri/opt-qt571-trusty sudo apt-get update -qq sudo apt-get install qtcreator-latest
安装 openexr-2.2 开发版 + 运行时
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
安装 Extra-CMake-Modules 用于 FindOpenEXR()
sudo apt-get install extra-cmake-modules source /opt/qt57/bin/qt57-env.sh
获取源代码
git clone https://github.com/3Dickulus/FragM
构建并安装
cd FragM/Fragmentarium-Source mkdir build cd build cmake -DNVIDIAGL4PLUS=ON -DUSE_OPEN_EXR=ON -DCMAKE_INSTALL_PREFIX=~/ .. make install
- 以上操作将安装在 /home/username/Fragmentarium 文件夹中,其中包含头文件和支持文件。
- 要为所有用户安装,请将 **-DCMAKE_INSTALL_PREFIX=~/** 更改为 **-DCMAKE_INSTALL_PREFIX=/usr/local** 并使用 **sudo make install**
SuSE Leap 42.2
[edit | edit source]github.com [10] 上的 Linux **SuSE Leap 42.2** rpm 包的先决条件
**系统** 桌面
OpenEXR 2.1
Qt 5.6
构建
安装 git 和最新的 CMake 和 CMake-GUI 程序,以及 ECM(**E**xtra **C**Make **M**odules)以及 Qt5 和 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
[edit | edit source]**Mac OSX** 的先决条件(这是在 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
在调用 cmake 之前,需要设置这些环境变量...
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"
获取源代码...
git clone https://github.com/3Dickulus/FragM
然后构建,执行以下命令...
cd FragM/Fragmentarium-Source mkdir build cd build cmake -DNVIDIAGL4PLUS=ON -DUSE_OPEN_EXR=ON -DCMAKE_INSTALL_PREFIX=../../ .. make install
要构建 dmg 存档,请执行以下命令...
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
...这将在构建文件夹中创建一个名为 Fragmentarium-2.0.b-my_build.dmg 的文件。
现在你已经安装好了 ;)
[edit | edit source]在浏览器中打开 syntopia.github[11] 以了解预处理器命令、神奇的 uniforms 和 GUI 元素。
在浏览器中打开 blog.hvidtfeldts[12] 以了解路径追踪 3D 分形背后的数学原理和 GLSL 代码。
v1.0 Syntopia 链接中找到的信息对所有版本的 Fragmentarium 都有效。
GUI 使用
[edit | edit source]通过点击可执行文件的图标从桌面运行。您可以将 **.frag**、**。fragparams** 和 **.png** 屏幕截图文件拖放到主窗口,Fragmentarium 将为 .frag 文件打开一个新标签,或将参数设置应用到当前片段。设置存储在屏幕截图 png 文件的“frAg”块中,并由 Fragmentarium 自动识别。
命令行使用
[edit | edit source]./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.
故障排除
[edit | edit source]OpenGL 版本不匹配
[edit | edit source]FragM 2 需要 OpenGL 4.1 Compatibility Profile 上下文。一些驱动程序在 Compatibility Profile 中提供较低版本,将较高版本保留给 Core Profile。
检查它
glxinfo | grep "core profile"
不幸的是,如果 FragM 获取了较低版本,它可能会在启动时崩溃并出现段错误。
Mesa
[edit | edit source]检查您是否正在使用 MESA
glxinfo | grep version
如果使用 Mesa 作为 OpenGL(最常见的是在 Linux 上使用 Free/Libre Open Source 驱动程序),您可以在启动 FragM 之前通过在 shell 中设置环境变量来强制 Mesa 撒谎有关其功能。
export MESA_GL_VERSION_OVERRIDE="4.6COMPAT"
但这可能只是将崩溃推迟,直到调用不支持的功能。后果自负。
文件和文件夹
[edit | edit source]示例
[edit | edit source]包含 16 个子文件夹中的 233 个文件,此树在 Examples 菜单中重复,只需选择一个,它将被加载到一个新的标签中。
Examples/Tutorials
[edit | edit source]包含 19 个教程片段,演示特定功能或技术。
Examples/ 中的其余文件夹包含来自众多贡献者的片段,请参阅致谢
fqScript
[edit | edit source]包含一些可以在 Fragmentarium 中加载、编辑、执行和保存的示例 **F**ragmentarium **Q**t **S**cript 文件。
杂项
[edit | edit source]包含用于视频编码器的 **opt**ions 文件,此文件夹还用于工具脚本,如 *mkcombined.sh* 和描述代码编辑器高亮的 glsl.xml,在 glsl.xml 的末尾,有用户可选择颜色和样式提示的位置,因此可以根据自己的口味定制高亮显示。
语言
[edit | edit source]包含 Sabine、Crist-JRoger 和 SCORPION 贡献的荷兰语、德语和俄语的 GUI 翻译文件。
主窗口
[edit | edit source]**顶部**,程序菜单和动态菜单
**工具栏**,缓冲区大小、构建、渐进式/动画停止启动倒带、子帧设置和读出、当前时间设置和读出。
**左侧**,片段编辑器,通过将分隔条一直拖到左侧来隐藏
**中间**,GL 渲染区域
**右侧**,变量小部件(uniforms)停靠窗口,可以浮动或隐藏
**底部**,日志停靠窗口,可以浮动或隐藏
**状态栏**,传递信息消息,具有光标位置的 XYZ 读出、每秒渲染帧数。
菜单
[edit | edit source]文件
[edit | edit source]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 | edit source]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.
渲染
[edit | edit source]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.
参数
[edit | edit source]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.
示例
[edit | edit source]此菜单在运行时从当前活动 示例文件夹 的内容动态填充。选择一个片段将加载文件到新标签并执行构建。
Windows
[edit | edit source]这些是主窗口中可以显示或隐藏的部分。在菜单栏的空白部分右键单击将显示此菜单作为弹出窗口。
Log Variable Editor (uniforms) File Toolbar Edit Toolbar Buffer Dimensions Render Toolbar Rendering Mode Zappa Tools Time
帮助
[edit | edit source]这些应该是不言自明的。
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 工具
[edit | edit source]当您的系统上安装了 OpenEXR 时,此菜单应填充这些命令。从此菜单中选择一个命令将显示一个使用帮助对话框,这些都是命令行程序,此处只显示有关命令的信息。
exrenvmap exrheader exrmakepreview exrmaketiled exrmultipart exrmultiview exrstdattr
如果 EXR 工具 菜单存在但没有显示任何条目,您可以通过 编辑 菜单中的 偏好设置... 设置 EXR 二进制路径。
主窗口对话框
[edit | edit source]高分辨率和动画渲染 : 打开渲染对话框。您可以在此处渲染单个图像或一系列动画图像。 | |
缓动曲线 : 此对话框表示当前选定滑块可用的缓动选项。 | |
时间轴 : 关键帧和缓动曲线的粗略表示,仍在开发中。 | |
偏好设置 : 主要程序全局选项。 | |
视频编码 : 要设置 mencoder 或 ffmpeg,一些示例选项文件位于 Misc 文件夹中。 |
脚本
[edit | edit source]Fragmentarium 可以通过 fqscript 文件中可用的脚本命令进行控制。
通用命令
[edit | edit source]void setFrame(int);
设置当前帧号。
int getFrame();
返回当前帧号。
void loadFragFile(String);
打开一个新的编辑器选项卡,加载名为 fragment 的文件,初始化默认预设,如果文件包含这些设置,则初始化关键帧和缓动曲线。
bool initializeFragment();
返回成功或失败。在渲染图像之前必须在修改锁定变量后调用。
参数命令
[edit | edit source]void setParameter(String);
从字符串中设置参数,格式为 "parameter = value",也接受参数文件格式字符串。
void setParameter(String, bool);
设置布尔参数,其中 String 是参数名称,bool 是 TRUE 或 FALSE
void setParameter(String, int);
设置整数参数,其中 String 是参数名称,int 是任何整数。
void setParameter(String, x);
设置浮点参数,其中 String 是参数名称,x 是任何浮点数。
void setParameter(String, x, y);
设置 float2 参数,其中 String 是参数名称,x,y 是任何浮点数。
void setParameter(String, x, y, z);
设置 float3 参数,其中 String 是参数名称,x,y,z 是任何浮点数。
void setParameter(String, x, y, z, w);
设置 float4 参数,其中 String 是参数名称,x,y,z,w 是任何浮点数。
String getParameter(String);
返回表示命名参数的值的字符串,用户必须将其解析为可用的值。
void applyPresetByName(String);
应用命名预设。
高分辨率图像和动画对话框命令
[edit | edit source]void setAnimationLength(int);
设置总动画持续时间(以秒为单位)。
void setTileWidth(int); void setTileHeight(int);
设置图块宽度和高度。
void setTileMax(int);
设置行和列图块的数量,此值平方 = 总图块。
void setSubFrames(int);
设置要累积的帧数。
void setOutputBaseFileName(String);
设置保存图像的文件名,如果脚本完全控制,则必须在每帧中由脚本设置,如果动画使用 frag 文件设置、关键帧等,则只需设置一次基名,Fragmentarium 将添加一个填充到 5 位的索引。
void setFps(int);
设置渲染的帧率。
void setStartFrame(int);
设置渲染一系列帧的起始帧号。
void setEndFrame(int);
设置渲染一系列帧的结束帧号。
void setAnimation(bool);
FALSE 将动画设置为仅由脚本控制。TRUE 启用来自关键帧和缓动曲线的控制。
void setPreview(bool);
TRUE 将在桌面上的窗口中预览帧,而不是保存图像文件。
控制命令
[edit | edit source]bool scriptRunning();
当用户在脚本编辑器中选择 [停止] 按钮时返回 FALSE。用于在脚本中实现用户测试以退出脚本控制循环。
void stopScript();
用于在脚本中实现用户测试以退出脚本控制循环或错误,例如文件未找到、初始化失败等。
void tileBasedRender();
开始渲染当前帧或一系列帧,应用当前的关键帧状态和活动缓动设置。
预处理器命令
[edit | edit source](来自 syntopia.github.io) Fragmentarium 添加了一些额外的预处理器命令。
#include "some.frag"
只需包含引用的文件。如果文件名是相对文件名,Fragmentarium 首先搜索与当前执行文件(如果已保存)的位置相关的文件,否则搜索“包含路径”偏好设置中指定的路径。
#camera 3D
告诉 Fragmentarium 设置 3D 相机模型,以便使用画布上的鼠标调整相机。
#camera 2D
告诉 Fragmentarium 设置 2D 相机模型。
#group parameter group name
可以按组对 GUI 元素进行排序。
#info "hello there"
编译片段时输出信息。对归属很有用。
#includeonly "some.frag"
实验性。包含 'some.frag',但会忽略该文件中的任何 'include' 命令。
#replace "before" "after"
实验性。在所有后续读取行(不在先前解析的行中)中替换给定的模式。
#donotrun
告诉 Fragmentarium 不应尝试运行此文件——它旨在从另一个文件包含。
#preset name
标记具有参数设置的节的开始。这些将显示在参数编辑器窗口的下拉组合框中。
#endpreset
标记具有参数设置的节的结束。
统一小部件
[edit | edit source]行:uniform float Angle; slider[45.00,0,360] 在 GLSL 编辑器中将使一个简单的变量编辑器小部件出现。
要为其他类型的制服创建小部件...
uniform type name ; widget[min,default,max] locktype
关键字 uniform 必须始终出现在行的开头。
locktype 可以是 locked notlocked notlockable alwayslocked 中的其中之一,默认为 notlocked
在菜单/编辑/偏好设置对话框中,您可以选择锁定处理的行为。“锁定”制服可以解释为最终发送到 GPU 的 GLSL 代码中的“#define”或“const”。
type 和 widget 可以是以下 GLSL 有效类型和相应的 Fragmentarium 小部件...
类型 | 小部件 | ||
---|---|---|---|
uniform | int | name; | slider[min,default,max] |
uniform | bool | name; | checkbox[true 或 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] 仅颜色选择器 |
uniform | vec4 | name; | color[min,default,max, R, G, B] 带有颜色选择器的滑块 |
uniform | sampler2D | name; | file[imageFileName] 可以是任何支持的格式 |
所有 v1.0 - v1.0.31 以及这些...
类型 | 小部件 | ||
---|---|---|---|
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] 仅颜色选择器 |
uniform | dvec4 | name; | color[min,default,max, R, G, B] 带有颜色选择器的滑块 |
所有 float 类型滑块都有 7 位小数,而 double 类型则有 14 位。
00 - Simple 2D system.frag |
---|
00 - Simple 2D system.frag |
#include "2D.frag"
// The simplest way to draw something in Fragmentarium,
// is to include the "2D.frag" header.
//
// Now, we can implement a simple 'color' function,
// which for each point in the plane returns a RGB color.
//
// Notice, that you can zoom using the mouse or the keyboard.
// (A,S,D,W,Q,E,1,3)
vec3 color(vec2 c) {
return vec3(cos(c.x),sin(c.y),sin(c.x*c.y));
}
|
01 - Simple 2D Escape Time Fractal.frag |
---|
01 - Simple 2D Escape Time Fractal.frag |
#include "2DJulia.frag"
#include "Complex.frag"
// Escape time fractals iterate a functions for each point
// in the plane, and check if the sequence generated converges.
//
// The "2DJulia.frag" helper file makes it easy to generate
// these kind of systems.
//
// Just implement the 'formula' function below.
// It is possible to draw Mandelbrots and Julias
// and customize the coloring.
//
// Here is an example of a Mandelbrot:
vec2 formula(vec2 z, vec2 offset) {
z = cMul(z,z)+offset;
return z;
}
|
02 - User Variables and Presets.frag |
---|
02 - User Variables and Presets.frag |
#include "2D.frag"
// It is easy to create custom variables,
// and tie them to sliders in the user interface.
//
// Hint: use the context menu to quickly
// insert templates for different variable types.
// Here you can also see the different types
// of variables.
// Organize controls by grouping them
#group MySystem
// Creates a floating point variable,
// with a slider with minimum = 0,
// default = 1, and maximum 10.
uniform float X; slider[0,1,10]
uniform float Y; slider[0,1,10]
// Use the variable like any other in the code
// (But don't assign to them)
vec3 color(vec2 c) {
return vec3(cos(c.x*X)+sin(c.y*Y),
sin(c.x*Y)+cos(c.y*X),
sin(c.x*c.y));
}
// It is possible to store one or more user variable
// settings in a Preset.
//
// Preset are parsed at build time, and will
// appear in the drop-down box in the Parameter
// window, where they can be quickly applied.
// Presets with the name 'Default'
// will be automatically assigned,
// when the system is built the first time.
#preset Default
Center = -0.221053,0.488189
Zoom = 0.186907
AntiAliasScale = 1
AntiAlias = 1
X = 1.2977
#endpreset
// Create presets by using the
// 'Copy to Clipboard' button in the
// Parameter window.
#preset Preset 2
Center = -0.221053,0.488189
Zoom = 0.335658
AntiAliasScale = 1
AntiAlias = 1
X = 6.8702
Y = 0.3053
Y = 6.3359
#endpreset
|
03 - Dynamic Systems.frag |
---|
03 - Dynamic Systems.frag |
#include "2D.frag"
// It is possible to change variables
// based on a special uniform 'time' variable.
//
// To see this in action, you must
// change the Render mode to 'Animation (time)' -
// otherwise the system will only render changes
// when something changes.
#group MySystem
uniform float X; slider[0,1,10]
uniform float Y; slider[0,1,10]
uniform float time;
vec3 color(vec2 c) {
return vec3(cos(c.x*X+time)+sin(c.y*Y+time*2.0),
sin(c.x*Y)+cos(c.y*X+time),
sin(c.x*c.y+time));
}
#preset Default
Center = -1.87816,-0.786641
Zoom = 0.214943
AntiAliasScale = 1
AntiAlias = 1
X = 5.0382
Y = 3.0534
#endpreset
|
04 - Textures.frag |
---|
04 - Textures.frag |
#include "2D.frag"
// It is possible to read from external bitmaps
// from Fragmentarium using textures.
// Set up a sampler2D as below,
// and read using the texture2D command.
#group MySystem
uniform float T ;slider[0,4,10]
uniform float R; slider[0,2,10]
uniform float step; slider[0,0.004,0.01]
uniform float time;
// Here we read from a texture
// Files locations are resolved relative to the current file,
// and to the include path set in the settings.
uniform sampler2D texture; file[texture2.jpg]
// You can set texture parameters directly:
#TexParameter texture GL_TEXTURE_MAG_FILTER GL_LINEAR
#TexParameter texture GL_TEXTURE_WRAP_S GL_REPEAT
#TexParameter texture GL_TEXTURE_WRAP_T GL_REPEAT
// A simple system based on the 'tunnel' system by Inigo Quilez:
// http://www.iquilezles.org/apps/shadertoy/
vec3 color(vec2 c) {
c*= 1.3+cos(time*2.0);
vec2 uv;
float a = atan(c.y,c.x);
float r = length(c);
uv.x = .5*time+.1/r;
uv.y = a/3.1416 + time*0.1;
vec2 dd = vec2(step,0.0);
vec2 d =uv;
vec3 col = texture2D(texture,d).xyz;
vec3 colX = texture2D(texture,d+dd.xy).xyz;
vec3 colMX = texture2D(texture,d-dd.xy).xyz;
vec2 g;
g.x = length(colMX)-length(colX);
vec3 colY = texture2D(texture,d+dd.yx).xyz;
vec3 colMY = texture2D(texture,d-dd.yx).xyz;
g.y = length(colMY)-length(colY);
g = normalize(g);
vec2 light = vec2(cos(time*T),sin(time*T))*R;
return mix(col,r*col* max(-1.0,dot(light,g)),0.9);
}
#preset Default
Center = -0.0214904,-0.00195827
Zoom = 2.34384
AntiAliasScale = 1
AntiAlias = 1
T = 4.3511
R = 2.2308
step = 0.0041
#endpreset
|
10 - Simple Distance Estimated 3D system.frag |
---|
10 - Simple Distance Estimated 3D system.frag |
#define providesColor
#include "Soft-Raytracer.frag"
// This is an example of
// a simple distance estimated system.
//
// The function "DE" must return
// the distance to the closest
// point on any objects in any direction.
vec3 baseColor(vec3 p, vec3 n) {
if (mod(length(p*10.0),2.0)<1.0) return vec3(1.0);
return vec3(0.0);
}
float DE(vec3 z) {
float d = (length(z-vec3(1.0,0.0,0.0))-1.0); // A sphere
d = max(d,- (length(z.xy-vec2(1.,0.0))-0.4)); // minus a tube
d = max(d,- (length(z.yz-vec2(0.,0.0))-0.4)); // minus a tube
d = max(d,- (length(z.xz-vec2(1.,0.0))-0.4)); // minus a tube
d = min(d, z.x); // plus a ground plane
d = min(d, length(z.yz-vec2(1.,1.0))-0.3); // plus a tube
return d;
}
#preset Default
FOV = 0.4
Eye = 4.76415,-4.09381,3.08941
Target = -1.17452,2.39263,-1.67067
Up = 0.803593,0.507247,-0.311349
#endpreset
|
11 - Simple Distance Estimated 3D fractal.frag |
---|
11 - Simple Distance Estimated 3D fractal.frag |
#include "DE-Raytracer.frag"
// Here one of the simplest fractals,
// a distance estimated Menger cube.
#group Menger
uniform int Iterations; slider[0,8,100]
uniform int ColorIterations; slider[0,8,100]
uniform float Scale; slider[0.00,3.0,4.00]
uniform vec3 Offset; slider[(0,0,0),(1,1,1),(1,1,1)]
float DE(vec3 z)
{
int n = 0;
while (n < Iterations) {
z = abs(z);
if (z.x<z.y){ z.xy = z.yx;}
if (z.x< z.z){ z.xz = z.zx;}
if (z.y<z.z){ z.yz = z.zy;}
z = Scale*z-Offset*(Scale-1.0);
if( z.z<-0.5*Offset.z*(Scale-1.0)) z.z+=Offset.z*(Scale-1.0);
if (n<ColorIterations) orbitTrap = min(orbitTrap, (vec4(abs(z),dot(z,z))));
n++;
}
return abs(length(z)-0.0 ) * pow(Scale, float(-n));
}
#preset Default
FOV = 0.4
Eye = -3.55741,0.119991,-2.22946
Target = 4.91261,-0.165702,3.07876
Up = 0.0398762,0.999198,-0.00374516
AntiAlias = 1
Detail = -2.35396
DetailAO = -1.00002
FudgeFactor = 1
MaxRaySteps = 56
BoundingSphere = 3.774
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.7
Specular = 0.1666
SpecularExp = 16
SpotLight = 1,1,1,0.19608
SpotLightDir = 0.37142,0.1
CamLight = 1,1,1,1.13978
CamLightMin = 0.29412
Glow = 1,1,1,0.07895
GlowMax = 20
Fog = 0.4161
HardShadow = 0.33846
ShadowSoft = 2
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.64935
X = 0.5,0.6,0.6,0.2126
Y = 1,0.6,0,0.30708
Z = 0.8,0.78,1,1
R = 0.666667,0.666667,0.498039,0.03174
BackgroundColor = 0.6,0.6,0.45
GradientBackground = 0.3
CycleColors = false
Cycles = 6.95699
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 8
ColorIterations = 5
Scale = 3
Offset = 1,1,1
#endpreset
|
12 - Faster raytracing of 3D fractals.frag |
---|
12 - Faster raytracing of 3D fractals.frag |
// There are different ways to speedup
// raytracing.
//
// 1) Using the 'Preview' sliders to render at lower resolution.
// 2) Locking parameters, you do not want to change dynamically, by clicking the padlock next to them, and recompiling
// 3) Using another raytracer:
//
// In this example the 'Fast-Raytracer' is used,
// it is faster then the default one, but does
// not offer as much flexibility.
//
// Subblue's raytracer is another faster option.
#include "Fast-Raytracer.frag"
//#include "Subblue-Raytracer.frag"
// Here one of the simplest fractals,
// a distance estimated Menger cube.
#group Menger
uniform int Iterations; slider[0,8,100]
uniform int ColorIterations; slider[0,8,100]
uniform float Scale; slider[0.00,3.0,4.00]
uniform vec3 Offset; slider[(0,0,0),(1,1,1),(1,1,1)]
float DE(vec3 z)
{
int n = 0;
while (n < Iterations) {
z = abs(z);
if (z.x<z.y){ z.xy = z.yx;}
if (z.x< z.z){ z.xz = z.zx;}
if (z.y<z.z){ z.yz = z.zy;}
z = Scale*z-Offset*(Scale-1.0);
if( z.z<-0.5*Offset.z*(Scale-1.0)) z.z+=Offset.z*(Scale-1.0);
if (n<ColorIterations) orbitTrap = min(orbitTrap, (vec4(abs(z),dot(z,z))));
n++;
}
return abs(length(z)-0.0 ) * pow(Scale, float(-n));
}
#preset Default
FOV = 0.4
Eye = -3.55741,0.119991,-2.22946
Target = 4.91261,-0.165702,3.07876
Up = 0.0398762,0.999198,-0.00374516
AntiAlias = 1
Detail = -2.35396
DetailAO = -1.00002
FudgeFactor = 1
MaxRaySteps = 56
BoundingSphere = 3.774
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,0.7
Specular = 0.1666
SpecularExp = 16
SpotLight = 1,1,1,0.19608
SpotLightDir = 0.37142,0.1
CamLight = 1,1,1,1.13978
CamLightMin = 0.29412
Glow = 1,1,1,0.07895
GlowMax = 20
Fog = 0.4161
HardShadow = 0.33846
ShadowSoft = 2
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.64935
X = 0.5,0.6,0.6,0.2126
Y = 1,0.6,0,0.30708
Z = 0.8,0.78,1,1
R = 0.666667,0.666667,0.498039,0.03174
BackgroundColor = 0.6,0.6,0.45
GradientBackground = 0.3
CycleColors = false
Cycles = 6.95699
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 8
ColorIterations = 5
Scale = 3
Offset = 1,1,1
#endpreset
|
20 - Progressive 2D.frag |
---|
20 - Progressive 2D.frag |
#include "Progressive2D.frag"
#include "Complex.frag"
// An example of using progressive rendering.
// Bbuffers are set up by the 'Progressive2D' fragment.
//
// Remember to set 'Render mode' to 'Progressive'.
// Progressive rendering, makes very high-quality AA possible.
// Notice, that this is a difficult image to render, due to very high frequency components.
vec3 color(vec2 v) {
vec2 p = (viewCoord+vec2(1.0))/2.0;
p=p/pixelSize;
if (p.y<40.0) {
return vec3(pow(0.5,1.0/Gamma));
}
float r = dot(v,v);
float a = 1.0;
if (mod(r,1.0)<0.5) a =1.0-a;
if (v.y>0.0) a = 1.0-a;
return vec3(a);
}
#preset Default
Center = 0.0727965,-0.192122
Zoom = 0.141329
Gamma = 2.2
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
AARange = 4.15701
AAExp = 1.81626
GaussianAA = true
#endpreset
|
21 - Progressive 2D Escape Time Fractal.frag |
---|
21 - Progressive 2D Escape Time Fractal.frag |
#include "Progressive2DJulia.frag"
#include "Complex.frag"
// An example of Escape Time Fractals,
// using progressive rendering.
// Bbuffers are set up by the 'Progressive2DJulia' fragment.
//
// Remember to set 'Render mode' to 'Continous'.
// Progressive rendering, makes very high-quality AA possible.
// Fractal by Kali: http://www.fractalforums.com/new-theories-and-research/very-simple-formula-for-fractal-patterns/msg31800/#msg31800
uniform float MinRadius; slider[0,0,10]
uniform float Scaling; slider[-5,0,5]
vec2 formula(vec2 z,vec2 c) {
float m =dot(z,z);
if (m<MinRadius) {
z = abs(z)/(MinRadius*MinRadius);
}else {
z = abs(z)/m*Scaling;
}
return z+c;
}
#preset Default
Center = -0.118362,0.0108127
Zoom = 10.8053
Gamma = 2.5463
ToneMapping = 3
Exposure = 1.3044
Brightness = 1
Contrast = 1.0396
Saturation = 1.8817
AARange = 1
AAExp = 1
GaussianAA = false
Iterations = 1000
PreIterations = 15
R = 1
G = 0.84034
B = 0.525
C = 0.90756
Julia = true
JuliaX = 1.43649
JuliaY = 2.05404
ShowMap = false
MapZoom = 2.1
EscapeSize = 5
ColoringType = 0
ColorFactor = 0.5
MinRadius = 0
Scaling = -1.9231
#endpreset
|
22 - Progressive 3D Rendering.frag |
---|
22 - Progressive 3D Rendering.frag |
// An example of rendering using the progressive 3D ray tracer,
// which makes it possible to use effects like real soft shadows,
// better anti-alias, better ambient-occlusion and depth-of-field.
// Rendering is much slower, though.
//
// To use it, just include "Soft-Raytracer" instead of "DE-Raytracer"
//
// Remember to set 'Render mode' to 'Continous'!
#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/)
#include "Soft-Raytracer.frag"
#group Trefoil
//Radius of the tubes
uniform float tubeRadius; slider[0,0.1,0.5]
//Radius of the goup of tubes
uniform float groupRadius; slider[0,0.4,0.5]
//Radius of the whole object (because it looks like a torus (-:)
uniform float objectRadius; slider[0,1,1]
//Rotation Numerator X: actually not a rotation. This is frequency in x direction
uniform int RotNumeratorX; slider[-10,2,10]
//Rotation Numerator Y: actually not a rotation. This is frequency in y direction. (lissajou figure)
uniform int RotNumeratorY; slider[-10,4,10]
//Rotation Denominator: this is the rotation "speed" in xz plane
uniform int RotDenominator; slider[1,3,20]
//Rotations number: how many instances to check. related to the period of the knot. Have to find math formula for that.
uniform int Rotations; slider[1,1,10]
float Cylinder(vec2 p){
p.x-=groupRadius;
return length(p)-tubeRadius;
}
float twist(vec3 p){//seen from above it is a lissajou fugure
float ra =p.z*float(RotNumeratorX)/float( RotDenominator);
float raz=p.z*float(RotNumeratorY)/float(RotDenominator);
return length(p.xy-vec2(groupRadius*cos(ra)+objectRadius,groupRadius*sin(raz)+objectRadius))-tubeRadius;
}
vec3 bend2PI(vec3 p){
return vec3(length(p.xz),p.y,atan(p.z,p.x));
}
float DE(vec3 p) {
float r=length(p.xz), ang=atan(p.z,p.x),y=p.y;
float d=10000.;
for(int i=0; i<Rotations;i++){
vec3 p=vec3(r,y,ang+2.*PI*float(i));
p.x-=objectRadius;
d=min(d,twist(p));
}
return min(d,p.y);
}
#preset default
FOV = 0.62536
Eye = 0.77939,1.62364,1.44633
Target = -2.86937,-4.53699,-3.77496
Up = -0.312624,0.711048,-0.620502
EquiRectangular = false
FocalPlane = 1.4674
Aperture = 0.02
Gamma = 2.2685
ToneMapping = 2
Exposure = 0.9783
Brightness = 1
Contrast = 1.0891
Saturation = 1.4516
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3
DetailAO = -0.14287
FudgeFactor = 0.66265
MaxRaySteps = 132
BoundingSphere = 4 Locked
Dither = 0 Locked
NormalBackStep = 1
AO = 0,0,0,0.61224
Specular = 0.3797
SpecularExp = 51.389
SpotLight = 0.811765,1,0.819608,2.2222
SpotLightPos = 5,2.676,-0.7042
SpotLightSize = 1.25157
CamLight = 0.0980392,0.713725,1,0.53846
CamLightMin = 0
Glow = 1,1,1,0
GlowMax = 20
Fog = 0
Shadow = 0.86364 NotLocked
Sun = 0.84582,1.57
SunSize = 0.01
Reflection = 0
BaseColor = 0.701961,0.701961,0.701961
OrbitStrength = 0
X = 0.411765,0.6,0.560784,0.41748
Y = 0.666667,0.666667,0.498039,-0.16504
Z = 1,0.258824,0.207843,1
R = 0.0823529,0.278431,1,0.82352
BackgroundColor = 0,0,0
GradientBackground = 0.3261
CycleColors = true
Cycles = 4.04901
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
tubeRadius = 0.07534
groupRadius = 0.29851
objectRadius = 0.43077
RotNumeratorX = -2
RotNumeratorY = -4
RotDenominator = 3
Rotations = 3
#endpreset
|
23 - Working with the back buffer.frag |
---|
23 - Working with the back buffer.frag |
#buffer RGBA16
#include "2D.frag"
// A 'Game of Life' implementation
// demonstrating how to work with a pixel-accurate
// back buffer.
// Switch to Continuous mode. Set Subframe max to zero!
// Make sure AntiAlias is off (set to 1).
//
uniform sampler2D backbuffer;
uniform float time;
/*
From Wikipedia:
Any live cell with fewer than two live neighbours dies, as if caused by under-population.
Any live cell with two or three live neighbours lives on to the next generation.
Any live cell with more than three live neighbours dies, as if by overcrowding.
Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
*/
vec2 position = (viewCoord*1.0+vec2(1.0))/2.0;
float rand(vec2 co){
// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
#define SubframeMax 0
#define IterationsBetweenRedraws 20
#TexParameter backbuffer GL_TEXTURE_MAG_FILTER GL_NEAREST
#TexParameter backbuffer GL_TEXTURE_WRAP_S GL_REPEAT
#TexParameter backbuffer GL_TEXTURE_WRAP_T GL_REPEAT
void isAlive(float dx, float dy, inout int count) {
vec4 v1 = texture2D( backbuffer, position + pixelSize*vec2( dx, dy ) );
if (v1.x==1.0) count++;
}
vec3 color(vec2 z) {
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));
vec4 v1 = texture2D( backbuffer, mod ( position , 1.0 ) );
int neighbours = 0;
int alive =0;
isAlive(0.0,0.0,alive);
// Count neighbours
isAlive(1.0,0.0, neighbours);
isAlive(1.0,1.0, neighbours);
isAlive(1.0,-1.0, neighbours);
isAlive(0.0,1.0, neighbours);
isAlive(0.0,-1.0, neighbours);
isAlive(-1.0,1.0, neighbours);
isAlive(-1.0,0.0, neighbours);
isAlive(-1.0,-1.0, neighbours);
// Rules
if (alive==1) {
if (neighbours<2) return vec3(v1.x*0.99,v1.y*0.99,v1.z);
else if (neighbours<4) return vec3(1.0);
} else {
if (neighbours==3) return vec3(1.0);
}
return vec3(v1.x*0.95,v1.y*0.98,v1.z*0.999) ;
}
#preset Default
Center = 0,0
Zoom = 6.15279
AntiAliasScale = 1
AntiAlias = 1
#endpreset
|
24 - Pure 3D.frag |
---|
24 - Pure 3D.frag |
#include "3D.frag"
uniform sampler2D texture; file[Ditch-River_2k.hdr]
uniform sampler2D texture2; file[Ditch-River_Env.hdr]
// An example of working with 3D without a distance estimator
// Free HDRI's: http://www.hdrlabs.com/sibl/archive.html
float sphereLine(vec3 pos, vec3 dir, vec3 center, float radius, out vec3 normal) {
vec3 sd=center-pos;
float b = dot(dir,sd);
float temp = b*b+radius*radius-dot(sd,sd);
if (temp>0.0) {
temp = b - sqrt(temp); // intersection distance
normal = normalize((pos+temp*dir)-center);
return temp;
}
normal = vec3(0.0);
return -1.;
}
#define PI 3.14159265358979323846264
vec3 equirectangularMap(vec3 dir, sampler2D sampler) {
dir = normalize(dir);
vec2 longlat = vec2(atan(dir.y,dir.x),acos(dir.z));
return texture2D(sampler,longlat/vec2(2.0*PI,PI) ).xyz;
}
uniform float Specular; slider[0,1,1]
uniform float Diffuse;slider[0,1,1]
vec3 color(vec3 pos, vec3 dir) {
vec3 normal = vec3(1.0,1.0,1.0);
float intersect = 10000.0;
vec3 finalNormal = vec3(0.0);
for (int j = 0; j < 6; j++) {
float z = (float(j)-6.0)/2.0;
float i = sphereLine(pos,normalize(dir),vec3(1.0,0.0+float(j),z),0.5, normal);
if (i<intersect && i>0.) {
intersect =i;
finalNormal = normal;
}
}
if (intersect<10000.) {
vec3 reflected = -2.0*dot(dir,finalNormal)*finalNormal+dir;
vec3 col = Specular*equirectangularMap(reflected, texture);
vec3 col2 = Diffuse*equirectangularMap(finalNormal, texture2);
return col+col2;
}
vec3 col =equirectangularMap(dir,texture);
return col;
}
#preset Default
FOV = 0.4
Eye = 8.42062,8.55686,-1.41974
Target = 0.781867,2.10355,-1.35523
Up = 0.0291443,-0.024509,0.999275
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 2.2222
ToneMapping = 3
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
texture = Ditch-River_2k.hdr
texture2 = Ditch-River_Env.hdr
Specular = 1,0
Diffuse = 1,0,1
#endpreset
|
25 - Image Based Lighting.frag |
---|
25 - Image Based Lighting.frag |
// An example of Image Based Lighting.
//
// NOTICE:
// The Ditch-River Panorama HDR is authored by 'Blotchi' and copyrighted by http://www.hdrlabs.com/sibl/archive.html
// It is licensed under a CC3.0 license: http://creativecommons.org/licenses/by-nc-sa/3.0/us/
#include "IBL-Raytracer.frag"
#include "QuilezLib.frag"
#group TestScene
uniform float TextureScale; slider[0,1,40]
// Just a simple test scene...
float DE(vec3 p)
{
p.xy=p.yx;
float d = length(p+vec3(0.0,0.0,-0.25))-0.25; // sphere
d= min(d, udRoundBox(p+vec3(0.2,1.0,-0.25),vec3(0.2),0.05)); // rounded box
d =min(d, sdCone(p+vec3(1.,1.,-0.5),vec2(0.95,0.45))); // cone
d = min(d, sdTorus88(p+vec3(-1.4,1.,-0.6),vec2(0.5,0.1))); // torus
return min(p.z,d);// distance estimate
}
#preset Default
FOV = 0.58536
Eye = 0.246321,-1.72201,0.434156
Target = -5.5875,6.37903,-0.148662
Up = -0.00420879,0.0687221,0.997349
EquiRectangular = false
FocalPlane = 1
Aperture = 0
Gamma = 2.2685
ToneMapping = 3
Exposure = 0.82653
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -3.65484
DetailAO = -1.14289
FudgeFactor = 1
MaxRaySteps = 198
BoundingSphere = 4.3373
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,1
CamLight = 1,1,1,0
CamLightMin = 0
Glow = 1,1,1,0
GlowMax = 20
Fog = 0
Shadow = 0.70455
Background = Ditch-River_2k.hdr
Specular = Ditch-River_Env.hdr
Diffuse = Ditch-River_Env.hdr
EnvSpecular = 1.8
EnvDiffuse = 0
SpecularMax = 100
Sun = 1.38949,1.02653
SunSize = 0.0045
DebugSun = true
BaseColor = 1,1,1
OrbitStrength = 0
X = 0.5,0.6,0.6,0.2126
Y = 1,0.6,0,0.30708
Z = 0.8,0.78,1,0.35434
R = 0.666667,0.666667,0.498039,0.03174
BackgroundColor = 1,1,1
GradientBackground = 0.4348
CycleColors = false
Cycles = 1.1
EnableFloor = true
FloorNormal = 0,0,0.17074
FloorHeight = 0
FloorColor = 1,1,1
ShowFloor = false
TextureScale = 1
#endpreset
|
26 - 3D fractals without a DE.frag |
---|
26 - 3D fractals without a DE.frag |
#info Mandelbulb without Distance Estimator
#define providesInside
#define providesColor
#include "Brute-Raytracer.frag"
#group Mandelbulb
//#define IterationsBetweenRedraws 5
// Number of fractal iterations.
uniform int Iterations; slider[0,9,100]
// Mandelbulb exponent (8 is standard)
uniform float Power; slider[-10,8,10]
// Bailout radius
uniform float Bailout; slider[0,5,30]
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,180]
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
vec3 color(vec3 p) {
return abs(vec3(p));
}
void powN2(inout vec3 z, float zr0) {
float zo0 = asin( z.z/zr0 );
float zi0 = atan( z.y,z.x );
float zr = pow( zr0, Power-1.0 );
float zo = zo0 * Power;
float zi = zi0 * Power;
zr *= zr0;
z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
}
bool inside(vec3 pos) {
vec3 z=pos;
float r;
int i=0;
r=length(z);
while(r<Bailout && (i<Iterations)) {
powN2(z,r);
z+=(Julia ? JuliaC : pos);
r=length(z);
i++;
}
return (r<Bailout);
}
#preset Default
FOV = 0.62536
Eye = 0.137861,0.380908,-1.90454
Target = -1.05894,-1.3684,6.69989
Up = -0.970103,0.225702,-0.0892076
EquiRectangular = false
Gamma = 2.5
ToneMapping = 3
Exposure = 1.34694
Brightness = 1
Contrast = 0.9901
Saturation = 1
Near = 0.7368
Far = 2.45904
NormalScale = 0.58825
AOScale = 1.0194
Glow = 0.34167
AOStrength = 0.86047
Samples = 100
Stratify = true
DebugInside = false
SampleNeighbors = true
Specular = 0
SpecularExp = 5.455
SpotLight = 1,0.678431,0.494118,0.78431
SpotLightDir = 1,0.78126
CamLight = 1,1,1,0.38462
CamLightMin = 0
Fog = 0
ShowDepth = false
DebugNormals = false
BaseColor = 1,1,1
OrbitStrength = 0
X = 1,1,1,1
Y = 0.345098,0.666667,0,0.02912
Z = 1,0.666667,0,1
R = 0.0784314,1,0.941176,-0.0194
BackgroundColor = 0.607843,0.866667,0.560784
GradientBackground = 0.86955
CycleColors = false
Cycles = 1.1
Iterations = 9
Power = 8
Bailout = 5
RotVector = 1,1,1
RotAngle = 0
Julia = false
JuliaC = 0,0,0
#endpreset
|
30 - Simple Keyframe Animation.frag |
---|
30 - Simple Keyframe Animation.frag
如何创建关键帧动画
|
#info Mandelbulb Anim Fragment
#info http://www.fractalforums.com/index.php?topic=16405.0
#define providesInit
#group Raytracer
// Sets focal plane to Target location
uniform bool AutoFocus; checkbox[false]
#include "DE-Raytracer-v0.9.10.frag"
#include "MathUtils.frag"
#group Mandelbulb
// Number of fractal iterations.
uniform int Iterations; slider[0,9,100]
// Number of color iterations.
uniform int ColorIterations; slider[0,9,100]
// Mandelbulb exponent (8 is standard)
uniform float Power; slider[0,8,16]
// Bailout radius
uniform float Bailout; slider[0,5,30]
// Alternate is slightly different, but looks more like a Mandelbrot for Power=2
uniform bool AlternateVersion; checkbox[false]
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,180]
#group Translation
uniform vec3 TransVector; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
uniform float TransSpeed; slider[0,0,1]
uniform float ImpulseStrength; slider[0,0,10]
uniform float ImpulseRate; slider[0,0,10]
uniform float ImpulseOffset; slider[0,0,10]
uniform vec3 TRotVector; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
uniform float TRotSpeed; slider[0,0,45]
mat3 rot;
uniform float time;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
}
// This is my power function, based on the standard spherical coordinates as defined here:
// http://en.wikipedia.org/wiki/Spherical_coordinate_system
//
// It seems to be similar to the one Quilez uses:
// http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
//
// Notice the north and south poles are different here.
void powN1(inout vec3 z, float r, inout float dr) {
// extract polar coordinates
float theta = acos(z.z/r);
float phi = atan(z.y,z.x);
dr = pow( r, Power-1.0)*Power*dr + 1.0;
// scale and rotate the point
float zr = pow( r,Power);
theta = theta*Power;
phi = phi*Power;
// convert back to cartesian coordinates
z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
}
// This is a power function taken from the implementation by Enforcer:
// http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
//
// I cannot follow its derivation from spherical coordinates,
// but it does give a nice mandelbrot like object for Power=2
void powN2(inout vec3 z, float zr0, inout float dr) {
float zo0 = asin( z.z/zr0 );
float zi0 = atan( z.y,z.x );
float zr = pow( zr0, Power-1.0 );
float zo = zo0 * Power;
float zi = zi0 * Power;
dr = zr*dr*Power + 1.0;
zr *= zr0;
z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
}
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
// Compute the distance from `pos` to the Mandelbox.
float DE(vec3 pos) {
vec3 z=pos;
float r;
float dr=1.0;
int i=0;
if (TRotSpeed>0.0) {
rot=rotationMatrix3(normalize(TRotVector),TRotSpeed*time);
z*=rot;
}
if (TransSpeed>0.0) {
z+=normalize(TransVector)*time*TransSpeed*10.0;
}
if (ImpulseStrength>0.0) {
z+=normalize(TransVector)*(0.8+sin(time*ImpulseRate+ImpulseOffset))*ImpulseStrength;
}
r=length(z);
while(r<Bailout && (i<Iterations)) {
if (AlternateVersion) {
powN2(z,r,dr);
} else {
powN1(z,r,dr);
}
z+=(Julia ? JuliaC : pos);
r=length(z);
z*=rot;
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
i++;
}
// if ((type==1) && r<Bailout) return 0.0;
return 0.5*log(r)*r/dr;
/*
Use this code for some nice intersections (Power=2)
float a = max(0.5*log(r)*r/dr, abs(pos.y));
float b = 1000;
if (pos.y>0) b = 0.5*log(r)*r/dr;
return min(min(a, b),
max(0.5*log(r)*r/dr, abs(pos.z)));
*/
}
float dummy(vec3 p){
p*=time;
return time;
}
#preset Default
FOV = 0.62536
Eye = 1.65826,-1.22975,0.277736
Target = -5.2432,4.25801,-0.607125
Up = 0.401286,0.369883,-0.83588
EquiRectangular = false
FocalPlane = 1
AutoFocus = false
Aperture = 0
Gamma = 2.08335
ToneMapping = 3
Exposure = 0.6522
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -2.84956
DetailAO = -1.35716
FudgeFactor = 1
MaxRaySteps = 164
BoundingSphere = 10
Dither = 0.51754
NormalBackStep = 1
AO = 0,0,0,0.85185
Specular = 1.6456
SpecularExp = 16.364
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.22666,0.5
CamLight = 1,1,1,1.53846
CamLightMin = 0.12121
Glow = 1,1,1,0.43836
GlowMax = 52
Fog = 0
HardShadow = 0.35385
ShadowSoft = 12.5806
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.14286
X = 1,1,1,1
Y = 0.345098,0.666667,0,0.02912
Z = 1,0.666667,0,1
R = 0.0784314,1,0.941176,-0.0194
BackgroundColor = 0.607843,0.866667,0.560784
GradientBackground = 0.3261
CycleColors = false
Cycles = 4.04901
EnableFloor = true
FloorNormal = 0,1,0
FloorHeight = -2
FloorColor = 1,1,1
Iterations = 12
ColorIterations = 8
Power = 8
Bailout = 6.279
AlternateVersion = true
RotVector = 1,1,1
RotAngle = 0
Julia = false
JuliaC = 0,0,0
#endpreset
#preset KeyFrame.001
FOV = 0.62536
Eye = 1.65826,-1.22975,0.277736
Target = -5.2432,4.25801,-0.607125
Up = 0.401286,0.369883,-0.83588
#endpreset
#preset KeyFrame.002
FOV = 0.62536
Eye = 3.96463,0.917888,0.279432
Target = -4.74042,-0.257782,-0.320685
Up = -0.709039,0.700838,-0.0780331
#endpreset
#preset KeyFrame.003
FOV = 0.62536
Eye = 1.33376,0.978975,2.81437
Target = -2.37223,0.395544,-5.15089
Up = 0.0655203,0.994792,0.0780753
#endpreset
#preset KeyFrame.004
FOV = 0.62536
Eye = -0.146262,0.991041,-0.550259
Target = -7.41034,2.09513,-5.36868
Up = 0.0484982,0.797152,0.601827
#endpreset
|
31 - Simple Focal Plane Tracking Target.frag |
---|
31 - Simple Focal Plane Tracking Target.frag
如何启用自动对焦 将此行添加到您的片段代码中,最好放在“相机”组中,如果“自动对焦”小部件尚不存在... uniform bool AutoFocus; checkbox[false] 现在您可以启用/禁用焦平面目标跟踪,焦平面的默认最大距离为 5, 如果您需要超过此距离,请打开包含“FocalPlane”小部件的 .frag 文件,并编辑最大值... uniform float FocalPlane; slider[0,1,5] 到您需要的任何值,比如... uniform float FocalPlane; slider[0,1,50]
|
#info Mandelbulb Anim Fragment
#info http://www.fractalforums.com/index.php?topic=16405.0
#define providesInit
#group Raytracer
// Sets focal plane to Target location
//uniform bool AutoFocus; checkbox[false]
#include "DE-Raytracer-v0.9.10.frag"
#include "MathUtils.frag"
#group Mandelbulb
// Number of fractal iterations.
uniform int Iterations; slider[0,9,100]
// Number of color iterations.
uniform int ColorIterations; slider[0,9,100]
// Mandelbulb exponent (8 is standard)
uniform float Power; slider[0,8,16]
// Bailout radius
uniform float Bailout; slider[0,5,30]
// Alternate is slightly different, but looks more like a Mandelbrot for Power=2
uniform bool AlternateVersion; checkbox[false]
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,180]
#group Translation
uniform vec3 TransVector; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
uniform float TransSpeed; slider[0,0,1]
uniform float ImpulseStrength; slider[0,0,10]
uniform float ImpulseRate; slider[0,0,10]
uniform float ImpulseOffset; slider[0,0,10]
uniform vec3 TRotVector; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
uniform float TRotSpeed; slider[0,0,45]
mat3 rot;
uniform float time;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
}
// This is my power function, based on the standard spherical coordinates as defined here:
// http://en.wikipedia.org/wiki/Spherical_coordinate_system
//
// It seems to be similar to the one Quilez uses:
// http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
//
// Notice the north and south poles are different here.
void powN1(inout vec3 z, float r, inout float dr) {
// extract polar coordinates
float theta = acos(z.z/r);
float phi = atan(z.y,z.x);
dr = pow( r, Power-1.0)*Power*dr + 1.0;
// scale and rotate the point
float zr = pow( r,Power);
theta = theta*Power;
phi = phi*Power;
// convert back to cartesian coordinates
z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
}
// This is a power function taken from the implementation by Enforcer:
// http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
//
// I cannot follow its derivation from spherical coordinates,
// but it does give a nice mandelbrot like object for Power=2
void powN2(inout vec3 z, float zr0, inout float dr) {
float zo0 = asin( z.z/zr0 );
float zi0 = atan( z.y,z.x );
float zr = pow( zr0, Power-1.0 );
float zo = zo0 * Power;
float zi = zi0 * Power;
dr = zr*dr*Power + 1.0;
zr *= zr0;
z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
}
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
// Compute the distance from `pos` to the Mandelbox.
float DE(vec3 pos) {
vec3 z=pos;
float r;
float dr=1.0;
int i=0;
if (TRotSpeed>0.0) {
rot=rotationMatrix3(normalize(TRotVector),TRotSpeed*time);
z*=rot;
}
if (TransSpeed>0.0) {
z+=normalize(TransVector)*time*TransSpeed*10.0;
}
if (ImpulseStrength>0.0) {
z+=normalize(TransVector)*(0.8+sin(time*ImpulseRate+ImpulseOffset))*ImpulseStrength;
}
r=length(z);
while(r<Bailout && (i<Iterations)) {
if (AlternateVersion) {
powN2(z,r,dr);
} else {
powN1(z,r,dr);
}
z+=(Julia ? JuliaC : pos);
r=length(z);
z*=rot;
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
i++;
}
// if ((type==1) && r<Bailout) return 0.0;
return 0.5*log(r)*r/dr;
/*
Use this code for some nice intersections (Power=2)
float a = max(0.5*log(r)*r/dr, abs(pos.y));
float b = 1000;
if (pos.y>0) b = 0.5*log(r)*r/dr;
return min(min(a, b),
max(0.5*log(r)*r/dr, abs(pos.z)));
*/
}
float dummy(vec3 p){
p*=time;
return time;
}
#preset Default
FOV = 0.62536
Eye = 1.65826,-1.22975,0.277736
Target = -5.2432,4.25801,-0.607125
Up = 0,1,0
EquiRectangular = false
AutoFocus = true
FocalPlane = 1
Aperture = 0.05
Gamma = 2.08335
ToneMapping = 3
Exposure = 0.6522
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -2.84956
DetailAO = -1.35716
FudgeFactor = 1
MaxRaySteps = 164
BoundingSphere = 10
Dither = 0.51754
NormalBackStep = 1
AO = 0,0,0,0.85185
Specular = 1.6456
SpecularExp = 16.364
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = -0.22666,0.5
CamLight = 1,1,1,1.53846
CamLightMin = 0.12121
Glow = 1,1,1,0.43836
GlowMax = 52
Fog = 0
HardShadow = 0.35385
ShadowSoft = 12.5806
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 0.14286
X = 1,1,1,1
Y = 0.345098,0.666667,0,0.02912
Z = 1,0.666667,0,1
R = 0.0784314,1,0.941176,-0.0194
BackgroundColor = 0.607843,0.866667,0.560784
GradientBackground = 0.3261
CycleColors = false
Cycles = 4.04901
EnableFloor = true
FloorNormal = 0,1,0
FloorHeight = -2
FloorColor = 1,1,1
Iterations = 12
ColorIterations = 8
Power = 8
Bailout = 6.279
AlternateVersion = true
RotVector = 1,1,1
RotAngle = 0
TransVector = 1,0,0
TransSpeed = 0
ImpulseStrength = 0
ImpulseRate = 0
ImpulseOffset = 0
TRotVector = 1,0,0
TRotSpeed = 0
Julia = false
JuliaC = 0,0,0
#endpreset
#preset KeyFrame.001
FOV = 0.62536
Eye = 2,0,0
Target = 1,0,0
Up = 0,1,0
#endpreset
#preset KeyFrame.002
FOV = 0.62536
Eye = 0.73087,0.0286388,1.42303
Target = 0.31975,-0.0253,0.62258
Up = 0,1,0
#endpreset
#preset KeyFrame.003
FOV = 0.62536
Eye = 0.034575,-0.00331298,1.59962
Target = 0.0,0.0,0.0
Up = -0.368,1,0
#endpreset
#preset KeyFrame.004
FOV = 0.62536
Eye = 0.034575,-0.00331298,1.59962
Target = 0.05491,-0.00217,0.99997
Up = 0.17544,1,0
#endpreset
#preset KeyFrame.005
FOV = 0.62536
Eye = 0.0244074,-0.00388447,1.89945
Target = 0.05491,-0.00217,0.99997
Up = 0,1,0
#endpreset
#preset KeyFrame.006
FOV = 0.62536
Eye = 0.0108507,-0.00464646,2.29922
Target = 0.05491,-0.00217,0.99997
Up = 0,1,0
#endpreset
#preset KeyFrame.007
FOV = 0.62536
Eye = 0.0108507,-0.00464646,2.29922
Target = 0.02745,-0.0018,0.454545
Up = 0,1,0
#endpreset
#preset KeyFrame.008
FOV = 0.62536
Eye = 0.0108507,-0.00464646,2.29922
Target = 0,0,0
Up = 0,1,0
#endpreset
#preset KeyFrame.009
FOV = 0.62536
Eye = 0.0108507,-0.00464646,2.29922
Target = 0.05491,-0.00217,0.99997
Up = 0,1,0
#endpreset
#preset KeyFrame.010
FOV = 0.62536
Eye = 0.0108507,-0.00464646,2.29922
Target = 0.05491,-0.00217,0.99997
Up = 0,1,0
#endpreset
|
32 - Simple Multi-Parameter Easing Animation.frag |
---|
32 - Simple Multi-Parameter Easing Animation.frag
如何创建参数变形动画 这些设置可以通过在预设名称中使用“范围”来保存,例如“#preset Range-100-200”,帧号对缓动曲线值没有影响,并且会被忽略,它们是为了让人类能够想起此范围涵盖的内容,允许使用唯一的名称,例如“Range-fogIn” “Range-fogOut” 等,这些范围也可以通过 fqScript 应用,例如: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]
开始帧之前的帧将使用开始值,直到到达开始帧。 结束帧之后的帧将使用结束值,直到动画结束。 这些在动画播放时生效。 当您对已经具有曲线的变量执行此操作时,系统会提示您“应用”、“放弃”、“取消”。 “应用”将为此变量更改这些设置(喜欢它,保留它) “放弃”将删除此变量的设置(清理,没有动画) “取消”什么也不做 这只会将更改保存到内部!如果您喜欢结果,那么...
此文件夹将包含您所有 var 变形设置,在一个默认预设和 campath 关键帧中 参数变形设置应该都在一个命名(不是关键帧)预设中。 |
#info Mandelbulb Anim Fragment
#info http://www.fractalforums.com/index.php?topic=16405.0
#define providesInit
#group Raytracer
// Sets focal plane to Target location
//uniform bool AutoFocus; checkbox[false]
#include "DE-Raytracer.frag"
#include "MathUtils.frag"
#group Mandelbulb
// Number of fractal iterations.
uniform int Iterations; slider[0,9,100]
// Number of color iterations.
uniform int ColorIterations; slider[0,9,100]
// Mandelbulb exponent (8 is standard)
uniform float Power; slider[0,8,16]
// Bailout radius
uniform float Bailout; slider[0,5,30]
// Alternate is slightly different, but looks more like a Mandelbrot for Power=2
uniform bool AlternateVersion; checkbox[false]
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,360]
mat3 rot;
uniform float time;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
}
// This is my power function, based on the standard spherical coordinates as defined here:
// http://en.wikipedia.org/wiki/Spherical_coordinate_system
//
// It seems to be similar to the one Quilez uses:
// http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
//
// Notice the north and south poles are different here.
void powN1(inout vec3 z, float r, inout float dr) {
// extract polar coordinates
float theta = acos(z.z/r);
float phi = atan(z.y,z.x);
dr = pow( r, Power-1.0)*Power*dr + 1.0;
// scale and rotate the point
float zr = pow( r,Power);
theta = theta*Power;
phi = phi*Power;
// convert back to cartesian coordinates
z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
}
// This is a power function taken from the implementation by Enforcer:
// http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
//
// I cannot follow its derivation from spherical coordinates,
// but it does give a nice mandelbrot like object for Power=2
void powN2(inout vec3 z, float zr0, inout float dr) {
float zo0 = asin( z.z/zr0 );
float zi0 = atan( z.y,z.x );
float zr = pow( zr0, Power-1.0 );
float zo = zo0 * Power;
float zi = zi0 * Power;
dr = zr*dr*Power + 1.0;
zr *= zr0;
z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
}
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
// Compute the distance from `pos` to the Mandelbox.
float DE(vec3 pos) {
vec3 z=pos;
float r;
float dr=1.0;
int i=0;
r=length(z);
while(r<Bailout && (i<Iterations)) {
if (AlternateVersion) {
powN2(z,r,dr);
} else {
powN1(z,r,dr);
}
z+=(Julia ? JuliaC : pos);
r=length(z);
z*=rot;
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
i++;
}
// if ((type==1) && r<Bailout) return 0.0;
return 0.5*log(r)*r/dr;
/*
Use this code for some nice intersections (Power=2)
float a = max(0.5*log(r)*r/dr, abs(pos.y));
float b = 1000;
if (pos.y>0) b = 0.5*log(r)*r/dr;
return min(min(a, b),
max(0.5*log(r)*r/dr, abs(pos.z)));
*/
}
float dummy(vec3 p){
p*=time;
return time;
}
#preset Default
FOV = 0.62536
Eye = 2.42106,0.501576,0.263686
Target = -6.2468,-0.836125,-0.622262
Up = 0,1,0
EquiRectangular = false
AutoFocus = false
FocalPlane = 1
Aperture = 0
Gamma = 2.08335
ToneMapping = 3
Exposure = 0.6522
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Detail = -2.84956
DetailAO = -1.35716
FudgeFactor = 1
MaxRaySteps = 164
BoundingSphere = 10
Dither = 0.51754
NormalBackStep = 1
AO = 0,0,0,0.85185
Specular = 1.6456
SpecularExp = 16.364
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = 0.22666,0.5
CamLight = 1,1,1,1.53846
CamLightMin = 0.12121
Glow = 1,1,1,0.43836
GlowMax = 52
Fog = 0
HardShadow = 0.35385
ShadowSoft = 12.5806
Reflection = 0
BaseColor = 1,1,1
OrbitStrength = 1
X = 1,1,1,1
Y = 0.345098,0.666667,0,0.02912
Z = 1,0.666667,0,1
R = 0.0784314,1,0.941176,-0.0194
BackgroundColor = 0.607843,0.866667,0.560784
GradientBackground = 0.3261
CycleColors = true
Cycles1:CosineCurve:44:1:24:1:240:0.3:1:1.7:1:0
Cycles = 12.4928
EnableFloor = true
FloorNormal = 0,1,0
FloorHeight = -2
FloorColor = 1,1,1
Iterations = 12
ColorIterations = 8
Power1:SineCurve:43:1:6:20:220:0.3:1:1.7:1:0
Power = 1
Bailout = 6.279
AlternateVersion = true
RotVector = 1,1,1
RotAngle1:OutInBack:36:0:360:40:200:0.3:1:1.7:1:0
RotAngle = 0.0
Julia = false
JuliaC = 0,0,0
#endpreset
#preset KeyFrame.001
FOV = 0.62536
Eye = 2.42106,0.501576,0.263686
Target = -6.2468,-0.836125,-0.622262
Up = 0,1,0
#endpreset
#preset KeyFrame.002
FOV = 0.62536
Eye = 2.42106,0.501576,0.263686
Target = -6.2468,-0.836125,-0.622262
Up = 0,1,0
#endpreset
|
33 - Simple Skybox.frag |
---|
33 - Simple Skybox.frag |
#info Mandelbulb Distance Estimator
#define providesInit
#define providesBackground
#define providesColor
#include "MathUtils.frag"
#include "DE-Raytracer.frag"
#group Skybox
uniform samplerCube skybox; file[cubemap.png]
vec3 backgroundColor(vec3 dir) {
float t = length(from-dir);
dir *= -1.;
return mix(textureCube(skybox, dir.xzy).rgb, BackgroundColor, 1.0-exp(-pow(Fog,4.0)*t*t));
}
uniform float RefractiveIndex; slider[0,1,10]
vec3 baseColor(vec3 point, vec3 N){
float ratio = 1.00 / RefractiveIndex;
vec3 I = (point - from);
vec3 R = refract(I, -N, ratio);
return textureCube(skybox, R.xzy).rgb;
}
#group Mandelbulb
// Number of fractal iterations.
uniform int Iterations; slider[0,9,100]
// Number of color iterations.
uniform int ColorIterations; slider[0,9,100]
// Mandelbulb exponent (8 is standard)
uniform float Power; slider[0,8,16]
// Bailout radius
uniform float Bailout; slider[0,5,30]
// mermelada's tweak Derivative bias
uniform float DerivativeBias; slider[0,1,10]
// Alternate is slightly different, but looks more like a Mandelbrot for Power=2
uniform bool AlternateVersion; checkbox[false]
uniform vec3 RotVector; slider[(0,0,0),(1,1,1),(1,1,1)]
uniform float RotAngle; slider[0.00,0,180]
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
uniform float time;
mat3 rot;
void init() {
rot = rotationMatrix3(normalize(RotVector), RotAngle);
}
// This is my power function, based on the standard spherical coordinates as defined here:
// http://en.wikipedia.org/wiki/Spherical_coordinate_system
//
// It seems to be similar to the one Quilez uses:
// http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
//
// Notice the north and south poles are different here.
void powN1(inout vec3 z, float r, inout float dr) {
// extract polar coordinates
float theta = acos(z.z/r);
float phi = atan(z.y,z.x);
// mermelada's tweak
// http://www.fractalforums.com/new-theories-and-research/error-estimation-of-distance-estimators/msg102670/?topicseen#msg102670
dr = max(dr*DerivativeBias,pow( r, Power-1.0)*Power*dr + 1.0);
// scale and rotate the point
float zr = pow( r,Power);
theta = theta*Power;
phi = phi*Power;
// convert back to cartesian coordinates
z = zr*vec3(sin(theta)*cos(phi), sin(phi)*sin(theta), cos(theta));
}
// This is a power function taken from the implementation by Enforcer:
// http://www.fractalforums.com/mandelbulb-implementation/realtime-renderingoptimisations/
//
// I cannot follow its derivation from spherical coordinates,
// but it does give a nice mandelbrot like object for Power=2
void powN2(inout vec3 z, float zr0, inout float dr) {
float zo0 = asin( z.z/zr0 );
float zi0 = atan( z.y,z.x );
float zr = pow( zr0, Power-1.0 );
float zo = zo0 * Power;
float zi = zi0 * Power;
// mermelada's tweak
// http://www.fractalforums.com/new-theories-and-research/error-estimation-of-distance-estimators/msg102670/?topicseen#msg102670
dr = max(dr*DerivativeBias,zr*dr*Power + 1.0);
zr *= zr0;
z = zr*vec3( cos(zo)*cos(zi), cos(zo)*sin(zi), sin(zo) );
}
// Compute the distance from `pos` to the Mandelbox.
float DE(vec3 pos) {
vec3 z=pos;
float r;
float dr=1.0;
int i=0;
r=length(z);
while(r<Bailout && (i<Iterations)) {
if (AlternateVersion) {
powN2(z,r,dr);
} else {
powN1(z,r,dr);
}
z+=(Julia ? JuliaC : pos);
r=length(z);
z*=rot;
if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(z.x,z.y,z.z,r*r)));
i++;
}
// if ((type==1) && r<Bailout) return 0.0;
return 0.5*log(r)*r/dr;
/*
Use this code for some nice intersections (Power=2)
float a = max(0.5*log(r)*r/dr, abs(pos.y));
float b = 1000;
if (pos.y>0) b = 0.5*log(r)*r/dr;
return min(min(a, b),
max(0.5*log(r)*r/dr, abs(pos.z)));
*/
}
#preset Default
FOV = 0.62536
Eye = 1.578295,-2.374888,-0.1754925
Target = -2.237496,5.621949,-0.038792
Up = 0.0250519,0.0290368,-0.9993381
EquiRectangular = false
AutoFocus = false
FocalPlane = 1
Aperture = 0
Gamma = 2.08335
ToneMapping = 3
Exposure = 0.6522
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -2.84956
DetailAO = -1.35716
FudgeFactor = 1
MaxDistance = 1000
MaxRaySteps = 164
Dither = 0.51754
NormalBackStep = 1
AO = 0,0,0,0.85185
Specular = 0.336
SpecularExp = 16.364
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = 0.7,-0.42
CamLight = 1,1,1,1.53846
CamLightMin = 0.12121
Glow = 1,1,1,0.43836
GlowMax = 52
Fog = 0
HardShadow = 0.35385
ShadowSoft = 12.5806
QualityShadows = false
Reflection = 0
DebugSun = false
BaseColor = 1,1,1
OrbitStrength = 0
X = 1,1,1,1
Y = 0.345098,0.666667,0,0.02912
Z = 1,0.666667,0,1
R = 0.0784314,1,0.941176,-0.0194
BackgroundColor = 0.607843,0.866667,0.560784
GradientBackground = 0.9701493
CycleColors = false
Cycles = 4.04901
EnableFloor = false
FloorNormal = 0,0,-1
FloorHeight = -3.095238
FloorColor = 1,1,1
Iterations = 12
ColorIterations = 8
Power = 8
Bailout = 6.279
AlternateVersion = true
RotVector = 1,1,1
RotAngle = 0
Julia = false
JuliaC = 0,0,0
skybox = cubemap.png
RefractiveIndex = 5.604396
DerivativeBias = 1
#endpreset
#preset Octobulb
FOV = 0.62536
Eye = -0.184126,0.843469,1.32991
Target = 1.48674,-5.55709,-4.56665
Up = 0,1,0
AntiAlias = 1
Detail = -2.47786
DetailAO = -0.21074
FudgeFactor = 1
MaxRaySteps = 164
BoundingSphere = 2
Dither = 0.5
AO = 0,0,0,0.7
Specular = 1
SpecularExp = 27.082
SpotLight = 1,1,1,0.94565
SpotLightDir = 0.5619,0.18096
CamLight = 1,1,1,0.23656
CamLightMin = 0.15151
Glow = 0.415686,1,0.101961,0.18421
Fog = 0.60402
HardShadow = 0.7230800
Reflection = 0.0
BaseColor = 1,1,1
OrbitStrength = 0.62376
X = 0.411765,0.6,0.560784,-0.37008
Y = 0.666667,0.666667,0.498039,0.86886
Z = 0.666667,0.333333,1,-0.25984
R = 0.4,0.7,1,0.36508
BackgroundColor = 0.666667,0.666667,0.498039
GradientBackground = 0.5
CycleColors = true
Cycles = 7.03524
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 14
ColorIterations = 6
Power = 8.18304
Bailout = 6.279
AlternateVersion = true
RotVector = 1,0,0
RotAngle = 77.8374
#endpreset
#preset Refraction
FOV = 0.807947
Eye = 1.49337,-0.0604384,-1.459009
Target = -4.526366,-0.2098799,5.042469
Up = -0.02031,0.9980528,0.0041359
EquiRectangular = false
AutoFocus = false
FocalPlane = 1
Aperture = 0
Gamma = 2
ToneMapping = 5
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -3.601449
DetailAO = -1.35716
FudgeFactor = 1
MaxDistance = 1000
MaxRaySteps = 1185
Dither = 0.51754
NormalBackStep = 1
AO = 0,0,0,0
Specular = 0
SpecularExp = 0
SpecularMax = 0
SpotLight = 1,1,1,1
SpotLightDir = 0.63626,0.5
CamLight = 1,1,1,1.53846
CamLightMin = 0.12121
Glow = 1,1,1,1
GlowMax = 1000
Fog = 0
HardShadow = 0.35385
ShadowSoft = 12.5806
QualityShadows = false
Reflection = 0
DebugSun = false
BaseColor = 1,1,1
OrbitStrength = 1
X = 1,1,1,1
Y = 0.345098,0.666667,0,0.02912
Z = 1,0.666667,0,1
R = 0.0784314,1,0.941176,-0.0194
BackgroundColor = 0.607843,0.866667,0.560784
GradientBackground = 0.3261
CycleColors = false
Cycles = 4.04901
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 0
ColorIterations = 10
Power = 8
Bailout = 6.279
DerivativeBias = 1
AlternateVersion = false
RotVector = 1,1,1
RotAngle = 0
Julia = false
JuliaC = 1,1,1
skybox = cubemap.png
RefractiveIndex = 1.52
#endpreset
#preset Reflection
FOV = 1
Eye = 2.193986,2.218407,0.2322807
Target = -5.850334,-1.498805,0.2174372
Up = -0.0086972,0.021624,-0.7018754
EquiRectangular = false
AutoFocus = false
FocalPlane = 1
Aperture = 0
Gamma = 2
ToneMapping = 5
Exposure = 0.6522
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
DepthToAlpha = false
ShowDepth = false
DepthMagnitude = 1
Detail = -1.318841
DetailAO = -1.35716
FudgeFactor = 1
MaxDistance = 1000
MaxRaySteps = 164
Dither = 0.51754
NormalBackStep = 1
AO = 0,0,0,0.85185
Specular = 1
SpecularExp = 16.364
SpecularMax = 10
SpotLight = 1,1,1,1
SpotLightDir = 0.7,-0.42
CamLight = 1,1,1,1.53846
CamLightMin = 0.12121
Glow = 1,1,1,0.43836
GlowMax = 52
Fog = 0
HardShadow = 0.35385
ShadowSoft = 12.5806
QualityShadows = false
Reflection = 1
DebugSun = false
BaseColor = 1,1,1
OrbitStrength = 0.14286
X = 1,1,1,1
Y = 0.345098,0.666667,0,0.02912
Z = 1,0.666667,0,1
R = 0.0784314,1,0.941176,-0.0194
BackgroundColor = 0.607843,0.866667,0.560784
GradientBackground = 0.3261
CycleColors = false
Cycles = 4.04901
EnableFloor = false
FloorNormal = 0,0,0
FloorHeight = 0
FloorColor = 1,1,1
Iterations = 0
ColorIterations = 8
Power = 8
Bailout = 6.279
AlternateVersion = true
RotVector = 1,1,1
RotAngle = 0
Julia = true
JuliaC = 0,0,0
skybox = cubemap.png
RefractiveIndex = 1.52
DerivativeBias = 0
#endpreset
|
Fragmentarium 的灵感和公式很大程度上来自 FractalForums.com 的社区,包括 Tom Beddard、Jan Kadlec、Iñigo Quilez、Buddhi、Jesse 以及其他成员。特别感谢 Knighty 和 Kali 为我们提供了很棒的片段。所有片段都应包含有关其起源的信息 - 如果我做错了归属,请通知我。
使用的图标是 Everaldo: Crystal 项目的一部分。
Fragmentarium 是使用跨平台 GUI 框架 Qt 构建的。
Fractal Forums 用户的翻译
- 俄语 SCORPION
- 俄语 Crist-JRoger
- 德语 Sabine
- 荷兰语 Sabine
贡献者,这意味着过去 7 年来 FractalForums.com 上几乎所有的人?此列表并不完整。
- 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.
- 官方页面
- Fractalforums
- flicker 小组 [21]
- deviantart
- commons : Category:Fragmentarium
- git 分支
- ↑ 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 使用说明
- ↑ Fragmentarium 博客
- ↑ Fragmentarium 主页
- ↑ github 页面
- ↑ Fragmentarium 博客
- ↑ Fragmentarium 官方常见问题解答
- ↑ 3Dickulus: FragM wiki 在 github 上
- ↑ 分形论坛页面
- ↑ 编程页面
- ↑ FF 画廊
- ↑ flicker 群组
- ↑ deviantart 搜索
- ↑ Fragmentarium deviantart 群组