Patryk Kizny
|
|
« Reply #45 on: April 16, 2016, 08:58:27 PM » |
|
Two notes on that. I based my work on Kn2 raytracer and I think that there was already a problem with reflections there. I am aware of the fact that when I added all my features it could have gotten worse. I did not debug for reflections.
As for glossiness of materials on reflections - I think the problem is not the very jitter function but rather how environment is sampled and how the ray is reflected. Of top off my mind.
I am happy you're playing with all this.
|
|
|
Logged
|
Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
|
|
|
Crist-JRoger
|
|
« Reply #46 on: April 26, 2016, 10:08:19 PM » |
|
materials+texturing+hmapping
|
|
|
Logged
|
|
|
|
Patryk Kizny
|
|
« Reply #47 on: April 29, 2016, 07:59:56 PM » |
|
Inspiring. What fractal is that? What's actually textured here? Can you share frag & maps?
|
|
|
Logged
|
Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
|
|
|
Crist-JRoger
|
|
« Reply #48 on: April 29, 2016, 09:19:20 PM » |
|
Don't you recognize ? That's standard mandelbulb ) I got last Knighty's DE with terrain and better AO, added more terrains from your terrain generator, added texturing for terrain and simple mapping as M Benesi code in his smooth menger experiments. And M Benesi palette, it looks much better than standard. If you want the same render, here is texrure I used http://ftourini.deviantart.com/art/tileable-stone-wall-texture01-217328604p.s. I working in original version of Frag, because i go out of range in sliders very often and very far I got different renders when used original 3D+buffershader and yours. I saw - you cut tonemapping code from buffershader to 3D.frag. Is that right?
|
|
|
Logged
|
|
|
|
Patryk Kizny
|
|
« Reply #49 on: April 29, 2016, 09:24:58 PM » |
|
Don't you recognize ? That's standard mandelbulb ) I got last Knighty's DE with terrain and better AO, added more terrains from your terrain generator, added texturing for terrain and simple mapping as M Benesi code in his smooth menger experiments. And M Benesi palette, it looks much better than standard. If you want the same render, here is texrure I used http://ftourini.deviantart.com/art/tileable-stone-wall-texture01-217328604p.s. I working in original version of Frag, because i go out of range in sliders very often and very far I got different renders when used original 3D+buffershader and yours. I saw - you cut tonemapping code from buffershader to 3D.frag. Is that right? Yes, at some point I moved the post part from shader to 3d. There was some reason for it but actually I was just thinking yesterday if I can move it back Anyways, you should be using a full package of files from me (changes were across the range of files). In my latest version, there are reflection environments per material and much more cool stuff. Plan on adding glossiness adjustments for reflections also. This raytracer is getting really refined! Next step is adding motion blur (but that will work only under synthclipse if I do it).
|
|
|
Logged
|
Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
|
|
|
Crist-JRoger
|
|
« Reply #50 on: April 29, 2016, 09:53:34 PM » |
|
I checked your changes with original De-Kn2. And if you do not mind I will use only your "materials feature" with my version of renderer ) Glossiness looks good for textured plane. So I wait any updates too
|
|
|
Logged
|
|
|
|
Patryk Kizny
|
|
« Reply #51 on: May 10, 2016, 02:56:28 AM » |
|
Guys, I need a bit of help. I am trying to implement proper glossiness parameter for reflections. Essentially I am tackling into the reflections loop. After calculating color, the ray is reflected (bounced) off the last surface and we enter the next trace loop. At this stage I have a ray, hitpoint and of course normal. Now the simplest glossiness could be implemented by adding a random bias vector to the bounced ray direction. Bias 0 = fully glossy reflections. But this is not a proper way of doing it and produces ugly results.
A better solution seem to be sampling a random direction vector in the cone which axis the same as ray.direction vector. Or, in other words, finding a uniformly distributed sample on a circle that is perpendicular to reflected ray.direction and using it as a bias vector.
And I am getting a bit stuck here - can you help me find a fast and reasonable way of implementing it? Something elegant? I would like to avoid converting to spherical coordinates and back as it seems redundant.
Perhaps it's trivial, but can't find to seem a compact solution myslef nor google anything simple. Thanks!
|
|
|
Logged
|
Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
|
|
|
hobold
Fractal Bachius
Posts: 573
|
|
« Reply #52 on: May 10, 2016, 10:23:18 AM » |
|
Or, in other words, finding a uniformly distributed sample on a circle that is perpendicular to reflected ray.direction and using it as a bias vector.
just some observations that might help clearing the obstacle: 1. the disk to be sampled lies on a plane perpendicular to the reflected direction => reflected direction vector is that plane's normal vector 2. a reasonable 2D coordinate system on that plane can be constructed like this: find normal vector's component of smallest magnitude and compute the cross product of the normal vector with the unit vector of the respective axis to get a local coordinate axis on the plane (this computation can be optimized due to all the zeros in the axis vector). Another cross product delivers the other local coordinate axis on the plane. The problem is now reduced to 2D. See, for example, http://mathworld.wolfram.com/DiskPointPicking.html
|
|
|
Logged
|
|
|
|
Crist-JRoger
|
|
« Reply #53 on: May 11, 2016, 11:31:40 AM » |
|
interesting... I see that this math used in DoF calculating for bokeh: vec2 uniformDisc(vec2 co) { vec2 r = rand2(co); return sqrt(r.y)*vec2(cos(r.x*TWO_PI),sin(r.x*TWO_PI)); } If I want to paint only a circle around disk, how it will look mathematically? Like this:
|
|
|
|
lycium
|
|
« Reply #54 on: May 11, 2016, 12:00:03 PM » |
|
You could try using r = 1 - pow(u, exponent) instead of r = sqrt(u), higher exponent pushes points to the edge
|
|
|
Logged
|
|
|
|
Crist-JRoger
|
|
« Reply #55 on: May 11, 2016, 12:43:05 PM » |
|
Thank you very much for quick answer! But stupid question - what is " u" in your formula?
|
|
|
Logged
|
|
|
|
lycium
|
|
« Reply #56 on: May 11, 2016, 12:48:28 PM » |
|
Corresponds to "r.y" in your code, a uniform random variable in [0,1).
|
|
|
Logged
|
|
|
|
Crist-JRoger
|
|
« Reply #57 on: May 11, 2016, 01:12:46 PM » |
|
It works! Have some excess poins... strange I tried to find the way for adding more bokeh, more than calculates in existing raytracerupd: This looks little better, but still excess poins r = pow((1-pow(u,exponent)), 1/exponent)
|
|
|
|
lycium
|
|
« Reply #58 on: May 11, 2016, 01:27:27 PM » |
|
Are you using the sin-based "random number generator"? It's extremely non-uniform, maybe sometimes returns NaNs, who knows... /spoilt OpenCL programmer
|
|
|
Logged
|
|
|
|
Crist-JRoger
|
|
« Reply #59 on: May 11, 2016, 01:33:15 PM » |
|
Yes, all frags uses sin-based RNG by default. I'll check with Wang hash, later.. my working PC doesn't support 4 shaders Thank you for help!
|
|
|
Logged
|
|
|
|
|