Logo by DsyneGrafix - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. January 18, 2019, 11:52:50 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 [2] 3 4 5   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Advanced Terrain Generator  (Read 5671 times)
0 Members and 1 Guest are viewing this topic.
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #15 on: November 15, 2015, 04:30:58 PM »

Dear friends,

Sharing the first public version of the terrain generator.
As usually with me, it's become pretty complex, so it may be an overkill for slower systems.

Usage notes
There are four tabs working together.

T-GIZ
This is a primary tab where you have 3 gizmos available.
Each of them produces some sort of mountain-like geometry and can be modified using various parameters.
Use the gizmos to create rough formations of the landscape.
To test gizmos, set the global rendering mode TerOutput to 1. It makes only gizmos to be output thus makes testing easier.
Mode changes various curves used for gizmo generations. In fast terrain mode it's disabled and limited to simple cubic function.
Size modifies global gizmo scale. XY are width and height, Z is normalized amplitude. To make taller formations use LevOut
Shape vec2s depend on the Modes at the top and usually modify details of the curves.
LevOut is an output amplitude of formations. Note that in general, the steeper formations you want to use, the lower Fudge factor must be set to avoid artifacts.

T-SIN
This is a sinusoidal noise generator module.
There's a primary 1-component XYZ sin noise, that I recommend using for another round of global formations creation.
There's a secondary 3-component noise that you can use to shape finer details of the landscape
The engine uses optimizations, so if Freqs or Amps are cranked down to 0.0 it'll skip processing these portions - may help to boost performance on slower machines.

T-TER
This is a tab with a modified and extended version of terrain presented earlier in Fragmentarium.
The old version was based on Ashima Noise and CNoise that was pretty slow. Currently there are 4 modes available:
- IQ2D that is a very fast alternative for previous terrain functions
- IQ3D is also fast, but can be used to create rougher terrain
- IQ2D/3D mode - this one is a mix of the two above, but with optimized processing, so if you plan on using both 2D and 3D noise, just crank them down and only use Mixed 2D/3D. TerMixer blends between 2D mode and 3D mode, both operating on the same set of parameters.
- Finally there's the old CNoise producing the terrain as originally.

Please note that controls for these noises are visible in the T-MIX tab.
Finally, I added also a pre-iteration (TerInitAmp, TerInitFreq) that can be used to generate a large-scale terrain formations independently of the further iterations.

T-MIX
This is the control center.
TerFastMode-  drops some features to gain on performance. Make sure to keep it locked.
TerOutput - switches between various modes of the module - you can output flat terrain, only gizmos, only noises or full composited terrain. Unlock it for designing your landscape, Lock it before rendering in 5 mode.
Global transformations PT Rotate/Translate/Scale are global transformations. I use it across all my modular blocks to enable better compositing with other stuff (fractals etc).
Output vec4 uniforms - this is your control center where you decide where each of noises go. 4 components of vec4 are as follows:
- X: global output - adds to heightmap regardless of other features, globally
- Y: mixes the noise into Gizmo 1
- Z: mixes the noise into Gizmo 2
- W: mixes the noise into Gizmo 3

Notes
- I know it's quite complex, so takes a while to learn, but I believe it's a powerful tool.
- I plan on optimizing it a bit more and adding a texture-based mode to enable large-scale terrain modeling based on predefined textures - this can improve performance significantly and adds more control.
- There are some rendering issues on steeper formations. It's generally related to the raytracer (present with most of tracers). The problem is that (without noises) these are well-defined structures with a nice and clean DE (sin, cos, parabolas etc...) - so in theory they should render well. But for some reason the tracer misses surface particularly in the areas where the surface is perpendicular to the ray. It requires to significantly decrease fudge factor to compensate for it. I am not sure how to address that - maybe some of the gurus here can help.

@3dickulus - please feel free to create PatrykKizny folder in examples and include the stuff.


* Terrain_v3.jpg (215.79 KB, 1920x1080 - viewed 445 times.)
* Terrain_v3_Files.rar (23.58 KB - downloaded 166 times.)
« Last Edit: November 15, 2015, 05:11:17 PM by Patryk Kizny » Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #16 on: November 15, 2015, 05:45:56 PM »

If you wanted to give it a shot, here's a version with my beefy 1.3 raytracer in full glory.



* Terrain_v3_DEPK-13.jpg (50.09 KB, 1280x505 - viewed 445 times.)
* Terrain_v3_DEPK-13_Files.rar (34.97 KB - downloaded 162 times.)
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #17 on: November 15, 2015, 05:49:06 PM »

Neat... if only I could run it on an 8 year old mobile GPU.... :p
Logged

Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #18 on: November 15, 2015, 05:55:58 PM »

Neat... if only I could run it on an 8 year old mobile GPU.... :p

The first version is way lighter. You can give it a try.
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #19 on: November 15, 2015, 06:17:17 PM »

Patryk Kizny, thanks for sharing.
Unfortunately both scripts don't run on my gtx660. Failed... 7 seconds of compiling  cry
Strange, you said that this noise code by IQ is faster  undecided  Maybe some optimizations...  snore
Logged

Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #20 on: November 15, 2015, 06:38:01 PM »

Any errors or just crashed?
Here it compiles in 25s (in theory), in practice about 10.
« Last Edit: November 15, 2015, 06:49:01 PM by Patryk Kizny » Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
Snicker02
Alien
***
Posts: 38


« Reply #21 on: November 15, 2015, 08:12:02 PM »

I am getting errors

error log
Parse: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/_Terrain_v3.frag
Including file: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/DE-Kn2.frag
Including file: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/3DKn-1.0.1.frag
Including buffershader: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/BufferShader-1.0.0.frag
Parse: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/BufferShader-1.0.0.frag
BufferShader 1.0.0
Including file: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/Math-Utils.frag
Including file: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/Space-Transforms.frag
Including file: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/Classic-Noise.frag
Including file: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/DEF-Terrain_v3.frag
Including file: D:/documents/downloads/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Fragmentarium-1.0.13-Qt_5_3_2_MinGW/Examples/Presets-Camera-Z-Up.frag
Advanced Terrain Generator v3.0
Patryk Kizny / http://kizny.com
Based on moise functions by IQ
------
DE-RaytracerKn-0.9.12.frag: Original shader by syntopia. Modifications by knighty + Eiffie + ChrisJRodgers:
- Added multiple reflections
3DKn-0.9.12.frag: Original shader by syntopia. Modifications by knighty:
- Assumes square shaped pixel -> no over-blurring along x axis if the rendering window width is small wrt its height
- Added polygon shaped diaphragm.
- Added Control for the width of the in-focus region.
Simple 3D Setup
Terrain Generator by Patryk Kizny
http://kizny.com
Based on IQ noise functions
float terDE(vec3 p)
float gndGizmo(vec3 p)
make sure to include "Classic-Noise.frag"
Basic camera presets. Z is up
4 locked variables: TerFastMode,TerOutput,ApertureNbrSides,ApStarShaped
Camera: Use W/S to fly. 1/3 adjusts speed. Q/E rolls. Click on 3D window for key focus. See Help Menu for more.
Created front and back buffers as RGBA32F
Could not create fragment shader: Fragment shader failed to compile with the following errors:
ERROR: 1:2250: error(#202) No matching overloaded function found: opTRS
ERROR: error(#273) 1 compilation errors.  No code generated


Failed to compile script (156 ms).




here are the params

// Output generated from file: X:/Projects/20151106 - LetThereBeLight/TerrainGenerator_20151115.frag
// Created: Sun Nov 15 15:59:15 2015
#info Advanced Terrain Generator v3.0
#info Patryk Kizny / http://kizny.com
#info Based on moise functions by IQ
#info ------

// Flags
#define USE_EIFFIE_SHADOW
#define PERFECT_DE

// PK raytracer flags
//#define USE_PK_IBL
//#define USE_PK_BACKGROUND
//#define USE_PK_DIRT
//#define USE_HYBRID_1
//#define USE_OLD_GLOW
//#define USE_CLIPPING
//#define USE_KN2_SHADER
//#define USE_IQ_CLOUDS
//#define USE_IQ_CLOUDS_MULTILAYER // Multilayer Clouds by PK
//#define USE_KN_VOLUMETRIC
//#define TAG_LAYERS // Uncomment this to output alpha pass

// Raytracer
//#include "SunSky_PK_v1.frag"
//#include "DE-PK-1.3.frag"
#include "DE-Kn2.frag"

// Core
#include "Math-Utils.frag"
#include "Space-Transforms.frag"
#include "Classic-Noise.frag"

#include "DEF-Terrain_v3.frag"

// Presets
#include "Presets-Camera-Z-Up.frag"

float DE(vec3 z){
   
   float de;

   #ifdef DE_Terrain
   de = terDE(z);
   #else
   de = z.z;
   #endif
   
   return de;
}




#preset Default
FOV = 1.35
Eye = -9.097912,-8.895071,2.877836
Target = -6.880132,-6.401387,1.822852
FocalPlane = 1
Aperture = 0
InFocusAWidth = 0
ApertureNbrSides = 5
ApertureRot = 0
ApStarShaped = false
Gamma = 1
ToneMapping = 1
Exposure = 1
Brightness = 1
Contrast = 1
Saturation = 1
GaussianWeight = 1
AntiAliasScale = 2
Bloom = false
BloomIntensity = 0.25
BloomPow = 2
BloomTaps = 4
Detail = -2.5
DetailAO = -0.5
FudgeFactor = 0.5
MaxRaySteps = 256
MaxDistance = 35
MaxRayStepsDiv = 1.8
Dither = 0.5
NormalBackStep = 1
AO = 0,0,0,1
AoCorrect = 0
Specular = 0.4
SpecularExp = 16
SpecularMax = 10
CamLight = 1,1,1,0.35
CamLightMin = 0
Glow = 1,1,1,0
GlowMax = 20
Reflection = 1,1,1
ReflectionsNumber = 0
SpotGlow = true
SpotLight = 1,1,1,1
LightPos = 2.554744,6.253041,10
LightSize = 0.1
LightFallOff = 0
LightGlowRad = 0
LightGlowExp = 1
HardShadow = 1
ShadowSoft = 10
BaseColor = 0.4745098,0.4745098,0.4745098
OrbitStrength = 0
X = 0.5,0.6,0.6,0.7
Y = 1,0.6,0,0.4
Z = 0.8,0.78,1,0.5
R = 0.4,0.7,1,0.12
BackgroundColor = 0.6,0.6,0.6
GradientBackground = 0.3
CycleColors = false
Cycles = 1.1
EnableFloor = false
FloorNormal = 0,0,1
FloorHeight = 0
FloorColor = 1,1,1
HF_Fallof = 0.1
HF_Const = 0
HF_Intensity = 0
HF_Dir = 0,0,1
HF_Offset = 0
HF_Color = 1,1,1,1
sTranslate = 0,0,0
sRotate = 0,0,0
sScale = 1
sTwist = 0
clipToBox = false
showClippingBox = false
cBoxSize = 5,5,5
cBoxTranslate = 0,0,0
cBoxRotate = 0,0,0
TerPTRotate = 0,0,0
TerPTTranslate = 0,0,0
TerPTScale = 1
TerSin1Out = 0,0,0,0
TerSin2Out = 0,0.5,1,1
TerIQ2DOut = 0.15,1,1,0
TerIQ3DOut = 0,0,0,0
TerIQMixOut = 0,0,0,0
TerCNoiseOut = 0,0,0,0
TG1_Mode = 4
TG2_Mode = 0
TG3_Mode = 3
TG1_Center = -5,2
TG2_Center = 2,4
TG3_Center = 4,-5
TG1_Size = 2,2,1
TG2_Size = 5,5,1
TG3_Size = 25,5,1
TG1_Shape = 0.25,0.5
TG2_Shape = 0,0
TG3_Shape = 0.1,0.25
TGLevOut = 1.5,3,-2.55
TerSinNoisePrimFreq = 1.75,3.5,0.05
TerSinNoisePrimAmp = 0.5,0.5,0.5
TerSinNoisePrimOffset = 0,0,0
TerSinNoiseSecFreq = 2,3,1.5
TerSinNoiseSecAmp = 0.35,0.35,1
TerSinNoiseSecFM = 1.15,2.66,4.77
TerSinNoiseSecAM = 0.75,0.5,1
TerIterations = 5
TerSlope = 0.5
TerInitFreq = 1
TerInitAmp = 0.5
TerFreqMul = 5
TerAmpMul = 1
TerOffset = 0
TerMixer = 0.5
TerFastMode = false
TerOutput = 4
Up = 0.2009916,0.2238526,0.9516473

#endpreset

Logged
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #22 on: November 15, 2015, 11:29:19 PM »

Weird, cause it was exported while rendering so a working example.
What could have happened is frag included an older file version from some other path.
I'll check tomorrow and upload again.
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #23 on: November 16, 2015, 12:12:12 AM »

GeForce GTX 760
CUDA Version: 7.5
nVidia Driver Version: 352.55

Could not link fragment shaders:
Fragment info
-------------
0(134) : warning C7011: implicit cast from "int" to "float"
0(1427) : warning C7011: implicit cast from "int" to "float"
0(1427) : warning C7011: implicit cast from "int" to "float"


Failed to compile script (32154 ms).

not too many instructions so must be something else,
when locating included files Fragmentarium begins in the folder containing the fragment and only if not found does it check other locations.

I also get...

Tried path: /home/uname/Fragmentarium/Examples/Include/Milkyway_BG.jpg
Could not resolve path for file: Milkyway_BG.jpg

in the preset we have...

BgMap = C:/DATA/Fragmentarium/1.0.10/Examples/Include/Milkyway_BG.jpg
EnvMapSpecular = C:/DATA/Fragmentarium/1.0.10/Examples/Include/Ditch-River_2k.hdr
EnvMapDiffuse = C:/DATA/Fragmentarium/1.0.10/Examples/Include/Ditch-River_Env.hdr

...even though the paths are wrong for Ditch-River files they do get found because they exist in Examples/Include/ folder as part of the distribution so every one should have these...

Added texture: EnvMapSpecular -> /home/uname/Fragmentarium/Examples/Include/Ditch-River_2k.hdr
Added texture: EnvMapDiffuse -> /home/uname/Fragmentarium/Examples/Include/Ditch-River_Env.hdr

...however, Milkyway_BG.jpg should be in the folder with the frag because it cannot be expected to exist on everyone else's systems.

when distributing a "fragment bundle" you need to include all support files, maybe I can write it into the bit that gathers the included files to also include textures, backgrounds, envmaps etc... maybe next patch release, just posted v1.0.15 source and exe wink

@Snicker02: I note BufferShader 1.0.0 while PK's fragments, as bundled, uses BufferShader 1.0.2 this may be caused by you using #include "DE-Kn2.frag" which (just guessing) probably has no idea what PK's terrain generator is doing or how to handle it.

hope this helps cheesy
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #24 on: November 16, 2015, 03:46:30 AM »

hmmm.....
Code:
QOpenGLShader::compile(Fragment):
  0(134) : warning C7011: implicit cast from "int" to "float"
0(1423) : warning C7011: implicit cast from "int" to "float"
0(1423) : warning C7011: implicit cast from "int" to "float"
0(1430) : warning C7011: implicit cast from "int" to "float"
0(1439) : warning C7011: implicit cast from "int" to "float"
0(1439) : warning C7011: implicit cast from "int" to "float"
0(1439) : warning C7011: implicit cast from "int" to "float"
0(1616) : warning C7011: implicit cast from "int" to "float"
0(1617) : warning C7011: implicit cast from "int" to "float"
0(1658) : warning C7011: implicit cast from "float" to "vec3"
0(1720) : warning C7623: implicit narrowing of type from "vec3" to "float"
0(2022) : warning C7011: implicit cast from "int" to "float"
0(2068) : warning C7011: implicit cast from "float" to "vec3"
0(2240) : warning C7505: OpenGL does not allow swizzles on scalar expressions
0(2240) : error C1031: swizzle mask element not present in operand "xyz"
0(2240) : warning C7505: OpenGL does not allow swizzles on scalar expressions
0(2240) : error C1031: swizzle mask element not present in operand "w"
0(2253) : warning C7011: implicit cast from "int" to "float"
0(2253) : warning C7011: implicit cast from "float" to "vec3"
0(2363) : warning C7011: implicit cast from "int" to "float"
0(2367) : warning C7011: implicit cast from "int" to "float"
0(2372) : warning C7011: implicit cast from "vec4" to "vec3"
0(2379) : warning C7011: implicit cast from "vec4" to "vec3"
0(2393) : warning C7011: implicit cast from "int" to "float"
0(2401) : warning C7011: implicit cast from "int" to "float"
0(3232) : warning C7011: implicit cast from "int" to "float"
0(3428) : warning C7623: implicit narrowing of type from "vec3" to "float"
0(3428) : warning C7011: implicit cast from "float" to "vec3"

I had a look at the code and I'm afraid I can't fix it but I can help a bit...
when the GPU compiler detects something wrong with the shader it dumps the errors + source to console out on stderr, this does not showup in the Fragmentarium logs because it is before linking (panic afaik),  you can capture it by running from a cmd prompt like...
Code:
./Fragmentarium-1.0.15 2> FDUMP.txt
the "2>" redirects stderr to a file
load FDUMP.txt into a text editor with line numbers
cut and paste everything upto an including the line "*** Problematic Fragment shader source code ***" into another (you need 2) text editor window
now you will be looking at a list of errors and line numbers in one window and the raw source in the other
from this you will be able to track down the line and the file it's in so you can fix it wink
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
JohnVV
Conqueror
*******
Posts: 123


having fun


« Reply #25 on: November 16, 2015, 08:53:06 AM »

hi 3dickulus and Patryk Kizny

i too am getting the same C7011 error  on linux
 opensuse 13.2
 A older  nvidia gts 240
 The older cuda 6.5

Code:
Could not link shaders: Fragment info
-------------
0(1189) : warning C7011: implicit cast from "int" to "float"
0(1193) : warning C7011: implicit cast from "int" to "float"
0(1198) : warning C7011: implicit cast from "vec4" to "vec3"
0(1205) : warning C7011: implicit cast from "vec4" to "vec3"
0(1219) : warning C7011: implicit cast from "int" to "float"
0(1227) : warning C7011: implicit cast from "int" to "float"
0(2057) : warning C7011: implicit cast from "int" to "float"
0(2135) : warning C7011: implicit cast from "int" to "float"
0(2140) : warning C7011: implicit cast from "int" to "float"
0(2253) : warning C7011: implicit cast from "float" to "vec3"
0(2265) : warning C7011: implicit cast from "int" to "float"
Internal error: assembly compile error for fragment shader at offset 399814:
-- error message --
line 15861, column 1:  error: too many instructions
-- internal assembly text --
!!NVfp4.0
OPTION NV_parameter_buffer_object2;
# cgc version 3.4.0001, build date Aug 19 2015
# command line args:
#vendor NVIDIA Corporation
#version 3.4.0.1
#profile gp4fp
#program main
#semantic subframe
#semantic backbuffer
#semantic FocalPlane
#semantic Aperture
--- and so on for 17,000+ lines
]
« Last Edit: November 16, 2015, 09:06:48 AM by JohnVV » Logged

Running OpenSUSE 42.1-64bit & ScientificLinux-6.7-64bit
I don't pitch Linux to my friends,I let Microsoft do it for me!"
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #26 on: November 16, 2015, 03:38:20 PM »

Code:
-- error message --
line 15861, column 1:  error: too many instructions

let me guess, you fixed a few things, it got a past syntax err, but now the compiler says it's too big for your GTS 240
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #27 on: November 16, 2015, 06:45:50 PM »

Hey,

I have opened and compiled both packages that I posted, also removing the extra include paths of my fragmentarium.
So I don't know what's wrong.

Regarding the maps - just forget about it - you can replace it with anything you like. These don't matter.
On a weaker GPUs it can probably exceed the amount of instructions it can handle.

Regarding the opTRS - that's weird with no matching overloaded function, but you can try working around it by commenting line 420 of DEF-Terrain

// Global transformations
// z = opTRS(z, TerPTTranslate, TerPTRotate, TerPTScale);


You can also replace the space-transform file with the one attached.


* Space-Transforms.frag (2.86 KB - downloaded 151 times.)
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #28 on: November 16, 2015, 07:18:36 PM »

  I made a better version of my sphere to cube thing since the "convert3" version you put in your "space-transforms.frag".

  It eliminates the trig functions... so ya know.  It's in the HELP! Thread, and I think it's in the "circle math" thread as well.  No trig functions= faster... even on a super duper GPU.  wink

Code:
// cubic to spheric   (can be optimized... dot (z,z)...  mclarekin's idea ;)  )
rCyz = z.y*z.y / (z.z*z.z);
if (rCyz < 1.0) {rCyz = sqrt(rCyz + 1.0);} else {rCyz=sqrt( 1.0 / rCyz + 1.0);}

rCxyz = (z.y*z.y + z.z*z.z ) / (z.x*z.x) ;
if (rCxyz < 1.0) {rCxyz =s qrt(rCxyz + 1.0);} else {rCxyz=sqrt(1.0/ rCxyz + 1.0);}

z.yz *=rCyz;
z *= rCxyz;

« Last Edit: November 16, 2015, 07:38:18 PM by M Benesi » Logged

Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #29 on: November 16, 2015, 08:30:35 PM »

Hmmm, did you try it's really faster? Sqrt is a though one too.
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
Pages: 1 [2] 3 4 5   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Fractal Terrain Movies Showcase (Rate My Movie) DaveH 10 1523 Last post June 18, 2013, 10:29:16 PM
by DaveH
advanced geometry Fractal Humor taurus 2 1719 Last post August 15, 2013, 12:56:31 AM
by Rodak
Advanced DoF/bokeh-like-effects in JWildfire 2.1 JWildfire thargor6 5 1169 Last post November 22, 2015, 02:51:13 PM
by Patryk Kizny
Advanced Teleportation Machine Mandelbulb3D Gallery Weber 0 386 Last post August 08, 2016, 10:02:27 PM
by Weber
SunSky with 3DKn-1.0.1.frag for advanced DoF Fragmentarium Crist-JRoger 5 635 Last post September 19, 2017, 07:46:51 PM
by Tim Emit

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.169 seconds with 28 queries. (Pretty URLs adds 0.008s, 2q)