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
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..