c4d.utils.noise.C4DNoise

An important technique for generating procedural textures is the use of fractal noise.

class c4d.utils.noise. C4DNoise

Members

C4DNoise. __init__ ( [ seed=665 ] )
Parameters: seed ( int ) – Noise seed.
Return type: c4d.utils.noise.C4DNoise
Returns: A new noise object.
static C4DNoise. CreateMenuContainer ( [ bIncludeNone=False ] )

Creates a menu container with the different noise options available:

bc = noise.C4DNoise.CreateMenuContainer(False)
for index, name in bc:
  print index, name
							
Parameters: bIncludeNone ( bool ) – Include the none option.
Return type: c4d.BaseContainer
Returns: Generated noise menu.
static C4DNoise. HasOctaves ( t )

Checks if a certain noise type supports the octaves parameter.

Parameters: t ( int ) – Noise type.
Return type: bool
Returns: True if octaves is supported, otherwise False .
static C4DNoise. HasCycles ( t )

Checks if a certain noise type supports the cycles parameter.

Parameters: t ( int ) – Noise type.
Return type: bool
Returns: True if cycles is supported, otherwise False .
static C4DNoise. HasAbsolute ( t )

Checks if a certain noise type supports the absolute parameter.

Parameters: t ( int ) – Noise type.
Return type: bool
Returns: True if absolute is supported, otherwise False .
static C4DNoise. EvaluateSampleOffset ( type , rOctaves , rDelta )

Evaluates the sample offset.

Parameters:
  • type ( int ) – Noise type.
  • rOctaves ( float ) – Number of octaves.
  • rDelta ( float ) – Delta.
Return type:

float

Returns:

The sample offset.

C4DNoise. InitFbm ( lMaxOctaves , rLacunarity , h )

Initializes fractal brownian motion.

Parameters:
  • lMaxOctaves ( int ) – The maximum octave.
  • rLacunarity ( float ) – This parameter controls the scale of each successive fractal overlay.
  • h ( float ) – H-Parameter
Return type:

bool

Returns:

Initializes fractal brownian motion

C4DNoise. Noise ( t, two_d, p[, time=0.0][, octaves=4.0][, absolute=False][, sampleRad=0.25][, detailAtt=0.25][, t_repeat=0] )

Samples a 2D or 3D noise.

Parameters:
  • t ( int ) –

    The noise Type: Noise Types

    Note

    Please use InitFbm() before you use one of the following noise types: NOISE_ZADA, NOISE_DISPL_VORONOI, NOISE_OBER, NOISE_FBM, NOISE_BUYA.

  • two_d ( bool ) – True for 2D Sampling, False for 3D Sampling
  • p ( c4d.Vector ) – Noise coordinate.
  • time ( float ) – Time.
  • octaves ( float ) – Octaves, if supported. See HasOctaves()
  • absolute ( bool ) – Absolute value, if supported. See HasAbsolute()
  • sampleRad ( float ) – Sample radius.
  • detailAtt ( float ) – Detail attenuation.
  • t_repeat ( int ) – Must be 2^x - 1 , where x = [1..10], i.e. one of 1, 3, 7, 15, 31, 63, 127, 255, 511, and 1023. A noise repeats itself in time every 1024 units. Using a smaller repeat the noise will repeat at an earlier time.
Return type:

float

Returns:

Noise sample.

C4DNoise. SNoise ( p , lRepeat [ , t=0.0 ] )

Generate a periodic signed noise value.

Parameters:
  • p ( c4d.Vector ) – Noise coordinate.
  • lRepeat ( int ) – Must be 2^x - 1 , where x = [1..10], i.e. one of 1, 3, 7, 15, 31, 63, 127, 255, 511, and 1023. A noise repeats itself in time every 1024 units. Using a smaller lRepeat the noise will repeat at an earlier time.
  • t ( float ) – The time.
Return type:

float

Returns:

Signed noise value, this is between -1.0 and 1.0.

C4DNoise. Turbulence ( p , rOctaves , bAsolute [ , t=0.0 ] )

Generate a turbulence value, this is a sum of multiple noises with different frequency.

Parameters:
  • p ( c4d.Vector ) – Turbulence coordinate
  • rOctaves ( float ) – The number of octaves.
  • bAbsolute ( bool ) – True for absolute values.
  • t ( float ) – The time.
Return type:

float

Returns:

Noise sample.

C4DNoise. Fbm ( p , rOctaves , lRepeat [ , t=0.0 ] )

Generate a periodic Fractional Brownian Motion value.

Note

Needs the call InitFbm() before.

Warning

The rOctaves value must not exceed the value passed to InitFbm() but can be lower.

Parameters:
  • p ( c4d.Vector ) – The evaluation point.
  • rOctaves ( float ) – The octaves
  • lRepeat ( int ) – Must be 2^x - 1 , where x = [1..10], i.e. one of 1, 3, 7, 15, 31, 63, 127, 255, 511, and 1023. A noise repeats itself in time every 1024 units. Using a smaller repeat the noise will repeat at an earlier time.
  • t ( float ) – The time
Return type:

float

Returns:

The fbm value.

C4DNoise. RidgedMultifractal ( p , rOctaves , rOffset , rGain , lRepeat [ , t=0 ] )

Generate a periodic fractal function used for such things as landscapes or mountain ranges.

Note

Needs the call InitFbm() before.

Warning

The rOctaves value must not exceed the value passed to InitFbm() but can be lower.

Parameters:
  • p ( c4d.Vector ) – The evaluation point.
  • rOctaves ( float ) – The octave.
  • rOffset ( float ) – The zero offset, this controls the multifractality.
  • rGain ( float ) – The amplification of the fractal value.
  • lRepeat ( float ) – Must be 2^x - 1 , where x = [1..10], i.e. one of 1, 3, 7, 15, 31, 63, 127, 255, 511, and 1023. A noise repeats itself in time every 1024 units. Using a smaller lrepeat the noise will repeat at an earlier time.
  • t ( float ) – The time.
Return type:

float

Returns:

The fractal value.

Example

Creates a noise and save it in a bitmap:

import c4d
from c4d.utils.noise import C4DNoise
from c4d import bitmaps
width = 300
height = 300
noisetype = c4d.NOISE_DISPL_TURB
bmp =  bitmaps.BaseBitmap()
bmp.Init(width, height, 24)
# Create and initialize the noise instance
p = C4DNoise(1234)
p.InitFbm(21, 2.1, 0.5)
rw = float(width-1)
rh = float(height-1)
# Iterate through the bitmap and set the noise value per pixel
for x in xrange(width):
  for y in xrange(height):
    r = p.Noise(noisetype, False, c4d.Vector(x/rw, y/rh, 0) * 7.0, octaves=5)
    o = int(255.0*r)
    if o < 0: o = 0
    elif o > 255: o = 255
    bmp[x, y] = (o, o, o)
bitmaps.ShowBitmap(bmp)
					

Noise Types

BoxNoise

Type: NOISE_BOX_NOISE

../../../../_images/BoxNoise.jpg

Blistered Turbulence

Type: NOISE_BLIST_TURB

../../../../_images/BlisteredTurbulence.jpg

Buya

Type: NOISE_BUYA

../../../../_images/Buya.jpg

Cell Noise

Type: NOISE_CELL_NOISE

../../../../_images/CellNoise.jpg

Cell Voronoi

Type: NOISE_CELL_VORONOI

../../../../_images/CellVoronoi.jpg

Cranal

Type: NOISE_CRANAL

../../../../_images/Cranal.jpg

Dents

Type: NOISE_DENTS

../../../../_images/Dents.jpg

Displaced Turbulence

Type: NOISE_DISPL_TURB

../../../../_images/DisplacedTurbulence.jpg

Electric

Type: NOISE_ELECTRIC

../../../../_images/Electric.jpg

FBM

Type: NOISE_FBM

../../../../_images/FBM.jpg

Fire

Type: NOISE_FIRE

../../../../_images/Fire.jpg

Gas

Type: NOISE_GASEOUS

../../../../_images/Gaseous.jpg

Hama

Type: NOISE_HAMA

../../../../_images/Hama.jpg

Luka

Type: NOISE_LUKA

../../../../_images/Luka.jpg

Mod Noise

Type: NOISE_MOD_NOISE

../../../../_images/ModNoise.jpg

Naki

Type: NOISE_NAKI

../../../../_images/Naki.jpg

Noise

Type: NOISE_NOISE

../../../../_images/Noise.jpg

None

Type: NOISE_NONE

../../../../_images/None.jpg

Nutous

Type: NOISE_NUTOUS

../../../../_images/Nutous.jpg

Ober

Type: NOISE_OBER

../../../../_images/Ober.jpg

Pezo

Type: NOISE_PEZO

../../../../_images/Pezo.jpg

Poxo

Type: NOISE_POXO

../../../../_images/Poxo.jpg

Sema

Type: NOISE_SEMA

../../../../_images/Sema.jpg

Sparse Convolution

Type: NOISE_SPARSE_CONV

../../../../_images/SparseConvolution.jpg

Stupl

Type: NOISE_STUPL

../../../../_images/Stupl.jpg

Turbulence

Type: NOISE_TURBULENCE

../../../../_images/Turbulence.jpg

VLNoise

Type: NOISE_VL_NOISE

../../../../_images/VLNoise.jpg

Voronoi 1

Type: NOISE_VORONOI_1

../../../../_images/Voronoi1.jpg

Voronoi 2

Type: NOISE_VORONOI_2

../../../../_images/Voronoi2.jpg

Voronoi 3

Type: NOISE_VORONOI_3

../../../../_images/Voronoi3.jpg

Wavy Turbulence

Type: NOISE_WAVY_TURB

../../../../_images/WavyTurbulence.jpg

Zada

Type: NOISE_ZADA

../../../../_images/Zada.jpg