specular

Blitz3D Forums/Blitz3D Programming/specular

here you go,... use the same media from the specular demo. The unfortunate thing here is that I have to duplicate the object to create the specular effect, but it works here. I don't know if this will cause z-buffer issues on some cards, but maybe someone can expand on this.


Graphics3D 640,480,0,2
SetBuffer BackBuffer()

box = LoadMesh("teapot.3ds"); load object for texturing

box2 = CopyEntity(box,box) ; create a copy and parent it to the original

; step 1, ... assign the base texture map
basetex = LoadTexture ("base.png")	; base texture map
EntityTexture box,basetex,0,0			; assign base map, channel 0

; step 2 , ... assign an alpha mask to the second box
mask = LoadTexture ("mask.png",2) 	; use texture as alpha
EntityTexture box2,mask,0,0				; assign mask texture box2

; step 3 , make the second box have a shiny specular
EntityShininess box2,1 ;set shininess For the specular part
EntityColor box2,255,128,0 ; color the specular part orange

;set up a camera
cam = CreateCamera ()
PositionEntity cam,0,0,-20
CameraZoom cam,3

light = CreateLight(1)
MoveEntity light,5,10,0 
PointEntity light,box2

While Not KeyHit(1)
	TurnEntity box,.5,.5,.5
	UpdateWorld()
	RenderWorld()
	Flip()
Wend

End