mightymandel v16

GPU-based Mandelbrot set explorer

fp32_escaped_frag.glsl
Go to the documentation of this file.
1 // mightymandel -- GPU-based Mandelbrot Set explorer
2 // Copyright (C) 2012,2013,2014,2015 Claude Heiland-Allen
3 // License GPL3+ http://www.gnu.org/licenses/gpl.html
4 
5 uniform float loger2;
6 uniform float pxs;
7 flat in vec4 cne;
8 #ifdef DE
9 flat in vec4 zdz;
10 #else
11 flat in vec2 zdz;
12 #endif
13 out layout(location = 0, index = 0) vec4 ida;
14 void main() {
15  float z2 = cmag2(zdz.xy);
16  float logz2 = log(z2);
17  float i = 1.0 + cne.z - clamp(log2(logz2 / loger2), 0.00001, 0.99999);
18 #ifdef DE
19  float dz2 = cmag2(zdz.zw);
20  float d = logz2 * sqrt(z2 / dz2) * pxs;
21 #else
22  float d = 0;
23 #endif
24  ida = vec4(i, 0.0, d, 0.0);
25 }