#!version 1.3.15
surface
#!parameters:
float	eta	=	1.5
float	Ka	=	1
float	Kd	=	1
float	Ks	=	1
float	roughness	=	0.5
#!variables:
vector	R
vector	T
vector	In
float	Kr
float	Kt
float	temporary_0
boolean	temporary_1
float	temporary_2
float	temporary_3
uniform	float	temporary_4
vector	temporary_5
vector	temporary_6
vector	temporary_7
#!Init:
	return            
#!Code:
	normalize	("v=v")  N  N 
	normalize	("v=v")  In  I 
	dot               	temporary_2 I N
	vufloat            temporary_3 0
	flt               	temporary_1 temporary_2 temporary_3
	if                	temporary_1 #!Label9
	divff             	temporary_4 1 eta
	vufloat            temporary_0 temporary_4
#!Label9:
	else              	#!Label10
	vufloat            temporary_0 eta
#!Label10:
	endif             
	fresnel	("o=vvfFFVV")  In  N  temporary_0  Kr  Kt  R  T 
	dot               	temporary_0 In N
	vufloat            temporary_2 0
	flt               	temporary_1 temporary_0 temporary_2
	if                	temporary_1 #!Label11
#!Label11:
	endif             
	vufloat            temporary_0 0.01
	fgt               	temporary_1 Kr temporary_0
	if                	temporary_1 #!Label13
	vfromf            	temporary_6 Kr
	trace	("c=pv")  temporary_7  P  R 
	mulvv             	temporary_5 temporary_6 temporary_7
	addvv             	Ci Ci temporary_5
#!Label13:
	endif             
	vufloat            temporary_0 0.01
	fgt               	temporary_1 Kt temporary_0
	if                	temporary_1 #!Label15
	vfromf            	temporary_6 Kt
	trace	("c=pv")  temporary_7  P  T 
	mulvv             	temporary_5 temporary_6 temporary_7
	addvv             	Ci Ci temporary_5
#!Label15:
	endif             
	mulvv             	Ci Ci Os
	movevv            	Oi Os
	return            

