Last Length Increase colouring... well sort of...

  • 33 Replies
  • 862 Views

0 Members and 1 Guest are viewing this topic.

Offline Sabine62

  • *
  • Fractal Frankfurter
  • *
  • Posts: 624
  • It's just a jump to the left...
    • sabine62.deviantart.com
« on: January 06, 2019, 06:43:59 PM »
Love the LLI-colouring method of MB3D, which seems based on the absolute difference between the length of the current and previous vector, multiplied by an abitrary factor.
Tried to implement something close to that (not the length though, but vector increase) into FragM, below the code with Pupukuusikkos Spiralbox. Goes really well with some formulas with quite reasonable control on saturation etc. and not so well with others. Very probably could be done from ray-tracer.
Next to changing OrbitStrength also test with other BaseColors.

Will also add to Code Snippets

Code: [Select]
#info amazing box variant  by pupukuusikko,
#info  julias wih grailish spirals
#info adjust JuliaC.y for swirling ride
#info DE could use some help


#define providesColor                  //tell FragM to use custom colours
//#define providesInit
//#define WANG_HASH

//#include "DE-Raytracer.frag"
#define USE_IQ_CLOUDS
#define KN_VOLUMETRIC
#define USE_EIFFIE_SHADOW
#define MULTI_SAMPLE_AO
//uniform float time;
#include "MathUtils.frag"
#include "DE-Kn2cr11.frag"

#group Kleinian_test
uniform int Box_Iterations;  slider[1,50,100]
uniform bool Julia; checkbox[false]
uniform vec3 JuliaC; slider[(-2,-2,-2),(0,0,0),(2,2,2)]
uniform float fold;  slider[-1.,0.25,5.]

//add the following uniforms to the Coloring-tab
#group Coloring                                         
//multiplier for the division
uniform vec3 LVI; slider[(-1,-1,-1),(0,0,0),(1,1,1)]       
//added to LLI to give more possibilities
uniform vec3 LVI2; slider[(-1,-1,-1),(0,0,0),(1,1,1)]     
//determines for how many iterations the difference between the vectors should be calculated
uniform int LightIter; slider[0,1,100]                     
//choose between lightold/lightnew or lightnew/lightold
uniform bool RevertDiv; checkbox[false]                     
//in some cases/formulas I found it beneficial to add this
uniform bool AddOrbitStrength; checkbox[false]
//previous vector         
vec3 lightold;
 //current vector                                             
vec3 lightnew;                                             


float dot2(vec3 z){ return dot(z,z);}






float  minibox(vec3 z)
{
vec3 pos = z;
lightold=z;                                 //initialize lightold, necessary in some formulas
float DF = 1.0;

for (int i = 0; i < Box_Iterations ; i++)
{
if (i<LightIter) {lightold=z;} else {lightold=lightold;};        //get old vector, stop at LightIter-value
  z.xyz = clamp(z.xyz, -fold, fold)*2. - z.xyz;
float r =dot2(z);
if (r< 0.001 || r> 1000.) break;
z/=-r;
DF/= r;
z.xz*=-1.;
z+=(Julia ? JuliaC : pos);
if (i<LightIter) {lightnew=z;} else {lightnew=lightnew;};            //get new vector, stop at LightIter-value
orbitTrap = min(orbitTrap, abs(vec4(z,dot(z,z))));//For colouring
}

float r = length(z); //(dot2(z));
//return (0.5*sqrt(r))/(abs(DF)+1.);
return (0.5*(sqrt(0.1*r)))/(abs(DF)+1.);

}

float DE(vec3 p) {
return minibox(p);
}

//function that is needed by providesColor and will get the absolute division factor of lightold and lightnew,
//multiply it with the sum of LVI and LVI2, conditional reversion of the division and addition of Orbitstrength

vec3 baseColor(vec3 p, vec3 q){
  if (RevertDiv) {q=abs(lightnew/lightold);} else {q=abs(lightold/lightnew);};
q*=(LVI+LVI2);
if (AddOrbitStrength) q+=OrbitStrength;
   return q;
}



#preset Default
FOV = 0.3098291
Eye = -5.950135,-3.788089,0.5820105
Target = -5.724489,1.622657,-0.6966331
Up = 0.1359288,0.2085676,0.9065685
Gamma = 2
ToneMapping = 5
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Bloom = false
BloomIntensity = 0.25
DepthToAlpha = false
Detail = -3.434687
FudgeFactor = 1
DetailAO = -0.9230769
coneApertureAO = 0.4987437
maxIterAO = 20
FudgeAO = 0.4975962
AO_ambient = 1
AO_camlight = 1
AO_pointlight = 1
AoCorrect = 0
Specular = 1.4
SpecularExp = 16
CamLight = 1,1,1,0.3227273
AmbiantLight = 1,0.9686275,0.8980392,0.1206497
Reflection = 0.4392157,0.4392157,0.4392157
ReflectionsNumber = 1
SpotGlow = true
LightSize = 0
LightFallOff = 0.0992108
LightGlowRad = 0
LightGlowExp = 2.7143
HardShadow = 1
ShadowSoft = 4.943052
BaseColor = 0.5137255,0.6392157,0.6941177
OrbitStrength = 0.1449438
X = 0,1,0.164706,1
Y = 1,0.533333,0,1
Z = 0.603922,0.164706,0.776471,1
R = 0.262745,0.482353,1,1
BackgroundColor = 0.4235294,0.6470588,0.9607843
GradientBackground = 0
CycleColors = true
Cycles = 19.93994
EnableFloor = true NotLocked
FloorNormal = 0,0,1
FloorColor = 0.5882353,0.5137255,0.4627451
HF_Fallof = 0.659051
HF_Const = 0
HF_Intensity = 0.4944072
HF_Dir = -0.01176,0,1
HF_Offset = -10
HF_Color = 0.670588,0.807843,0.890196,0.3034091
HF_Scatter = 1.930804
HF_Anisotropy = 0.847059,0.847059,0.847059
HF_CastShadow = false
CloudScale = 0.1
CloudTops = -5.442177
CloudBase = -8.072562
CloudDensity = 1
CloudRoughness = 1
CloudContrast = 1
CloudColor = 0.65,0.68,0.7
SunLightColor = 0.7,0.5,0.3
FocalPlane = 0,2174191
Aperture = 0
InFocusAWidth = 0.9896433
DofCorrect = true
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = false
BloomPow = 2
BloomStrong = 1
RefineSteps = 4
MaxDistance = 93.85863
SpotLight = 1,1,1,4.074505
ShadowBlur = 0
perf = false
SSS = false
sss1 = 0.1
sss2 = 0.3409338
HF_FogIter = 1
EnCloudsDir = true NotLocked
CloudFlatness = 0 NotLocked
CloudColor2 = 0.07,0.17,0.24 NotLocked
Cloudvar1 = 0.99 NotLocked
Cloudvar2 = 1 NotLocked
CloudIter = 5 NotLocked
CloudBgMix = 1 NotLocked
FloorHeight = 0
AutoFocus = false
BloomTaps = 4
MaxRaySteps = 354
Dither = 0.5
NormalBackStep = 1
LightPos = -4.080718,-7.757847,3.408072
Box_Iterations = 60
Julia = true
JuliaC = -0.017316,-0.5584416,0.034632
fold = 1.33833
LVI = -0.010661,-0.4946695,0.554371
LightIter = 36
RevertDiv = false
AddOrbitStrength = false
LVI2 = 0.6416309,0.6373391,-1
#endpreset


« Last Edit: January 08, 2019, 06:26:28 PM by Sabine62 »
To thine own self be true

Offline 3DickUlus

  • *
  • 3e
  • *****
  • Posts: 1142
    • Digilantism
« Reply #1 on: January 06, 2019, 11:48:58 PM »
very nice work  :clapping: :joy: I can't wait to dig into the Examples and Includes folders ( next weekend til 4:30 am ? ) just finished some nice features for FragM you will enjoy... autoload on external change, enable it in preferences, that means you can use your favorite text editor and FragM will detect the changes and reload/compile the frag automagicaly, just the main one in the editor ( really hope it works on windows, fingers crossed, haven't tested yet, log to file and frag cleanup is coming )
Resistance is fertile... you will be illuminated!

https://en.wikibooks.org/wiki/Fractals/fragmentarium

Offline Sabine62

  • *
  • Fractal Frankfurter
  • *
  • Posts: 624
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #2 on: January 07, 2019, 10:33:56 PM »
Quote
til 4:30 am ?
   ;D

Very much looking forward to test your new toy! I am hooked on my external editor so updating on the fly would be great!  :thumbs:

Offline 3DickUlus

  • *
  • 3e
  • *****
  • Posts: 1142
    • Digilantism
« Reply #3 on: January 08, 2019, 02:09:33 AM »
Me too! it's nice to have my editor full screen on monitor #2
It will also warn if the file in FragM's editor is not saved after a change and then the file is edited by another program.

When "Auto Load" is unchecked in preferences it says "It looks like the file: filename has been changed by another program. Would you like to reload it?" and "accept" = load "reject" = no load and if the current file is unsaved, pending changes in FragM's editor, it says "Will not read file: filename Conflict with changes in the editor!"

...of course this all needs some field testing but it seems to work here ;)

Offline 3DickUlus

  • *
  • 3e
  • *****
  • Posts: 1142
    • Digilantism
« Reply #4 on: January 08, 2019, 05:14:41 AM »
...about the frag, great coloring but...

FragM uses the commented line above the slider as the tool tip for that slider in the GUI so if you use the code as presented, with comments on the same line as the slider declaration it will throw an error when parsed...
Code: [Select]
Could not create fragment shader: 0(755) : error C0000: syntax error, unexpected '[', expecting "::" at token "["
Failed to compile script (11 ms).

This can be fixed by placing the comments above the sliders like...
Code: [Select]
// add the following uniforms to the Coloring-tab
#group Coloring

// multiplier for the division
uniform vec3 LVI; slider[(-1,-1,-1),(0,0,0),(1,1,1)]

// added to LLI to give more possibilities
uniform vec3 LVI2; slider[(-1,-1,-1),(0,0,0),(1,1,1)]

// determines for how many iterations the difference between the vectors should be calculated
uniform int LightIter; slider[0,1,100]

// choose between lightold/lightnew or lightnew/lightold
uniform bool RevertDiv; checkbox[false]

// in some cases/formulas I found it beneficial to add this
uniform bool AddOrbitStrength; checkbox[false]
...with the added bonus of some feedback in the GUI when you hover over a widget ;)

Extra blank lines are for readability, for now FragM expects to find nothing else on the special uniform lines that make widgets, I may add this to the parser in the future, comments should also have at least one space between the comment line indicator "//" and the text of the comment.

Offline Sabine62

  • *
  • Fractal Frankfurter
  • *
  • Posts: 624
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #5 on: January 08, 2019, 08:16:08 AM »
Argghhh Arrgggh Argghhh and me in all innocence just throwing this code at people  ::)
Thank you for explaining, Dick, I never knew FragM read the uniform comments like that!  :thumbs: But why the space after \\? (As in why make it extra complicated/generate extra errors with someone who does not know?)

Offline 3DickUlus

  • *
  • 3e
  • *****
  • Posts: 1142
    • Digilantism
« Reply #6 on: January 08, 2019, 04:53:14 PM »
The space after "//" is not mandatory, just for readability and style... I think.

Offline Sabine62

  • *
  • Fractal Frankfurter
  • *
  • Posts: 624
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #7 on: January 08, 2019, 06:40:58 PM »
Oh well, it's me, I just love compressed code and somehow in my system comments are put next to what I'm commenting and taking as little space as possible. Learned it like that in the dark middle ages   ::) Got no style tho'  ;D ;D ;D
I thought there might have been some special reason for the extra space...

If time permits (someday!!!) I'll try to put the whole thing into the raytracer or a separate .frag. Still have DeltaDE on my list for that too  :fp:

And I have a request: if you push to git, would you consider changing the filename for the setRecentFile-function into aboluteFilePath?

MainWindow.cpp at around ln 2666:

 
Code: [Select]
QString text = QString("&%1 %2").arg(i + 1).arg(QFileInfo(files[i]).absoluteFilePath());
That would be a great help for me as I'm constantly juggling files...


« Last Edit: January 09, 2019, 12:28:49 PM by Sabine62 »

Offline knighty

  • *
  • Fractal Feline
  • **
  • Posts: 185
« Reply #8 on: January 09, 2019, 02:13:54 PM »
Super cool!
Thank you.

Offline Sabine62

  • *
  • Fractal Frankfurter
  • *
  • Posts: 624
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #9 on: January 10, 2019, 06:17:57 PM »
Glad you like, Knighty! :)

Offline gerson

  • *
  • Fractal Feline
  • **
  • Posts: 151
« Reply #10 on: February 11, 2019, 05:23:36 PM »
although I cant get using fragmentarium yet, I like you share its parameters and formulas.

Offline 3DickUlus

  • *
  • 3e
  • *****
  • Posts: 1142
    • Digilantism
« Reply #11 on: February 12, 2019, 01:22:56 AM »
@Sabine62 I added the full path/filename as a tool tip just hover the mouse over a tab and it should popup ;)

Offline Sabine62

  • *
  • Fractal Frankfurter
  • *
  • Posts: 624
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #12 on: February 12, 2019, 12:20:08 PM »
@3Dickulus Great idea!  :thumbs:
But what I really meant and need is the whole path in the recent file list (that's where my code reference pointed to)
See example below ;) If that would be ok, too, it would be a great help!


Offline Sabine62

  • *
  • Fractal Frankfurter
  • *
  • Posts: 624
  • It's just a jump to the left...
    • sabine62.deviantart.com
« Reply #13 on: February 12, 2019, 12:23:38 PM »
@gerson I am happy to share  :)

Offline 3DickUlus

  • *
  • 3e
  • *****
  • Posts: 1142
    • Digilantism
« Reply #14 on: February 12, 2019, 05:18:18 PM »
Maybe will look at making "full path in recent files menu" an option in preferences... I really dont like  a menu that takes up almost the entire screen  >:(


xx
Quasi-LLI-colouring method, last vector increase LVI

Started by Sabine62 on Code Snippets (fragments)

0 Replies
82 Views
Last post January 06, 2019, 07:12:01 PM
by Sabine62
clip
BBCode editor width increase?

Started by Anon on Discuss Fractalforums

13 Replies
526 Views
Last post March 08, 2018, 08:12:06 PM
by Anon
xx
Restrict recomputed area(s) with iteration increase.

Started by mdudley on Kalles Fraktaler

15 Replies
351 Views
Last post September 17, 2018, 07:02:26 PM
by gerrit
clip
What is the length of a binary tree?

Started by TGlad on Fractal Mathematics And New Theories

10 Replies
266 Views
Last post November 30, 2018, 07:19:01 AM
by fractower
clip
login session length ignored

Started by claude on Forum Help And Support

3 Replies
201 Views
Last post March 12, 2018, 06:34:22 PM
by 3DickUlus