POV-Ray : Newsgroups : povray.advanced-users : Seamless water textures : Seamless water textures Server Time
28 Jul 2024 12:31:22 EDT (-0400)
  Seamless water textures  
From: David Wallace
Date: 12 Jul 2005 10:04:17
Message: <42d3cde1@news.povray.org>
Am I doing something wrong, or just not going far enough?

<code>
#declare _aspect = image_height/image_width;
#declare _size = 175;

global_settings {
	number_of_waves 35
	assumed_gamma 1.0
}

camera {
   orthographic
   location <0,0,-90>    // position & direction of view
   look_at  <0,0,0>
   right _size*x            // horizontal size of view
   up _aspect*_size*y               // vertical size of view
}
#declare ptLiq1 = function { pattern { waves turbulence 0.86 scale 134 } }
#declare ptLiq2 = function { pattern { ripples turbulence 0.41 scale 54 } }
#declare ptLiquid = function { pow(ptLiq1(x,y,z),.6)*13.0 -
	pow(ptLiq2(x,y,z),1.4)*5.5 }
#macro gridLiquid(rd,sz)
	function { (
	#local to = 0;
	#local xp = -rd;
	#while (xp<=rd)
		#local yp = -rd;
		#while (yp<=rd)
			ptLiquid(x+xp*sz,y+yp*sz,z)
			#if (xp<rd | yp<rd) + #end
			#local yp = yp + .25;
		#end
		#local to = to + 1;
		#local xp = xp + .25;
	#end
	)/to }
#end
			
#declare texLiquid = texture {
	pigment {
		gridLiquid(3,_size)
		triangle_wave
		color_map {
			[ 0.05 rgb <0.000,0.000,0.000> ]
			[ 0.08 rgb <0.000,0.076,0.324> ]
			[ 0.23 rgb <0.000,0.231,0.479> ]
			[ 0.46 rgb <0.118,0.423,0.763> ]
			[ 0.70 rgb <0.213,0.459,1.000> ]
			[ 0.99 rgb <0.654,1.000,1.000> ]
		}
		phase clock
	}
	finish {
		ambient 1
		diffuse 0
	}
}

box { -.5,.5 scale _size texture { texLiquid } }
</code>

The idea is to create an animated seamless liquid texture that I can import into 
a game.  I don't want to fool with post-processing, which would create less than 
perfect results anyway: I am seeking an all-POV solution.  The code above comes 
pretty close, but I can still detect seams when I tile the image.

Any suggestions?
--------------
David Wallace
TenArbor Consulting
"Just In Time Cash"
www.tenarbor.com
1-866-572-CASH


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.