surface
AQSIS_V 1.1.0


segment Data

USES 522587

varying  color screen::B
varying  color screen::W
varying  color screen::R
varying  color mydiffuse::C
varying  float mydiffuse::shad
param uniform  float Ka
param uniform  float Kd
param uniform  float oil
param uniform  string colortexture
param uniform  string ssstexture
param uniform  string spectexture
param uniform  string roughtexture
param uniform  string alphatexture
param uniform  float poresdensity
param uniform  float sss
param uniform  float melanin
varying  normal Nf
varying  color skin_color
varying  float sss_value
varying  float roughness
varying  float f
varying  float specularity
varying  vector Vf
varying  float ill
varying  color Lambert
varying  color glancing_highlight
varying  color _2$screen::B


segment Init
	pushif 1
	pop Ka
	pushif 2
	pop Kd
	pushif 1
	pop oil
	pushis ""
	pop colortexture
	pushis ""
	pop ssstexture
	pushis ""
	pop spectexture
	pushis ""
	pop roughtexture
	pushis ""
	pop alphatexture
	pushif 100
	pop poresdensity
	pushif 1.5
	pop sss
	pushif 1.5
	pop melanin


segment Code
	pushv I
	pushv N
	normalize
	faceforward
	pop Nf
	pushv Cs
	pop skin_color
	pushv P
	pushv poresdensity
	mulfp
	noise3
	pop f
	pushv I
	normalize
	negp
	pop Vf
	pushif 0
	pop ill
	pushv Os
	pop Oi
	S_CLEAR
	pushis ""
	pushv colortexture
	ness
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 0
	pushif 0
	pushv colortexture
	pushif 0
	ctexture1
	pop skin_color
:0
	RS_POP
	S_CLEAR
	pushis ""
	pushv roughtexture
	ness
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 1
	pushif 0
	pushv roughtexture
	pushif 0
	ftexture1
	pop roughness
:1
	RS_POP
	S_CLEAR
	pushis ""
	pushv ssstexture
	ness
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 2
	pushif 0
	pushv ssstexture
	pushif 0
	ftexture1
	pop sss_value
:2
	RS_POP
	S_CLEAR
	pushis ""
	pushv spectexture
	ness
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 3
	pushif 0
	pushv spectexture
	pushif 0
	ftexture1
	pushv f
	mulff
	pop specularity
:3
	RS_POP
	S_CLEAR
	pushis ""
	pushv alphatexture
	ness
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 4
	pushif 0
	pushv alphatexture
	pushif 0
	ctexture1
	pop Oi
:4
	RS_POP
	pushif 0.3
	setfc
	pushv Nf
	diffuse
	pushif 0
	cmin
	pop Lambert
	pushv sss
	setfc
	pushif 0
	setfc
	pop mydiffuse::C
	pushif 0
	pop mydiffuse::shad
	S_CLEAR
	pushif 1
	pushis "__onlyshadow"
	lightsource mydiffuse::shad
	eqff
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 5
	pushif 1
	pop mydiffuse::shad
:5
	RS_POP
	pushv Nf
	pushv P
	init_illuminance2
	jz 7
:6
	S_CLEAR
	pushif 3.14159
	pushv Nf
	pushv P
	pushis ""
	illuminance2
	S_JZ 8
	RS_PUSH
	RS_GET
	S_CLEAR
	pushif 1
	pushv mydiffuse::shad
	neff
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 10
	pushif 1.5
	setfc
	pushv Cl
	mulcc
	pushv mydiffuse::C
	addcc
	pop mydiffuse::C
:10
	RS_JNZ 9
	RS_INVERSE
	pushv Cl
	pushif 1
	subfc
	pushv mydiffuse::C
	subcc
	pop mydiffuse::C
:9
	RS_POP
	RS_POP
:8
	advance_illuminance
	jnz 6
:7
	pushv mydiffuse::C
	mulcc
	pop _2$screen::B
	pushif 1
	pushif 1
	pushif 1
	settc
	pop screen::W
	pushv _2$screen::B
	pushv screen::W
	subcc
	pushv Lambert
	pushv screen::W
	subcc
	mulcc
	pushv screen::W
	subcc
	pop screen::R
	pushv screen::R
	pushv Kd
	setfc
	pushv skin_color
	mulcc
	mulcc
	pop Ci
	pushif 1
	pushv Ci
	comp
	pushif 0.6
	pushv Nf
	pushv Vf
	dotpp
	divff
	pushif 1
	subff
	mulff
	pushif 0
	pushif 0
	max
	setfc
	pop glancing_highlight
	pushv glancing_highlight
	pushv Ci
	addcc
	pop Ci
	pushv sss_value
	pushif 1
	subff
	pushif 1
	pushif 1
	pushv Lambert
	comp
	pushif 1
	subff
	subff
	pushif 250
	pow
	mulff
	setfc
	pushv Ci
	subcc
	pop Ci
	pushv melanin
	setfc
	pushv Ci
	divcc
	pop Ci
	pushv Oi
	pushv Ci
	mulcc
	pop Ci
	pushv roughness
	pushv I
	normalize
	negp
	pushv Nf
	specular
	pushv specularity
	pushv oil
	mulff
	mulfc
	ambient
	pushv Ka
	setfc
	pushv Cs
	pushv Os
	mulcc
	mulcc
	mulcc
	addcc
	pushv Ci
	addcc
	pop Ci
