reb
Class REB_TrapShapeLatticeTexture

Object
  extended by common:Generic
      extended by common:TrapShape
          extended by reb:REB_TrapShapeLatticeTexture

class 
TrapShape:REB_TrapShapeLatticeTexture

This texture provides a variety of 3D lattice shapes.


Ultra Fractal Source

Toggle UF Source Code Display

 class REB_TrapShapeLatticeTexture(common.ulb:TrapShape) {
  ; This texture provides a variety of 3D lattice shapes. <br>
  public:
    import "common.ulb"
 
 ; Constructor
    func REB_TrapShapeLatticeTexture(Generic pparent)
      TrapShape.TrapShape(pparent)
    endfunc
    
   ; Call this for each iteration being trapped.
    float func Iterate(complex pz)
      TrapShape.Iterate(pz)
     ; create the texture
     float gridx = real(@grid)
     float gridy = imag(@grid)
     if @v_trapshapelatticetextures < 102
       float x = real(#pixel)*1000
       float y = imag(#pixel)*1000
     else
       float x = real(pz)*1000
       float y = imag(pz)*1000
     endif
     float t1x  = 0
     float t2x  = 0
     float t3x  = 0
     float t1y  = 0
     float t2y  = 0
     float t3y  = 0
     complex t = 0
     float e1  = 0
     float e2  = 0
     float e3  = 0
     float tx  = 0
     float ty  = 0
     float tz  = 0
     float td = 0
 
     x = x*(1+@blend*real(pz))/(1+@blend)+ real(#random)*real(@dr)
     y = y*(1+@blend*imag(pz))/(1+@blend)+ imag(#random)*imag(@dr)
     if @smooth == false
       if @texture == 0              ;lattice
         t1x = sin(x/gridx)+@toffset
         t1y = cos(y/gridy)+@toffset
         t2x = t1x+@sens
         t3x = t1x
         t2y = t1y
         t3y = t1y+@sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 1          ;quilt
         t1x = tan(x/gridx)+@toffset
         t2x = t1x + @sens
         t3x = t1x
         t1y = cotan(y/gridy)+@toffset
         t2y = t1y
         t3y = t1y + @sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 2           ;circles and squares
         t1x = sin(x/gridx)+cos(y/gridy)+@toffset
         t2x = t1x + @sens
         t3x = t1x
         t1y = cos(y/gridy)+sin(x/gridx)+@toffset
         t2y = t1y
         t3y = t1y + @sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 3                                ;triangles
         t1x = tan(x/gridx)+cotan(y/gridy)+@toffset
         t2x = t1x + @sens
         t3x = t1x
         t1y = cotan(y/gridy)+tan(x/gridx)+@toffset
         t2y = t1y
         t3y = t1y + @sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 4                                 ;X's and O's
         t1x = 1/sin(x/gridx)+@toffset
         t2x = t1x + @sens
         t3x = t1x
         t1y = 1/cos(y/gridy)+@toffset
         t2y = t1y
         t3y = t1y + @sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 5                  ;Dimples
         t1x = 1/tan(x/gridx)+@toffset
         t2x = t1x + @sens
         t3x = t1x
         t1y = 1/cotan(y/gridy)+@toffset
         t2y = t1y
         t3y = t1y + @sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 6                      ;Arrows
         t1x = 1/tan(x/gridx)+@toffset
         t2x = t1x + @sens
         t3x = t1x
         t1y = 1/sin(y/gridy)+@toffset
         t2y = t1y
         t3y = t1y + @sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 7        ; basketweave
         t1x = 1/sin(x/gridx)+1/cos(y/gridy)+@toffset
         t2x = t1x + @sens
         t3x = t1x
         t1y = 1/cos(y/gridy)+1/sin(x/gridx)+@toffset
         t2y = t1y
         t3y = t1y + @sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 8        ; balls
         t1x = sin(x/gridx)^2 + cos(y/gridy)^2+@toffset
         t2x = t1x + @sens
         t3x = t1x
         t1y = sin(y/gridy)^2 + cos(x/gridx)^2+@toffset
         t2y = t1y
         t3y = t1y + @sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 9              ;Net
         t1x = log(abs(sin(x/gridx)))+@toffset
         t2x = t1x+@sens
         t3x = t1x
         t1y = log(abs(cos(y/gridy)))+@toffset
         t2y = t1y
         t3y = t1y+@sens
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       endif
     ELSE
       if @texture == 0              ;lattice
         t1x = sin(x/gridx)+1
         t2x = sin((x+@sens)/gridx)+@toffset
         t3x = t1x
         t1y = cos(y/gridy)+1
         t2y = t1y
         t3y = cos((y+@sens)/gridy)+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 1          ;quilt
         t1x = tan(x/gridx)+1
         t2x = tan((x+@sens)/gridx)+@toffset
         t3x = t1x
         t1y = cotan(y/gridy)+1
         t2y = t1y
         t3y = cotan((y+@sens)/gridy)+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 2           ;circles and squares
         t1x = sin(x/gridx)+cos(y/gridy)+@toffset
         t2x = sin((x+@sens)/gridx)+cos(y/gridy)+@toffset
         t3x = t1x
         t1y = cos(y/gridy)+sin(x/gridx)+@toffset
         t2y = t1y
         t3y = cos((y+@sens)/gridy)+sin(x/gridx)+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 3                                ;triangles
         t1x = tan(x/gridx)+cotan(y/gridy)+@toffset
         t2x = tan((x+@sens)/gridx)+cotan(y/gridy)+@toffset
         t3x = t1x
         t1y = cotan(y/gridy)+tan(x/gridx)+@toffset
         t2y = t1y
         t3y = cotan((y+@sens)/gridy)+tan(x/gridx)+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 4                                 ;X's and O's
         t1x = 1/sin(x/gridx)+@toffset
         t2x = 1/sin((x+@sens)/gridx)+@toffset
         t3x = t1x
         t1y = 1/cos(y/gridy)+@toffset
         t2y = t1y
         t3y = 1/cos((y+@sens)/gridy)+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 5                  ;Dimples
         t1x = 1/tan(x/gridx)+@toffset
         t2x = 1/tan((x+@sens)/gridx)+@toffset
         t3x = t1x
         t1y = 1/cotan(y/gridy)+@toffset
         t2y = t1y
         t3y = 1/cotan((y+@sens)/gridy)+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 6                      ;Arrows
         t1x = 1/tan(x/gridx)+@toffset
         t2x = 1/tan((x+@sens)/gridx)+@toffset
         t3x = t1x
         t1y = 1/sin(y/gridy)+@toffset
         t2y = t1y
         t3y = 1/sin((y+@sens)/gridy)+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 7        ; basketweave
         t1x = 1/sin((x+@sens)/gridx)+1/cos(y/gridy)+@toffset
         t2x = 1/sin(x/gridx)+1/cos(y/gridy)+@toffset
         t3x = t1x
         t1y = 1/cos(y/gridy)+1/sin(x/gridx)+@toffset
         t2y = t1y
         t3y = 1/cos((y+@sens)/gridy)+1/sin(x/gridx)+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 8        ; balls
         t1x = sin((x+@sens)/gridx)^2 + cos(y/gridy)^2+@toffset
         t2x = sin(x/gridx)^2 + cos(y/gridy)^2+@toffset
         t3x = t1x
         t1y = sin(y/gridy)^2 + cos(x/gridx)^2+@toffset
         t2y = t1y
         t3y = sin((y+@sens)/gridy)^2 + cos(x/gridx)^2+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       elseif @texture == 9              ;net
         t1x = log(abs(sin(x/gridx)))+1
         t2x = log(abs(sin((x+@sens)/gridx)))+@toffset
         t3x = t1x
         t1y = log(abs(cos(y/gridy)))+1
         t2y = t1y
         t3y = log(abs(cos((y+@sens)/gridy)))+@toffset
         e1 =cabs(t1x+flip(t1y))
         e2 =cabs(t2x+flip(t2y))
         e3 =cabs(t3x+flip(t3y))
         tx = e2 - e1
         ty = e3 - e1
         tz = -@sens/@theight
         td = 1/sqrt(sqr(tx)+sqr(ty)+sqr(tz))
         tx = tx*td
         ty = ty*td
         t = tx + flip(ty)
       endif
     endif
     m_LastZ = t
     return real(t)
    endfunc
    
  default:
    title = "Lattice Textures"
   int param v_trapshapelatticetextures
     caption = "Version (Trap Shape Lattice Textures)"
     default = 102
     hint = "This version parameter is used to detect when a change has been made to the formula that is incompatible with the previous version. When that happens, this field will reflect the old version number to alert you to the fact that an alternate rendering is being used."
     visible = @v_trapshapelatticetextures < 102
   endparam
   param texture
     caption = "Texture"
     default = 0
     enum = "Lattice" "Quilt" "Circles & Squares" "Triangles" \
            "X's & O's" "Dimples" "Arrows" "Basketweave" "Balls" \
            "Net"
 
   endparam
   complex param grid
     caption = "Texture scale"
     default = (1,1)
   endparam
   complex param dr
     caption = "Randomizer"
     default = (0,0)
   endparam
   float param theight
     caption = "Texture Height"
     default = 1.0
   endparam
   float param blend
     caption = "Texture Blend"
     default = 0.05
   endparam
   float param toffset
     caption = "Texturizer Offset"
     default = 1.0
   endparam
   float param sens
     caption = "Sensitivity"
     default = 1e-8
   endparam
   bool param smooth
     caption = "Texture Smoothing"
     default = true
     hint = "Apply 3D smoothing to the texture"
 
   endparam
  }
 


Constructor Summary
REB_TrapShapeLatticeTexture()
           
REB_TrapShapeLatticeTexture(Generic pparent)
          Constructor
 
Method Summary
 float Iterate(complex pz)
          Call this for each iteration being trapped.
 
Methods inherited from class common:TrapShape
GetColorChannel, GetTextureValue, GetTransformedPoint, Init, IterateSilent, SetThreshold
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

REB_TrapShapeLatticeTexture

public REB_TrapShapeLatticeTexture(Generic pparent)
Constructor


REB_TrapShapeLatticeTexture

public REB_TrapShapeLatticeTexture()
Method Detail

Iterate

public float Iterate(complex pz)
Call this for each iteration being trapped.

Overrides:
Iterate in class TrapShape