News: Support us via Flattr FLATTR Link  ## The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!

 Pages:    Go Down       Author Topic: sprite and labyringth generator formula  (Read 705 times) Description: 0 Members and 1 Guest are viewing this topic.
Mrz00m
Fractal Lover  Posts: 204 « on: January 06, 2017, 11:52:41 AM »

Here's a formula that multiplies a square wave with a random frequency on the X and Y planes and then moves the resulting surface through X and Y by the same random frequency square waves at a 10-20 times lower frequency create a totally unpredictable labyrinth type formula, and there are also C64 type game sprites on it. it's very very fast and it is perhaps a good addition to fractal hybrid programs. If you can figure a way to make it have many gradients of size that would be awesome.

http://www.thingiverse.com/thing:1985936

There's a lot of control of the random startpoint, the shapes, and the density/void ratio of the render:

labyrinthIsoSurface();

ridgeDensity = 1222;//higher values compress the random oscillator at higher frequency
brickDensity = 0.45;//regulates the difficulty of maze
mixIntensity= 0.02;
mazeSize = 100;

module labyrinthIsoSurface (){

for( j = [ 1 : mazeSize ])
for( i = [ 1 : mazeSize ])
{

li = lfo(i*ridgeDensity)*547.154;//random lfo values
lj = lfo(j*ridgeDensity)*457;
xc= (lfo(j*mixIntensity+li) + lfo(i*mixIntensity+lj))*.25+brickDensity;//
//xc= (lfo(li) + lfo(lj))*.25+mixIntensity;//run this version to see simple version of maze

rd = round(xc)*55;
//echo(xc);
if (xc > .5) // if isosurface is small, build wall cube
{
translate( [j ,i, 0])
cube(1);
}
}
}

function mod(a,m) = a - m*floor(a/m);
function lfo(xx)= mod(abs((sin(floor(xx))*0.01246)*32718.927),1.0)*2.0 - 1.0  ; //erratic sin
//low frequency oscillator function similar to synthesizer robot sound like R2D2

 « Last Edit: January 06, 2017, 12:00:13 PM by Mrz00m » Logged
Spain2points
Navigator     Posts: 75  « Reply #1 on: January 09, 2017, 09:40:33 AM »

That looks really cool, I hope thwy can implement it. Logged
DarkBeam
Global Moderator
Fractal Senior      Posts: 2512 Fragments of the fractal -like the tip of it « Reply #2 on: January 09, 2017, 09:57:56 AM »

Can you code this using mb3d's jit or using my DIFS framework?
I don't understand fully your code Logged

No sweat, guardian of wisdom!
Mrz00m
Fractal Lover  Posts: 204 « Reply #3 on: January 10, 2017, 06:47:57 PM »

Thanks, hi, yes i should learn jit and DIFS framework, sounds fun. I'm a fan of online copy paste graphing tools. i think i found a jit tutorial. will see.

Here is a C style implementation, it's actually .JS :
Code:
function Start () {

startPos is current world position;

for (var h:int = -100; h < 100 ; h ++)
for (var j:int = -100; j < 100 ; j ++){
var current :Vector3= startPos+Vector3(h*10.0,0,j*10.0);
if (equation1(current) > .5)
{
var cube : GameObject  =  instantiate cube in maze variable current
// if equation there is higher than .5 it means that it's a wall in space there, if it's less than zero it void space. the height of the walls is vaguely 55 world spaces according to the equation formula.
}

//
}
}

function Update () {

}

function  equation1 ( vtx: Vector3 ): float//  Labyrinth
{
var xi = lfo(vtx.x*.0025)*542;
var zi = lfo(vtx.z*.002)*222;//xi zi shuffles the straighter maze formula, without is less maze
var xc= (lfo(vtx.x*.05+zi) + lfo(vtx.z*.05+xi))*.25+.49;//+.49 regulates difficulty of maze, .35 is easy
return Math.Round(xc)*55; //multiply at the end to get different heights
}

function  lfo (xx: float): float//
{
return (Math.Abs((Math.Sin(Math.Floor(xx))*.01246)*32718.927)%1)*2-1;
}
 « Last Edit: January 10, 2017, 06:57:07 PM by Mrz00m » Logged
 Pages:    Go Down
 Related Topics Subject Started by Replies Views Last post  Fractal Bat Generator Images Showcase (Rate My Fractal) Kali 0 1139 August 05, 2011, 03:54:00 AM by Kali  sculpt generator Mandelbulb3D Gallery ericr 1 210 March 22, 2012, 05:58:31 PM by bib  @jesse - save formula as new formula ?! feature request cKleinhuis 0 1281 October 10, 2012, 05:43:14 PM by cKleinhuis  Weirdness Generator Mandelbulb3D Gallery 1Bryan1 0 573 March 28, 2016, 05:37:40 AM by 1Bryan1  Generator Images Showcase (Rate My Fractal) darnoldduck 0 429 June 24, 2016, 06:20:15 AM by darnoldduck