Material Database

View Source

<?xml version="1.0" encoding="utf-8"?>
<scenedata>
	<material>
		<name>scratched-metal</name>
		<phong>
			<diffuse_albedo>
				<constant>
					<rgb>
						<rgb>
							0.5 0.5 0.5
						</rgb>
						<gamma>2.2</gamma>
					</rgb>
				</constant>
			</diffuse_albedo>
			<exponent>
				<constant>
					500
				</constant>
			</exponent>
			<bump>
				<shader>
					<shader><![CDATA[def scratchcoords( vec2 pos ) vec2 :
	vec2(  7. * ( doti ( pos  )  + noise(pos*0.1)) , 200. * ( dotj ( pos  ) + noise( pos*0.2) ) )

def rotmat ( real x, real y) mat2x2 :
	mat2x2( x, y, 0. - y, x)


def scratchvec(real x, real y) real :
	min ( 0. , 
		0.5 + fbm (  scratchcoords(rotmat(x,y) * ( getTexCoords(0) + vec2(x,y) )  ), 5 ) )

def eval() real :
	0.00005 * (	scratchvec(1.0,0.0)
			+ scratchvec(0.9,0.3)
			+ scratchvec(-0.707,0.707)			
			+ scratchvec(0.1,0.95)
			+ scratchvec(-0.75,0.6)
			+ scratchvec( -0.5 ,0.8 )
			+ scratchvec( -0.51 ,0.85 )
			+ scratchvec( 0.57 ,0.82 )
			+ scratchvec( -0.43 ,0.90 )
			+ scratchvec( 0.98 , -0.19 )
		     )]]></shader>
				</shader>
			</bump>
			<layer>0</layer>
			<fresnel_scale>1</fresnel_scale>
			<ior>1.4</ior>
			<nk_data>nkdata/Al.nk</nk_data>
		</phong>
	</material>

</scenedata>

-->