- April 19, 2021, 06:04:01 PM
|
||||||
Refracted Apollonian | ||||||
![]() |
||||||
Previous Image | Next Image | ||||||
Description: Experiment with the refract() function In the ray marching routine: 1. Determine ray direction for the current pixel is usual. 2. calculate the pixel to camera distance, pixel position and normal as usual. 3. Memorize this pixel position. 4. Update the ray direction: direction = refract(direction,normal, param1); 5. Move the camera to pixel position + direction * 3 // offset the position to ensure the new ray is walked a little 6. walk ray in new refracted direction to new pixel position 7. final position = mix(original pixel position, new pixel position, param2); In the attached image I used the the Apollonian algorithm with param1 (amount of refraction) = 1.047 param2 (position mixer ratio) = 0.92 ---------------------------------------------------------- Apollonian algorithm presented here: https://www.shadertoy.com/view/4ds3zn CPU --------------------- control.maxSteps = 5 control.multiplier = 21.400024 control.foam = 0.6999993 control.foam2 = 2.3999999 control.bend = 0.0211 // GPU ------------------- float DE(float3 pos,device Control &control,thread float4 &orbitTrap) { float k,t = control.foam2 + 0.25 * cos(control.bend * PI * control.multiplier * (pos.z - pos.x)); float scale = 1; for(int i=0; i< control.maxSteps; ++i) { pos = -1.0 + 2.0 * fract(0.5 * pos + 0.5); k = t / dot(pos,pos); pos *= k * control.foam; scale *= k * control.foam; orbitTrap = min(orbitTrap, float4(abs(pos), dot(pos,pos))); } return 1.5 * (0.25 * abs(pos.y) / scale); } Stats: Views: 123 Total Favorities: 0 View Who Favorited Filesize: 4.53MB Height: 1484 Width: 1800 Keywords: refract Posted by: kosalos ![]() Rating: ![]() ![]() ![]() ![]() Total Likes: 2 Image Linking Codes
|
||||||
0 Members and 1 Guest are viewing this picture. |
Caleidoscope | November 10, 2020, 02:43:24 PM Really very nice indeed. ![]() ![]() |
Powered by SMF Gallery Pro