Logo by bib - 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. April 18, 2024, 03:24:58 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   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: texture and displace the floor using the Kaliset  (Read 5255 times)
0 Members and 1 Guest are viewing this topic.
tryptophan
Safarist
******
Posts: 86


« on: April 16, 2013, 10:17:57 PM »

Hi I'm attempting to texture and displace the floor in DE-Raytracer-v0.9.1 in Fragmentarium using the Kaliset. So far I've been able to texture (color) the floor easily sampling a texture map within the trace function where it tests for a floor hit. With this method though I either need a gigantic texture or it has to be mirrored and repeated.

So the then I've attempted to use the Kaliset to color the floor and displace it. I've tried implementing it with his instruction within the DEF function but it doesn't seem to be working properly and is distorted. Also even if I am able to displace the floor with the Kaliset I'm not sure how to apply it to the floor color because in the function that is coloring the floor p is not available?

Any recommendations?

thanks
Keith
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #1 on: April 16, 2013, 11:03:56 PM »

So you are quite active that is very nice
i can.not give you any hint 

A picture of the distortionon would be helpful

generally speaking about the displacement then you would have to adjust the de for the ground plane and qhen talking about this you are back at a straight fractal surface smiley

So back to the dynamic endless ground plane texture, if you have a texture coordinate already you should have everything for obtaining a non stretched colormapping so give us a pic

Logged

---

divide and conquer - iterate and rule - chaos is No random!
tryptophan
Safarist
******
Posts: 86


« Reply #2 on: April 16, 2013, 11:24:37 PM »

Hi Christian thanks for tips. I'm closer now but still having a few of problems. The first is that the texture is not texturing the whole plane. The next one is that now this is displacing the surface, the surface is now transparent in areas ( the white areas shouldn't be there, this the color photoshop assigns to a background when there is an alpha channel. Finally the normals aren't being adjusted which I've attempted to fix but with no success yet. Below is the code and and some images

for displacement:
Code:
float DEF(vec3 p) {
float d = DE(p);

if (EnableFloor) {
float k = Kaliset(p);
float sc = 1.0 + k * kDisp;
p *= sc;
floorDist = abs(dot(floorNormal,p)-FloorHeight)/sc;
if (d<floorDist) {
fSteps++;
return d;
}  else return floorDist;
  } else {
fSteps++;
return d;

}
}

float DEF2(vec3 p) {
if (EnableFloor) {
float k = Kaliset(p);
float sc = 1.0 + k * kDisp;
p *= sc;
floorDist = abs(dot(floorNormal,p)-FloorHeight)/sc;
return min(floorDist, DE(p));
  } else {
return DE(p);
}
}

Also it seems I need to call the Kaliset function twice to calculate shadows (DEF2) I'm also wondering if there is a way to avoid that?

for coloring with texture bu not sure how to color with Kaliset:
Code:
if (floorHit) {
vec4 floorTex = texture2D(sInput2,hit.xz*2);
//vec4 floorTex = texture2D(sInput2,hit.xz*FloorTexScale);

hitColor = vec4(FloorColor.rgb*floorTex.rgb,0);
}



* Preset2_2013_4_16_14_9_39.jpg (69.65 KB, 640x360 - viewed 324 times.)

* Preset2_2013_4_16_14_10_3.jpg (70.7 KB, 640x360 - viewed 334 times.)

* Preset2_2013_4_16_14_10_12.jpg (38.92 KB, 640x360 - viewed 354 times.)
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #3 on: April 17, 2013, 12:41:00 AM »

Hi tryptophan!

Try returning "d/sc" instead of "d" if using the scale displacement method.

But I've found it's better to use the Kaliset to directly distort the distance estimation this way:

Code:
d-=Kaliset(p)*kDisp;

or

Code:
d+=Kaliset(p)*kDisp;

About the set not filling the plane, it fills it but at different scales, so the more far from center, the values vanish for the current iteration number. Maybe you would want to try some tiling (but how to make it continuous?), or adjust the zoom by scaling the vector you pass to the Kaliset function, so the patterns fills at least the parts you want to be textured.

And for the coloring, you must use the return value of the Kaliset function as a color index of a coloring palette.

You can use this for 3 color palette:

http://www.fractalforums.com/fragmentarium-b210/coloring-add-on-t14522/

or if you want more colors you can use this I implemented on my NODE-Raytracer:

Code:

uniform vec3 BaseColor; color[1.0,1.0,1.0]
uniform float ColoringMix; slider[0,.5,1]
uniform float ColorDensity; slider[0,1,10]
uniform float ColorOffset; slider[0,0,1]
uniform vec3 Color1; color[1.0,0.0,0.0]
uniform vec3 Color2; color[0.0,1.0,0.0]
uniform vec3 Color3; color[0.0,0.0,1.0]
uniform vec3 Color4; color[1.0,0.5,0.5]
uniform vec3 Color5; color[0.5,0.1,0.5]
uniform vec3 Color6; color[0.5,0.5,1.0]

#define PI  3.141592

vec3 getcolor(float index) {
float cx=index*ColorDensity+ColorOffset*PI*6;
vec3 col;
float ps=PI/3;
float f1=max(0,sin(cx)-.5)/.5;
float f2=max(0,sin(cx+ps)-.5)/.5;
float f3=max(0,sin(cx+ps*2)-.5)/.5;
float f4=max(0,sin(cx+ps*3)-.5)/.5;
float f5=max(0,sin(cx+ps*4)-.5)/.5;
float f6=max(0,sin(cx+ps*5)-.5)/.5;
col=mix(Color1,Color2,f1);
col=mix(col,Color3,f2);
col=mix(col,Color4,f3);
col=mix(col,Color5,f4);
col=mix(col,mix(Color6,Color1,f6),f5);
col=mix(BaseColor,col,ColoringMix);
return col;
}

Also it's more accurate for the gradients than the rotate method of my first script.

Logged

tryptophan
Safarist
******
Posts: 86


« Reply #4 on: April 17, 2013, 01:12:46 AM »

Hi Kali! thanks for the tips. I was going to ask you a question or two on your Kaliset thread but you found this anyways. BTW great formula there is a whole world in it.

Yes I found adding the Kaliset to p works better than scaling p. Now after doing that the function is working better although still not perfectly. It's still opening up the plane so there are holes in it. It is working perfectly though on object inside of the DE function. So next I'm going add a plane to that function to see how well it works.

Oh yeah I was thinking if I needed to tile it to get it to extend to infinity that I could fold it so it mirrored. (like I'm doing already for the sampled texture but this way it will be dynamic and much larger than any reasonably sized texture)

For the coloring - thanks a lot. I'll be checking that method out for sure - I've been able to learn tons from your formulas.

Also I've been interested in checking your new NODE- raytracer. I'll have to get on that one next.

thanks for the tips.
cheers
Keith
Logged
tryptophan
Safarist
******
Posts: 86


« Reply #5 on: April 17, 2013, 01:22:08 AM »

So it looks like its work quite well on my own plane just not on the DE-Raytracers floor plane. Not sure why yet but this could work for now. Although I can't have separate coloring systems this way.



* Preset2_2013_4_16_16_18_51.jpg (223.41 KB, 1280x720 - viewed 340 times.)
Logged
tryptophan
Safarist
******
Posts: 86


« Reply #6 on: April 17, 2013, 09:09:17 AM »

So I have tiling working decently on the Kaliset displacing and coloring my own plane infinitely. I've posted a few images here:
http://www.fractalforums.com/images-showcase-(rate-my-fractal)/hdr-lighting-and-kaliset-displacement-experiments/

Still haven't been able to get the floor plane to displace or texture properly. I'll have to leave that one for another day. It would be nice though because then you could use two different diplacement/coloring formulas - 1 for the floor and the other for the main object.
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #7 on: April 22, 2013, 04:13:57 AM »

I forgot to mention... try giving the plane some thickness: floorDist = abs(dot(floorNormal,p)-FloorHeight)-.1;

And about adding the displacement to p, instead of I meant to add/substract from d (distance estimation) directly. Adding to p makes the displacement to one direction only, buy modifying the distance, the displacement is made on the normal direction wink
Logged

tryptophan
Safarist
******
Posts: 86


« Reply #8 on: April 22, 2013, 05:42:50 AM »

Ah thanks for the tips Kali. I'll try both those out asap. I thought the dispacement wasn't working too well on my objects if I displaced it to much it would visibly not displace along the normal. Once I get it going I'll let you know how it goes.

BTW is possible to use your NODE-Raytracing without the buffer like the original DE-Raytracer? I found coming up with a method to do animation by having to render the same frame multiple times is really tricky.

thanks again for the help
cheers
Keith
Logged
Kali
Fractal Supremo
*****
Posts: 1138


« Reply #9 on: April 22, 2013, 12:02:07 PM »

BTW is possible to use your NODE-Raytracing without the buffer like the original DE-Raytracer? I found coming up with a method to do animation by having to render the same frame multiple times is really tricky.

No, sorry, the rendering technique needs some frames, as it's not using any distance estimation at all, and have to find all the parts by varying the raysteps. Some objects needs little frames, though, but this raytracer was intended mainly for still images, and for rendering formulas without a distance estimator, as the brute-raytracer but with more options.
If you are interested on the volumetric rendering thing (my last image), I'm planning to add this and other effects to a realtime distance-estimated renderer, I'll let you know when it's done.
Logged

Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #10 on: September 15, 2015, 01:04:01 PM »

Hi. Need help, because i don't know glsl or other programming...
I created come plane for surface maping and sphere just for example. This plane rotated.
Code:
float surf(vec3 p) {
float sdist = 0.0;
vec3 sdir=normalize(s_Dir);
sdist = abs(dot(sdir,p));
return p;
}

float DE(vec3 pos) {
float d = length(pos+vec3(0.0,0.0,-0.25))-0.25;
return min(surf(pos), d);
}

So now i want to add kaliset to this plane without sphere, but i don't know how...
How rotate plane with kaliset together?
For surface mapping i used this
Code:
float k = Kaliset(p);
orbitTrap=vec4(1,1,1,1)*(k*ColorScale+ColorOffset);
float sc=k*Strength; p+=vec3(sc,sc,sc);
Logged

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



kizny
WWW
« Reply #11 on: September 16, 2015, 05:44:15 PM »

If you want to reorient the scene, just transform the z input vector on main DE function.
Logged

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



WWW
« Reply #12 on: September 18, 2015, 06:40:55 PM »

If you want to reorient the scene, just transform the z input vector on main DE function.
I don't know how to do that.

upd.: I done! Just needed to wrie this
Code:
p=sdist;
embarrass

upd2.: rotate works and texturing works, but displace don't  head batting
when i write
Code:
p+=sdist;
I see just half of plane  cry sad
when i write
Code:
p*=sdist;
i see two planes: one rotated - mine plane. and second plane... how show only first...  cry
« Last Edit: September 18, 2015, 07:46:05 PM by Crist-JRoger » Logged

cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #13 on: September 18, 2015, 07:44:03 PM »

what patrik mean was exact this, modify the "p" input vector

transforming the input vector p of a DE(vec3 p) function can be done in several ways, multiplying it by a constant number scales it, adding a 3d vector shifts it, for rotation you need to multiply it with a 3x3 rotation matrix, code for that shall be found in the includes for the math functions wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Crist-JRoger
Fractal Fertilizer
*****
Posts: 389



WWW
« Reply #14 on: September 18, 2015, 07:48:16 PM »

@cKleinhuis, thank you! I will try to translate what you say...
Logged

Pages: [1] 2   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Ocean Floor Images Showcase (Rate My Fractal) Fractal Ken 0 712 Last post January 03, 2011, 06:13:40 AM
by Fractal Ken
Kaliset 3D fractal used as coloring & texture for DE systems 3D Fractal Generation « 1 2 » Kali 17 12644 Last post September 14, 2015, 03:57:37 PM
by Crist-JRoger
Kaliset coloring and texture feature request PhotoComix 2 1333 Last post July 21, 2012, 10:01:49 PM
by PhotoComix
Mandelboxed floor Images Showcase (Rate My Fractal) VanlindtMarc 1 770 Last post July 27, 2013, 03:04:36 AM
by C.K.
Forest Floor 44 Mandelbulber Gallery mclarekin 1 629 Last post April 08, 2014, 09:43:14 PM
by youhn

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.168 seconds with 25 queries. (Pretty URLs adds 0.011s, 2q)