Logo by JosLeys - 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 us on facebook
 
*
Welcome, Guest. Please login or register. March 29, 2024, 06:28: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]   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: Spherical Texture Fold  (Read 4556 times)
0 Members and 1 Guest are viewing this topic.
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« on: July 12, 2011, 01:47:13 PM »

Hello,

Here is a little idea that I got while coding Incendia bump maps:

The classic mandelbox consist in an box fold and a sphere fold.
I have tweaked a little the sphere fold so in every iteration it can modify the folding by sampling a bump map.
This was done by transforming the actual point into spherical coordinates and converting it into u,v coordinates for a bump map.
Then, the value of the bump map is multiplied by the actual sphere-fold radius calculation.
This procedure texture the sphere walls of the box. It needs optimizations (such as texture interpolations and a better optimized optimization), but it lets you to decorate box interiors with what you have on the texture map.
Obviously, sphere texture maps works better than square ones, but they are hard to find.

Anyways, here is a simple example:
BMap is a bump map array stored in the memory, it is unsigned char and has a (BSizeX, BSizeY) size
The strength factor is 0.05
 
Code:
bool Texture_MBox(float x, float y, float z,int Iter){
//do not start with (0,0,0) because it will give error on the bump map calculation
const float nx=x;
const float ny=y;
const float nz=z;
int ic;
bool escape=false;

for (ic=0;ic<Iter;ic++){
if(x>1)x=2-x;
else
if(x<-1)x=-2-x;

if(y>1)y=2-y;
else
if(y<-1)y=-2-y;

if(z>1)z=2-z;
else
if(z<-1)z=-2-z;

//Spherical Texture Fold
 const float mag = 1/sqrt(x*x+y*y+z*z);  
 const float vx = x*mag;
 const float vy = y*mag;
 const float vz = z*mag;
 const int fxpos=((atan2(vx,vz)/3.14159265358979323846)*0.5+0.5)*BSizeX;//texture width
 const int fypos=((asin(vy)/1.5707963267948966192313216916398)*0.5+0.5)*BSizeY; //texture height
 const float bvalue=(float)(BMap[BSizeX*fypos+fxpos])*0.003921568627450980392156862745098; //(texture data)*(1/255)
 const float vm=sqrt(x*x+y*y+z*z)*(1+bvalue*0.05); //strength=0.05

//const float vm=sqrt(x*x+y*y+z*z); //classic mandel box

if(vm<0.05){
x*=4;
y*=4;
z*=4;
} else
if(vm<1){
const float vsq=vm*vm;
x/=vsq;
y/=vsq;
z/=vsq;
}
x=x*2+nx;
y=y*2+ny;
z=z*2+nz;
if ((x*x+y*y+z*z)>3600) break;
}
if(ic<Iter)escape=false;else escape=true;
return escape;
}



I have include two very crude renders using a low resolution skull texture and another with a NASA spherical moon texture.


ps. Zooming in a skull decorated mandelbox its a little creepy, better to decorate it with some Egyptian hieroglyphs.. smiley



* SkullBox.jpg (213.83 KB, 800x800 - viewed 519 times.)

* MoonMap.jpg (234.47 KB, 800x800 - viewed 546 times.)
« Last Edit: July 12, 2011, 02:00:39 PM by Aexion » Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #1 on: July 13, 2011, 12:28:33 AM »

That is really cool!

I have to add a pointer for formulas to call a map function,
and a rgb or vec(x,y,z) return value should offer plenty of possibilities  smiley
 A Beer Cup
Logged
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #2 on: July 13, 2011, 12:12:54 PM »

Just some simple ideas for this:
1. For low resolution maps, interpolations (unless you want large square blocks..)
2. The surface color can come from the last iteration texture sampling
3. Put graffiti on your fractal walls..
4. If the texture (or bump map) color is 0 break the iteration loop early, so it becomes a hole..
5. Do not put banner ads on your fractal walls ("if you like this fractal, buy etc,etc,etc...")..

smiley




Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #3 on: July 13, 2011, 07:58:39 PM »

Ahhh another crazy striking idea! cheesy
You are incredible cheesy
I am developin new formulas but internet is hard to use. hopefully cqn upload stuff soon with my pocketpc! sad
Logged

No sweat, guardian of wisdom!
Madman
Fractal Molossus
**
Posts: 678



« Reply #4 on: July 13, 2011, 07:59:49 PM »

That would be sooooooooh nice. Can't wait for the next M3D update Jesse  grin No pressure intended  wink
Logged

All I want is a warm bed, a kind word and unlimited power (Ashleigh Brilliant)
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #5 on: July 13, 2011, 10:38:35 PM »

Just some simple ideas for this:
1. For low resolution maps, interpolations (unless you want large square blocks..)
2. The surface color can come from the last iteration texture sampling
3. Put graffiti on your fractal walls..
4. If the texture (or bump map) color is 0 break the iteration loop early, so it becomes a hole..
5. Do not put banner ads on your fractal walls ("if you like this fractal, buy etc,etc,etc...")..

smiley

We might regret this option when reading silly stuff everywhere... but we know who to blame  wink

To 4: for a hole you normally have to bailout in escapetime formulas, so it would become solid, if this works...


Ahhh another crazy striking idea! cheesy
You are incredible cheesy
I am developin new formulas but internet is hard to use. hopefully cqn upload stuff soon with my pocketpc! sad

Don't wanted to bother you in your holidays, but since i get you here a wish:
In Box modifications with a power function, could you skip the power calculation on power=1?
This would speedup very much and you could simply copy the code from my ABoxVaryScale formula.
 A Beer Cup A Beer Cup A Beer Cup


And a question to all:
Does anybody know where i can get some fullsphere lightmaps in spherical projection for using it in the program for free?
Would be nice to have some basic ones...



* LightMapBox.jpg (245.36 KB, 800x566 - viewed 507 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #6 on: July 13, 2011, 11:02:07 PM »

In future releases rpow is replaced with inversion power, a big speedup and more variations smiley
Also I fixed a "error" in your planefold and made a sort of origami fold formula, will see soon i hope cheesy
Logged

No sweat, guardian of wisdom!
Jesse
Download Section
Fractal Schemer
*
Posts: 1013


« Reply #7 on: July 15, 2011, 10:07:35 PM »

I encountered a problem with maps and the 4 point DE method:
It seems that the plenty of pixeledges affects the DE strongly, that even a very low stepwidth multiplier can't help.
Without double or more checking and giving the bigger gradients a chance, i fear that mapping works only with analytical DE's.

Attached is a pic with a map translation function and then just bailing out with a power 3 on the veclength function (marble).
The noise can't be really avoided here.

In future releases rpow is replaced with inversion power, a big speedup and more variations smiley

This sounds interesting, i like to see this.  smiley



* LightMapTranslatePlusRpow3.jpg (243.74 KB, 800x800 - viewed 523 times.)
« Last Edit: July 15, 2011, 10:09:09 PM by Jesse » Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Shader 2 coding - render to a texture Programming David Makin 3 2776 Last post January 31, 2011, 03:09:43 AM
by marius
possible bug in v 1.12: black gap in background texture Mandelbulber taurus 4 2062 Last post June 09, 2012, 11:03:50 PM
by taurus
3-fold symmetry Still Frame Kalles Fraktaler 0 1187 Last post May 08, 2014, 05:02:44 PM
by Kalles Fraktaler
Infinitized (Sierpinski) fold using bitwise operators (new) Theories & Research DarkBeam 7 594 Last post February 06, 2015, 12:56:01 AM
by DarkBeam
smooth spherical fold Amazing Box, Amazing Surf and variations mclarekin 1 2866 Last post April 17, 2017, 07:44:19 PM
by DarkBeam

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.131 seconds with 24 queries. (Pretty URLs adds 0.006s, 2q)