knighty
Fractal Iambus
Posts: 819
|
|
« Reply #15 on: June 25, 2016, 02:24:55 AM » |
|
Well... no. The base shape (which is indeed a prism with an equilateral triangular base) have nothing to do with pre-transform. It is just a convex hull of the fractal. IMHO, you don't need to implement the base shape as an iteration. You are right, there is a lot of room for optimization. for example: float t = 2. * max(0., dot(p.xy, vec2(-sqrt(3.) * 0.5, 0.5)) ); p.xy -= t*vec2(-sqrt(3.),1.)*0.5; can be replaced by: float t = max(0., dot(p.xy, vec2(-sqrt(3.)*0.5 , 0.5)) ); p.xy -= t*vec2(-sqrt(3.),1.); It seems you forgot a 2 factor in : double dot = z.x * -sqr305 + z.y * 0.5; it should be: double dot = z.x * -sqr3 + z.y;
|
|
|
Logged
|
|
|
|
mclarekin
|
|
« Reply #16 on: June 25, 2016, 06:39:00 AM » |
|
Probably in Mandelbulber V2.09 we will have it set up to make it easier to do maths outside the iteration loop. But currently I have to use a single iteration at the beginning inside the loop. (.ie . if( i < 1). ( but is currently set up for testing, so I temporary itr start and itr stop parameters). "It is just a convex hull of the fractal", that is a good definition. This is my optimisation path, and I still seem to end up with the same line double dot = z.x * -sqr305 + z.y * 0.5;h.mmm??? I can not see a mistake (but that is a common thing for me, ie. 10minutes to code it "perfectly" , then several hours to find and fix the imperfections ) original float t = 2. * max(0., dot(p.xy, vec2(-sqrt(3.) * 0.5, 0.5)) ); p.xy -= t*vec2(-sqrt(3.),1.)* 0.5;optimised float t = max(0., dot(p.xy, vec2(-sqrt(3.) * 0.5, 0.5)) ); p.xy -= t*vec2(-sqrt(3.),1.); // same as Knighty's example where dot part = ( p.x * -sqrt(3.) * 0.5) + (p.y * 0.5) code to c++ dot1 = (z.x * -sqr305) + (z.y * 0.5); // sqr305 = constant sqr3 * 0.5 t = max( 0.0 , dot1); z.x -= t * -sqr3; z.y -= t; // or z.y = z.y - t //............................................. //Next line is //z.y = fabs(z.y) // // optimise with previous line // becomes z.y = fabs(z.y - t). //......................................................... c++ dot1 = (z.x * -sqr305) + (z.y * 0.5); // sqr305 = sqr3 * 0.5 t = max( 0.0 , dot1); z.x -= t * -sqr3; z.y = fabs(z.y – t); and these lines are also used in CrossMengerTrick and CrossMengerKIFS which I am finally starting to look at
|
|
|
Logged
|
|
|
|
mclarekin
|
|
« Reply #17 on: June 26, 2016, 02:56:03 AM » |
|
I have a better understanding of how this .frag works now, , (I was lacking some real basic programming knowledge.) So I feel embarrassed for a minute, then move on, LOL. This is the first time I have seen and understood how a base shape can be used , A whole new area of formulas that I have yet to explore. Will there ever be an end to this infinity of possibilities??
|
|
|
Logged
|
|
|
|
knighty
Fractal Iambus
Posts: 819
|
|
« Reply #18 on: June 26, 2016, 02:58:15 AM » |
|
No! (the N in No stans for No) BTW, you can get the KIFS version without coding in mandelbulber. # Mandelbulber settings file # version 2.07 # only modified parameters [main_parameters] aux_light_enabled_1 true; aux_light_intensity_1 1,41254; aux_light_position_1 5 -3 3; camera 3,365672583055189 -3,804478575040412 2,714269048418577; camera_distance_to_target 2,604907989501952; camera_rotation 25,86963147804066 -31,02749091811327 -1,416340756589222e-13; camera_top -0,2249033775581471 0,4637956897721983 0,8569200831534224; formula_1 10; keyframe_last_to_render 0; main_light_intensity 1,07; target 2,391708951148566 -1,795971013359245 1,371571073383262; [fractal_1] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0 -0,707 0,707; IFS_direction_3 0 1 0; IFS_distance_3 0,5; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_enabled_3 true; IFS_offset 0,866 1,5 1,5; IFS_scale 3; [fractal_2] [fractal_3] [fractal_4] [fractal_5] [fractal_6] [fractal_7] [fractal_8] [fractal_9]
|
|
|
Logged
|
|
|
|
mclarekin
|
|
« Reply #19 on: June 26, 2016, 03:16:05 AM » |
|
Thanks I will try that.
This formula/concept is so cool. Just testing the base shape for the few days has been a lot of fun, it works so well with many linear type formulas creating all sorts of new shapes for me.
|
|
|
Logged
|
|
|
|
mclarekin
|
|
« Reply #20 on: July 02, 2016, 02:53:22 AM » |
|
Latest c++ version of the prism shape transform. I have made one UI where the set up has transforms :- PrismShape, Benesi T1, Benesi T1 Mod, Menger Sponge (all have start/stop iterations controls.) The prism shape has now got four internal parameters, when mixed with the other transform internal parameters, the possibilities appear to approximate infinity . /** * Menger Prism Shape * from code by Knighty http://www.fractalforums.com/fragmentarium/cross-menger!-can-anyone-do-this/msg93972/#new */ void MengerPrismShapeIteration(CVector3 &z, int i, const cFractal *fractal) { CVector3 gap = fractal->transformCommon.constantMultiplier000; // default 0,0,0 double t; double temp; double sqr3 = SQRT_3; double sqr305 = 0.86602540378443864676372317075294; double dot1;
if ( i >= fractal->transformCommon.startIterationsA // default 0.0 && i < fractal->transformCommon.stopIterations1)// default 1.0 { z.y = fabs(z.y); z.z = fabs(z.z); dot1 = (z.x * -sqr305 + z.y * 0.5) * fractal->transformCommon.scale; // default 1 t = max(0.0, dot1); z.x -= t * -sqr3; z.y = fabs(z.y - t);
if(z.y > z.z) { temp =z.y; z.y = z.z; z.z = temp; } z -= gap * CVector3( sqr305, 1.5, 1.5); // z was pos, now some points neg (ie neg shift) if(z.z > z.x) { temp =z.z; z.z = z.x; z.x = temp; } if(z.x < 0.0 ) { z.x = z.x; } else { z.y = max(0.0, z.y); z.z = max(0.0, z.z); } } }
|
|
|
Logged
|
|
|
|
Buddhi
|
|
« Reply #21 on: July 04, 2016, 09:01:06 PM » |
|
No! (the N in No stans for No) BTW, you can get the KIFS version without coding in mandelbulber. # Mandelbulber settings file # version 2.07 # only modified parameters [main_parameters] aux_light_enabled_1 true; aux_light_intensity_1 1,41254; aux_light_position_1 5 -3 3; camera 3,365672583055189 -3,804478575040412 2,714269048418577; camera_distance_to_target 2,604907989501952; camera_rotation 25,86963147804066 -31,02749091811327 -1,416340756589222e-13; camera_top -0,2249033775581471 0,4637956897721983 0,8569200831534224; formula_1 10; keyframe_last_to_render 0; main_light_intensity 1,07; target 2,391708951148566 -1,795971013359245 1,371571073383262; [fractal_1] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0 -0,707 0,707; IFS_direction_3 0 1 0; IFS_distance_3 0,5; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_enabled_3 true; IFS_offset 0,866 1,5 1,5; IFS_scale 3; [fractal_2] [fractal_3] [fractal_4] [fractal_5] [fractal_6] [fractal_7] [fractal_8] [fractal_9]
You are GENIUS! I have never mastered how to define all vectors intentionally. It is always mostly experimenting. I can write the software, but don't know how to use it
|
|
|
Logged
|
|
|
|
Buddhi
|
|
« Reply #22 on: July 04, 2016, 10:05:44 PM » |
|
By the way, it's very nice starting point to get interesting shapes: # Mandelbulber settings file # version 2.08 # only modified parameters [main_parameters] aux_light_enabled_1 true; aux_light_intensity_1 1,41254; aux_light_position_1 5 -3 3; basic_fog_color f100 f100 e500; basic_fog_enabled true; basic_fog_visibility 3,46737; brightness 1,67; camera -1,805545920848823 0,7293700491624603 -2,397988757052514; camera_distance_to_target 0,006226014714202337; camera_rotation -150,0427711170006 35,45873861972266 91,66986964501579; camera_top -0,8575889311327257 -0,5137877264398242 -0,0237359928889756; DE_thresh 7,4131e-07; DOF_enabled true; DOF_focus 0,002681433456018567; DOF_radius 4,43; flight_last_to_render 0; fog_color_1 ff00 e200 0000; fog_color_2 7e00 6700 2400; fog_color_3 af00 a200 8a00; formula_1 10; gamma 0,74; image_height 2160; image_width 3840; keyframe_last_to_render 0; main_light_alpha -73,3; main_light_beta 22,83; main_light_intensity 1,07; mat1_coloring_random_seed 133572; mat1_coloring_saturation 0,14; mat1_surface_color_palette 786b7b 3d3e2b 4d353a 62556e 4a333e f3e6f5 182110 877c97 424c48 ddcdc8; raytraced_reflections true; shadows_cone_angle 0,1; target -1,803013551299897 0,7249762850259339 -2,394376943048206; view_distance_max 27,84953095615215; volumetric_fog_colour_1_distance 0,0001761009087797636; volumetric_fog_colour_2_distance 0,0003522018175595273; volumetric_fog_distance_factor 0,0003522018175595273; volumetric_fog_enabled true; [fractal_1] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0 -0,707 0,707; IFS_direction_3 0 1 0; IFS_distance_3 0,5; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_enabled_3 true; IFS_offset 0,866 1,5 1,5; IFS_rotation -32,9 0 90; IFS_rotation_enabled true; IFS_scale 3; [fractal_2] [fractal_3] [fractal_4] [fractal_5] [fractal_6] [fractal_7] [fractal_8] [fractal_9]
|
|
|
|
mclarekin
|
|
« Reply #23 on: July 05, 2016, 06:11:16 AM » |
|
@ buddhi, I was impressed too!!!
The prism shape is a lot of fun and has introduced another fast shape into the mix. I am thinking we could add this (and probably others to the presets on the kifs UI.)
|
|
|
Logged
|
|
|
|
Crist-JRoger
|
|
« Reply #24 on: July 05, 2016, 06:32:19 PM » |
|
The prism shape is a lot of fun and has introduced another fast shape into the mix. I am thinking we could add this (and probably others to the presets on the kifs UI.)
Can you show on GLSL how you doing this?
|
|
|
Logged
|
|
|
|
mclarekin
|
|
« Reply #25 on: July 05, 2016, 08:43:08 PM » |
|
Here is an attempt It is essentially the first part of Knighty's code with the differences in yellow and used generally as a pre transform. The simplest example is place it before a menger sponge and test out the gap and dotscale parameters. For the above image I placed it before the existing KIFS version that Knighty showed was already possible in Mandelbulber. Code: #info CrossMenger #include "DE-Raytracer.frag" #group CrossMenger // Number of fractal iterations. uniform int Iterations; slider[0,3,100] uniform vec3 Gap; slider[-1.,0.,1.] uniform float dotscale; slider[0.,1.,5.]uniform float Dot KIFS; checkbox[false] float baseshape(vec3 p, float gap) { p.yz=abs(p.yz); float t = 2.* max(0., dotscale * dot(p.xy, vec2(-sqrt(3.) * 0.5, 0.5)) ); p.xy -= t*vec2(-sqrt(3.),1.)*0.5; p.y=abs(p.y); if(p.y>p.z) p.yz=p.zy; p-= gap *vec3(0.5*sqrt(3.),1.5,1.5); if(p.z>p.x){p.xz=p.zx;} if(p.x<0.) return p.x; p.yz=max(vec2(0.),p.yz); return (p );} oops yellow hard to read Code: #info CrossMenger #include "DE-Raytracer.frag" #group CrossMenger // Number of fractal iterations. uniform int Iterations; slider[0,3,100] uniform vec3 Gap; slider[-1.,0.,1.] uniform float dotscale; slider[0.,1.,5.] uniform float Dot KIFS; checkbox[false]
float baseshape(vec3 p, float gap)
{ p.yz=abs(p.yz);
float t = 2.* max(0., dotscale * dot(p.xy, vec2(-sqrt(3.) * 0.5, 0.5)) );
p.xy -= t*vec2(-sqrt(3.),1.)*0.5;
p.y=abs(p.y);
if(p.y>p.z) p.yz=p.zy;
p-=gap *vec3(0.5*sqrt(3.),1.5,1.5);
if(p.z>p.x){p.xz=p.zx;}
if(p.x<0.) return p.x;
p.yz=max(vec2(0.),p.yz);
return (p ); }
|
|
« Last Edit: July 05, 2016, 09:01:19 PM by mclarekin, Reason: non-yellow version »
|
Logged
|
|
|
|
Max Sinister
|
|
« Reply #26 on: July 05, 2016, 11:15:36 PM » |
|
Very nice. I may have to get this software one day.
|
|
|
Logged
|
|
|
|
mclarekin
|
|
« Reply #27 on: July 06, 2016, 06:05:39 AM » |
|
Can you show on GLSL how you doing this? embarrass This is what the default settings should give you if you run Prism Shape for one iteration, followed by a standard Menger Sponge for the remaining iterations. The dotscale simply flattens the shape i.e a house with roof shape. With the Gap x,y,z controls you get some cool shapes with symmetric gap vect3 like (0.5, -0.5, 0.0) In Mandelbulber I have iteration controls so I can place the Prism Shape Transform at "say" iteration number 2 , or iterations 2 & 3. If you can get this to work I can do some more GLSL-ish code for the other transforms that work well together with the prism base shape.
|
|
|
Logged
|
|
|
|
mclarekin
|
|
« Reply #28 on: July 06, 2016, 06:46:54 AM » |
|
This is what gap vect3 (0.5, -0.5, 0.0) should look like
|
|
|
Logged
|
|
|
|
knighty
Fractal Iambus
Posts: 819
|
|
« Reply #29 on: July 12, 2016, 12:12:47 AM » |
|
It is not that difficult to do KIFS. It requires some work though and a lot of sketches (and maybe a 3D CAD software). It is better to begin with 2D objects. The first one I did was a 2D Sierpinski triangle One have to: - Identify scale center and value. - Identify the folding lines/planes and their order: These are visible as the object is symmetric. Here is the settings for the KIFS version of the crossMenger with 3 iterations (can be changed). The second KIFS formula is for the prism: # Mandelbulber settings file # version 2.08 # only modified parameters [main_parameters] ambient_occlusion 5; ambient_occlusion_enabled true; ambient_occlusion_mode 1; bailout 208,93; camera -0,5069504723639101 -3,94725606567745 2,514460444670165; camera_distance_to_target 3,766618844714503; camera_rotation -7,318497517213343 -32,28573138251144 -1,391989634809267e-13; camera_top 0,06804156545685146 0,529790377184933 0,8453948791023207; check_for_bailout_1 false; delta_DE_function 1; detail_level 2; file_lightmap C:\Documents and Settings\Administrateur\Mes documents\Téléchargements\mandelbulber2-win32-2.08-1\textures\background4.jpg; flight_last_to_render 0; formula_1 71; formula_2 10; formula_3 10; formula_iterations_2 3; formula_material_id 3; formula_stop_iteration_3 100; fractal_enable_1 false; glow_enabled false; hybrid_fractal_enable true; image_height 480; image_width 640; keyframe_last_to_render 0; mat1_is_defined true; mat2_fresnel_reflectance true; mat2_is_defined true; mat2_name gold; mat2_reflectance 0,72; mat2_specular 5; mat2_specular_color ff00 e100 3400; mat2_specular_width 0,215; mat2_surface_color ff00 cc00 1000; mat2_transparency_index_of_refraction 10; mat2_use_colors_from_palette false; mat3_is_defined true; mat3_name red plastic; mat3_specular 1,08; mat3_specular_width 0,343; mat3_surface_color a700 1300 1300; mat3_transparency_index_of_refraction 1,37; mat3_use_colors_from_palette false; mat4_is_defined true; mat4_name white plastic; mat4_surface_color 6f00 6f00 6f00; mat4_use_colors_from_palette false; N 98; penetrating_lights false; primitive_plane_1_enabled true; primitive_plane_1_material_id 4; primitive_plane_1_position 0 0 -1,5; repeat_from 3; SSAO_random_mode true; target -0,1013214770768532 -0,788916939183583 0,5025517485314003; use_default_bailout false; volumetric_fog_colour_1_distance 0,7849368203977499; volumetric_fog_colour_2_distance 1,5698736407955; volumetric_fog_distance_factor 1,5698736407955; [fractal_1] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0 -0,707 0,707; IFS_direction_3 0 1 0; IFS_distance_3 0,5; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_enabled_3 true; IFS_offset 0,866 1,5 1,5; IFS_rotation 38,35 0 0; IFS_scale 3; power 8; transf_constant_multiplier_441 3 3 3; transf_rotation 60 0 80,2; transf_scale -1; [fractal_2] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0 -0,707 0,707; IFS_direction_3 0 1 0; IFS_distance_3 0,5; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_enabled_3 true; IFS_offset 0,866 1,5 1,5; IFS_rotation 38,35 0 0; IFS_scale 3; power 8; [fractal_3] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0,5 0,866 0; IFS_distance_2 0,43; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_offset 0,866 1,5 1,5; [fractal_4] [fractal_5] [fractal_6] [fractal_7] [fractal_8] [fractal_9]
And this one with a "reduced" prism. I have just scaled down (in the second KIFS) the "vector offset" and the "dist" of the #3 folding vector: # Mandelbulber settings file # version 2.08 # only modified parameters [main_parameters] ambient_occlusion 0,27; ambient_occlusion_enabled true; ambient_occlusion_mode 0; bailout 208,93; camera -0,5069504723639101 -3,94725606567745 2,514460444670165; camera_distance_to_target 3,766618844714503; camera_rotation -7,318497517213343 -32,28573138251144 -1,391989634809267e-13; camera_top 0,06804156545685146 0,529790377184933 0,8453948791023207; check_for_bailout_1 false; delta_DE_function 1; detail_level 2; file_lightmap C:\Documents and Settings\Administrateur\Mes documents\Téléchargements\mandelbulber2-win32-2.08-1\textures\background4.jpg; flight_last_to_render 0; formula_1 71; formula_2 10; formula_3 10; formula_iterations_2 3; formula_material_id 3; formula_stop_iteration_3 100; fractal_enable_1 false; glow_enabled false; hybrid_fractal_enable true; image_height 480; image_width 640; keyframe_last_to_render 0; mat1_is_defined true; mat2_fresnel_reflectance true; mat2_is_defined true; mat2_name gold; mat2_reflectance 0,72; mat2_specular 5; mat2_specular_color ff00 e100 3400; mat2_specular_width 0,215; mat2_surface_color ff00 cc00 1000; mat2_transparency_index_of_refraction 10; mat2_use_colors_from_palette false; mat3_is_defined true; mat3_name red plastic; mat3_specular 1,08; mat3_specular_width 0,343; mat3_surface_color a700 1300 1300; mat3_transparency_index_of_refraction 1,37; mat3_use_colors_from_palette false; mat4_is_defined true; mat4_name white plastic; mat4_surface_color 6f00 6f00 6f00; mat4_use_colors_from_palette false; N 98; penetrating_lights false; primitive_plane_1_enabled true; primitive_plane_1_material_id 4; primitive_plane_1_position 0 0 -1,5; repeat_from 3; SSAO_random_mode true; target -0,1013214770768532 -0,788916939183583 0,5025517485314003; use_default_bailout false; volumetric_fog_colour_1_distance 0,7849368203977499; volumetric_fog_colour_2_distance 1,5698736407955; volumetric_fog_distance_factor 1,5698736407955; [fractal_1] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0 -0,707 0,707; IFS_direction_3 0 1 0; IFS_distance_3 0,5; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_enabled_3 true; IFS_offset 0,866 1,5 1,5; IFS_rotation 38,35 0 0; IFS_scale 3; power 8; transf_constant_multiplier_441 3 3 3; transf_rotation 60 0 80,2; transf_scale -1; [fractal_2] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0 -0,707 0,707; IFS_direction_3 0 1 0; IFS_distance_3 0,5; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_enabled_3 true; IFS_offset 0,866 1,5 1,5; IFS_rotation 38,35 0 0; IFS_scale 3; power 8; [fractal_3] IFS_abs_y true; IFS_abs_z true; IFS_direction_0 0,866 -0,5 0; IFS_direction_1 0 1 0; IFS_direction_2 0,5 0,866 0; IFS_distance_2 0,34; IFS_enabled_0 true; IFS_enabled_1 true; IFS_enabled_2 true; IFS_offset 0,6929999999999999 1,2 1,2; [fractal_4] [fractal_5] [fractal_6] [fractal_7] [fractal_8] [fractal_9]
|
|
|
Logged
|
|
|
|
|