An important technique for generating procedural textures is the use of fractal noise.
Parameters: | seed (int) – Noise seed. |
---|---|
Return type: | C4DNoise |
Returns: | A new noise object. |
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: | BaseContainer |
Returns: | Generated noise menu. |
Initializes fractal brownian motion.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
Initializes fractal brownian motion |
Samples a 2D or 3D noise.
Parameters: |
|
---|---|
Return type: |
float |
Returns: |
Noise sample. |
Generate a periodic signed noise value.
Parameters: |
|
---|---|
Return type: |
float |
Returns: |
Signed noise value, this is between -1.0 and 1.0. |
Generate a turbulence value, this is a sum of multiple noises with different frequency.
Parameters: |
|
---|---|
Return type: |
float |
Returns: |
Noise sample. |
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: |
|
---|---|
Return type: |
float |
Returns: |
The fbm value. |
Generate a periodic fractal function used for such things as landscapes or mountain ranges.
Parameters: |
|
---|---|
Return type: |
float |
Returns: |
The fractal value. |
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. |
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. |
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. |
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)
Type: NOISE_BOX_NOISE
Type: NOISE_BLIST_TURB
Type: NOISE_BUYA
Type: NOISE_CELL_NOISE
Type: NOISE_CELL_VORONOI
Type: NOISE_CRANAL
Type: NOISE_DENTS
Type: NOISE_DISPL_TURB
Type: NOISE_ELECTRIC
Type: NOISE_FBM
Type: NOISE_FIRE
Type: NOISE_GASEOUS
Type: NOISE_HAMA
Type: NOISE_LUKA
Type: NOISE_MOD_NOISE
Type: NOISE_NAKI
Type: NOISE_NOISE
Type: NOISE_NONE
Type: NOISE_NUTOUS
Type: NOISE_OBER
Type: NOISE_PEZO
Type: NOISE_POXO
Type: NOISE_SEMA
Type: NOISE_SPARSE_CONV
Type: NOISE_STUPL
Type: NOISE_TURBULENCE
Type: NOISE_VL_NOISE
Type: NOISE_VORONOI_1
Type: NOISE_VORONOI_2
Type: NOISE_VORONOI_3
Type: NOISE_WAVY_TURB
Type: NOISE_ZADA