Standard
Class Standard_Lighting
Object
common:Generic
common:Coloring
common:GradientColoring
Standard:Standard_Lighting
class
- GradientColoring:Standard_Lighting
Object version of Lighting in Standard.ucl.
Coloring algorithm for the Slope family of fractal types. This coloring
algorithm performs 3D lighting for these fractals.
Originally written by Damien M. Jones
Ultra Fractal Source
Toggle UF Source Code Display
class Standard_Lighting(common.ulb:GradientColoring) {
;
; Object version of Lighting in Standard.ucl.
;
; Coloring algorithm for the Slope family of fractal types. This coloring
; algorithm performs 3D lighting for these fractals.
;
; Originally written by Damien M. Jones
;
public:
float func ResultIndex(complex pz)
float vz = -sqrt(1-|pz|) ; extract implied portion of normal
float d2r = #pi/180 ; degrees to radians conversion factor
; create vector for light direction
float lx = cos((270-@angle)*d2r) * cos(@elevation*d2r)
float ly = sin((270-@angle)*d2r) * cos(@elevation*d2r)
float lz = -sin(@elevation*d2r)
; compute cosine of angle between these vectors
; (this is the amount of lighting on the surface)
float l = lx*real(pz) + ly*imag(pz) + lz*vz
IF (l < @ambient) ; light is below the ambient level
l = @ambient ; set it to the ambient level
ENDIF
IF (@ambient < 0) ; the ambient level is negative
l = l + 1 ; offset to prevent clipping at 0
ENDIF
return l*0.99 ; reduce it just a bit to prevent
; the colors from wrapping
endfunc
default:
title = "Lighting"
helpfile = "Uf*.chm"
helptopic = "Html/coloring/standard/lighting.html"
heading
text = "Tip: Combine with one of the Slope formulas"
endheading
param @angle
caption = "Light Rotation"
default = 90.0
hint = "Gives the rotation of the light source, in degrees. With 0 \
degrees, the light comes from above. Positive values give \
clockwise rotation."
endparam
param @elevation
caption = "Light Elevation"
default = 30.0
hint = "Gives the elevation of the light source, in degrees."
endparam
param @ambient
caption = "Ambient Light"
default = 0.0
min = -1.0
max = 1.0
hint = "Specifies the level of ambient light. Use -1.0 to \
color all surfaces."
endparam
}
Method Summary |
float |
ResultIndex(complex pz)
Produce a resulting color index after a sequence is finished |
Methods inherited from class Object |
|
Standard_Lighting
public Standard_Lighting()
ResultIndex
public float ResultIndex(complex pz)
- Description copied from class:
GradientColoring
- Produce a resulting color index after a sequence is finished
This corresponds to the final: section in a coloring formula.
Once it is called, no further calls to Iterate() should be
made without calling Init() first.
- Overrides:
ResultIndex
in class GradientColoring
- Returns:
- the gradient index (corresponding to #index in a coloring formula)