Blitz3D+ Command Reference

EntityShininess entity,shininess#

Parameters

entity - entity handle
shininess# - shininess level, 0 to 1; 0 (default)

Description

Sets the specular shininess of an entity.

Shininess is the bright highlight you see where a light reflects straight off a surface towards the camera. At 0, the default, there is no highlight at all and the surface looks matte - cloth, stone, dirt. Wind it up towards 1 and you get the wet, polished look of metal, glass, snooker balls and armour.

It needs a light to work with: an entity in a scene lit only by AmbientLight will show no highlight however shiny you make it. It also needs geometry to play across, so the effect reads best on smooth, reasonably dense meshes - on a low-poly cube it will just flash the whole face at once.

The highlight moves as the camera and the light move, which is what sells it. A slowly turning shiny object catches the light in a way a flat-coloured one never does, and it costs nothing extra to draw.

This sets the value for the whole entity. For different finishes on different parts of a model - shiny visor, matte suit - use BrushShininess and PaintSurface.

See also: EntityColor, EntityFX, BrushShininess, CreateLight, PaintSurface.

Example

; EntityShininess Example
; -----------------------

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

camera=CreateCamera()
PositionEntity camera,0,1,-5

light=CreateLight()
RotateEntity light,45,45,0

; A shiny pickup coin for our game scene
coin=CreateCylinder()
ScaleEntity coin,1,0.1,1
PositionEntity coin,0,1,0

shine#=0.5

While Not KeyDown(1)

    ; Press + / - to change the shininess
    If KeyDown(13) And shine<1 Then shine=shine+0.01
    If KeyDown(12) And shine>0 Then shine=shine-0.01

    ; Apply the shininess to the coin
    EntityShininess coin,shine

    TurnEntity coin,0,1,0

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Text 0,0,"Arrow keys: move camera   + / - : change shininess   Esc: exit"
    Text 0,20,"EntityShininess coin,"+shine

    Flip

Wend

End

Index