返回列表 回复 发帖
常老师还是你行,不服不行!
向uf光照着色开刀:
Lighting {
;
; Coloring algorithm for the Slope family of fractal types.
; This coloring algorithm performs 3D lighting for these
; fractals.
;
; Written by Damien M. Jones
;
final:
  float vz = -sqrt(1-|#z|)                ; 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(#z) + ly*imag(#z) + 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
  #index = l*0.99                        ; reduce it just a bit to prevent
                                          ; the colors from wrapping

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
}
float vz = -sqrt(1-|#z|)      
对这行不理解,按这种算法只有单位圆内有意义啊?
先做一个简单一点的:二元分解着色
新建位图图像.jpg
从头学分形-6简易矩形et-dem扫描平台-二元分解法.gsp (125.92 KB)
光滑着色:
无标题1.jpg
二元分解:
无标题2.jpg
虽然有瑕疵,凑合着扫,过过瘾再想办法:
无标题3.jpg
无标题4.jpg
31# mjj_ljh


常老师我怎么无法使它平滑?请指教。
常老师,我的文件逃逸半径只能最大为10000,不知怎么回事。http://www.inrm3d.cn/viewthread. ... page%3D1&page=9
常胡老师调的都很精彩,赏心悦目。
71# xiaongxp


向老师您把文件上传一下,看看我能不能帮您。
返回列表