tryptophan
|
|
« 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
|
|
« 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 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
|
|
« 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: 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: if (floorHit) { vec4 floorTex = texture2D(sInput2,hit.xz*2); //vec4 floorTex = texture2D(sInput2,hit.xz*FloorTexScale); hitColor = vec4(FloorColor.rgb*floorTex.rgb,0); }
|
|
|
Logged
|
|
|
|
Kali
|
|
« 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: or 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: 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
|
|
« 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
|
|
« 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.
|
|
|
Logged
|
|
|
|
|
Kali
|
|
« 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
|
|
|
Logged
|
|
|
|
tryptophan
|
|
« 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
|
|
« 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
|
|
« 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. 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 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
|
|
« 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
|
|
« 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 upd2.: rotate works and texturing works, but displace don't when i write I see just half of plane when i write i see two planes: one rotated - mine plane. and second plane... how show only first...
|
|
« Last Edit: September 18, 2015, 07:46:05 PM by Crist-JRoger »
|
Logged
|
|
|
|
cKleinhuis
|
|
« 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
|
|
|
Logged
|
---
divide and conquer - iterate and rule - chaos is No random!
|
|
|
Crist-JRoger
|
|
« Reply #14 on: September 18, 2015, 07:48:16 PM » |
|
@cKleinhuis, thank you! I will try to translate what you say...
|
|
|
Logged
|
|
|
|
|