[Bf-extensions-cvs] [8d5a642] master: ANT Landscape: new methods & presets
meta-androcto
noreply at git.blender.org
Sat May 13 10:57:40 CEST 2017
Commit: 8d5a642f0bd56124d567f56921eb9d4b39de0bfc
Author: meta-androcto
Date: Sat May 13 18:57:10 2017 +1000
Branches: master
https://developer.blender.org/rBA8d5a642f0bd56124d567f56921eb9d4b39de0bfc
ANT Landscape: new methods & presets
===================================================================
M add_mesh_ant_landscape.py
A presets/operator/mesh.landscape_add/abstract.py
A presets/operator/mesh.landscape_add/canion.py
A presets/operator/mesh.landscape_add/cauliflower_hills.py
A presets/operator/mesh.landscape_add/crystalline.py
D presets/operator/mesh.landscape_add/default-larger.py
A presets/operator/mesh.landscape_add/default.py
A presets/operator/mesh.landscape_add/default_large.py
D presets/operator/mesh.landscape_add/distortednoise.py
D presets/operator/mesh.landscape_add/fbm2.py
A presets/operator/mesh.landscape_add/flatstone.py
D presets/operator/mesh.landscape_add/heteroterrain.py
A presets/operator/mesh.landscape_add/land_and_water.py
D presets/operator/mesh.landscape_add/lowpoly.py
D presets/operator/mesh.landscape_add/marblebump.py
A presets/operator/mesh.landscape_add/mountain.py
A presets/operator/mesh.landscape_add/planet_noise.py
D presets/operator/mesh.landscape_add/planetnoise-larger.py
D presets/operator/mesh.landscape_add/planetnoise.py
M presets/operator/mesh.landscape_add/plateau.py
D presets/operator/mesh.landscape_add/ridgedmfractal.py
D presets/operator/mesh.landscape_add/scatteredsrocks.py
A presets/operator/mesh.landscape_add/smooth_terrain.py
D presets/operator/mesh.landscape_add/stonepath.py
D presets/operator/mesh.landscape_add/stratasphere.py
A presets/operator/mesh.landscape_add/techno_grid.py
A presets/operator/mesh.landscape_add/terrain_large.py
D presets/operator/mesh.landscape_add/turbulence_2.py
A presets/operator/mesh.landscape_add/voronoi_hills.py
D presets/operator/mesh.landscape_add/voronoihills.py
M presets/operator/mesh.landscape_add/vulcano.py
===================================================================
diff --git a/add_mesh_ant_landscape.py b/add_mesh_ant_landscape.py
index 2081b96..f6c287a 100644
--- a/add_mesh_ant_landscape.py
+++ b/add_mesh_ant_landscape.py
@@ -19,7 +19,7 @@
bl_info = {
"name": "ANT Landscape",
"author": "Jimmy Hazevoet",
- "version": (0, 1, 5),
+ "version": (0, 1, 6),
"blender": (2, 77, 0),
"location": "View3D > Add > Mesh",
"description": "Add a landscape primitive",
@@ -29,28 +29,48 @@ bl_info = {
"category": "Add Mesh",
}
-
"""
-Another Noise Tool: Landscape mesh generator
-
+# -------------------------------------------------------------
+--- UPDATE: - VERSION 0,1,6 (5/2017)
+# -------------------------------------------------------------
+ - NEW:
+ -
+ - Variable X and Y grid size and variable X and Y subdivisions
+ - Triangulate faces
+ - Slope map, z normal to vertex group weight,
+ and optional select vertices on flat area's
+ - Place landscape at cursor position or at world center
+ - Noise variations (from old A.N.T. Blender-2.49 addon)
+ - Variable X and Y noise size (and X Y Offset since version 0.1.5)
+ - Plateau and Sealevel renamed to Maximum (plateau) and Minimum (now: seabed)
+ - Variable X and Y edge fallof with variable edge level (now: sealevel)
+ - Add water plane with variable height
+ - Use materials
+ - Some small changes and fixes
+ -
+# -------------------------------------------------------------
+# Another Noise Tool: Landscape mesh generator
+# -------------------------------------------------------------
MESH OPTIONS:
-Mesh update: Turn this on for interactive mesh update.
+Mesh update: Turn this on for interactive mesh refresh.
Sphere: Generate sphere or a grid mesh.
Smooth: Generate smooth shaded mesh.
-Subdivision: Number of mesh subdivisions, higher numbers gives more detail but also slows down the script.
-Mesh size: X,Y size of the grid mesh in blender units.
+Triangulate: Triangulate faces
+Subdivision X Y: Number of mesh X Y subdivisions, higher numbers gives more detail but slows down the script.
+Mesh size X Y: X,Y size of the grid mesh in blender units.
X_Offset: Noise x offset in blender units (make tiled terrain)
Y_Offset: Noise y offset in blender units
+Cursor: Place at cursor location
+Vertex Group: Slope map, z normal value to vertex group weight,
+ and select vertices on flat area's
-NOISE OPTIONS: ( Most of these options are the same as in blender textures. )
+NOISE OPTIONS: ( Many of these options are the same as in blender textures. )
Random seed: Use this to randomise the origin of the noise function.
Noise size: Size of the noise.
Noise type: Available noise types: multiFractal, ridgedMFractal, fBm, hybridMFractal, heteroTerrain,
Turbulence, Distorted Noise, Marble, Shattered_hTerrain, Strata_hTerrain, Planet_noise
Noise basis: Blender, Perlin, NewPerlin, Voronoi_F1, Voronoi_F2, Voronoi_F3, Voronoi_F4, Voronoi_F2-F1,
Voronoi Crackle, Cellnoise
-VLNoise basis: Blender, Perlin, NewPerlin, Voronoi_F1, Voronoi_F2, Voronoi_F3, Voronoi_F4, Voronoi_F2-F1,
- Voronoi Crackle, Cellnoise
Distortion: Distortion amount.
Hard: Hard/Soft turbulence noise.
Depth: Noise depth, number of frequencies in the fBm.
@@ -60,27 +80,40 @@ Offset: Musgrave: Raises the terrain from sea level.
Gain: Musgrave: Scale factor.
Marble Bias: Sin, Tri, Saw
Marble Sharpnes: Soft, Sharp, Sharper
-Marble Shape: Shape of the marble function: Default, Ring, Swirl, X, Y
+Marble Shape: Shape of the marble function: Default, Ring, Swirl, Bumps, Wave, X, Y
-HEIGHT OPTIONS:
-Invert: Invert terrain height.
+TERRAIN OPTIONS:
Height: Scale terrain height.
+Invert: Invert terrain height.
Offset: Terrain height offset.
-Falloff: Terrain height falloff: Type 1, Type 2, X, Y
-Sealevel: Flattens terrain below sealevel.
-Platlevel: Flattens terrain above plateau level.
-Strata: Strata amount, number of strata/terrace layers.
-Strata type: Strata types, Smooth, Sharp-sub, Sharp-add
+Seabed: Flattens terrain at seabed level.
+Plateau: Flattens terrain at plateau level.
+Falloff: Terrain height falloff: X falloff, Y falloff, XY falloff
+Edge Level: Falloff edge level, sealevel
+FalloffSizeX: Scale falloff x
+FalloffSizeY: Scale falloff y
+Strata: Strata amount, number of strata / terrace layers.
+Strata type: Strata types, Smooth, Sharp-sub, Sharp-add, Quantize
+
+WATER: Add water plane
+Level: Adjust plane level
+
+MATERIAL: Use materials
"""
+# ------------------------------------------------------------
# import modules
import bpy
+import os
from bpy.props import (
BoolProperty,
EnumProperty,
FloatProperty,
IntProperty,
+ StringProperty,
+ FloatVectorProperty,
)
+from mathutils import Vector
from mathutils.noise import (
seed_set,
turbulence,
@@ -94,35 +127,20 @@ from mathutils.noise import (
variable_lacunarity,
)
from math import (
- floor, hypot,
+ floor, sqrt,
sin, cos, pi,
)
-
-# Create a new mesh (object) from verts/edges/faces.
-# verts/edges/faces ... List of vertices/edges/faces for the
-# new mesh (as used in from_pydata).
-# name ... Name of the new mesh (& object).
-def create_mesh_object(context, verts, edges, faces, name):
- # Create new mesh
- mesh = bpy.data.meshes.new(name)
-
- # Make a mesh from a list of verts/edges/faces.
- mesh.from_pydata(verts, edges, faces)
-
- # Update mesh geometry after adding stuff.
- mesh.update()
-
- from bpy_extras import object_utils
- return object_utils.object_data_add(context, mesh, operator=None)
-
-
# ------------------------------------------------------------
# some functions for marble_noise
def sin_bias(a):
return 0.5 + 0.5 * sin(a)
+def cos_bias(a):
+ return 0.5 + 0.5 * cos(a)
+
+
def tri_bias(a):
b = 2 * pi
a = 1 - 2 * abs(floor((a * (1 / b)) + 0.5) - (a * (1 / b)))
@@ -151,76 +169,150 @@ def sharper(a):
def shapes(x, y, shape=0):
- if shape == 1:
+ p = pi
+ if shape is 1:
# ring
- x = x * 2
- y = y * 2
- s = (-cos(x**2 + y**2) / (x**2 + y**2 + 0.5))
- elif shape == 2:
+ x = x * p
+ y = y * p
+ s = cos(x**2 + y**2) / (x**2 + y**2 + 0.5)
+ elif shape is 2:
# swirl
- x = x * 2
- y = y * 2
+ x = x * p
+ y = y * p
s = ((x * sin(x * x + y * y) + y * cos(x * x + y * y)) / (x**2 + y**2 + 0.5))
- elif shape == 3:
+ elif shape is 3:
# bumps
- x = x * 2
- y = y * 2
- s = ((cos(x * pi) + cos(y * pi)) - 0.5)
- elif shape == 4:
+ x = x * p
+ y = y * p
+ s = ((cos(x * p) + cos(y * p)) - 0.5)
+ elif shape is 4:
+ # wave
+ x = x * p * 2
+ y = y * p * 2
+ s = sin(x + sin(y))
+ elif shape is 5:
# y grad.
- s = (y * pi)
- elif shape == 5:
+ s = (y * p)
+ elif shape is 6:
# x grad.
- s = (x * pi)
+ s = (x * p)
else:
# marble default
s = ((x + y) * 5)
-
return s
# marble_noise
-def marble_noise(x, y, z, origin, size, shape, bias, sharpnes, turb, depth, hard, basis):
- x = x / size
- y = y / size
- z = z / size
- s = shapes(x, y, shape)
+def marble_noise(x, y, z, origin, size, shape, bias, sharpnes, turb, depth, hard, basis, amp, freq):
+ s = shapes(x, y, shape)
x += origin[0]
y += origin[1]
z += origin[2]
value = s + turb * turbulence_vector((x, y, z), depth, hard, basis)[0]
- if bias == 1:
+ if bias is 1:
+ value = cos_bias(value)
+ if bias is 2:
value = tri_bias(value)
- elif bias == 2:
+ elif bias is 3:
value = saw_bias(value)
else:
value = sin_bias(value)
- if sharpnes == 1:
+ if sharpnes is 1:
+ value = 1.0 - sharp(value)
+ elif sharpnes is 2:
+ value = 1.0 - sharper(value)
+ elif sharpnes is 3:
+ value = soft(value)
+ elif sharpnes is 4:
value = sharp(value)
- elif sharpnes == 2:
+ elif sharpnes is 5:
value = sharper(value)
else:
- value = soft(value)
+ value = 1.0 - soft(value)
return value
-
# ------------------------------------------------------------
# custom noise types
+# vl_noise_turbulence:
+def vlnTurbMode(coords, distort, basis, vlbasis, hardnoise):
+ # hard noise
+ if hardnoise:
+ return (abs(-variable_lacunarity(coords, distort, basis, vlbasis)))
+ # soft noise
+ else:
+ return variable_lacunarity(coords, distort, basis, vlbasis)
+
+
+def vl_noise_turbulence(coords, distort, depth, basis, vlbasis, hardnoise, amp, freq):
+ x, y, z = coords
+ value = vlnTurbMode(coords, distort, basis, vlbasis, hardnoise)
+ i=0
+ for i in range(depth):
+ i+=1
+ value += vlnTurbMode((x * (freq * i), y * (freq * i), z), distort, basis, vlbasis, hardnoise) * (amp * 0.5 / i)
+ return value
+
+
+## duo_multiFractal:
+def double_multiFractal(coords, H, lacunarity, octaves, offset, gain, basis, vlbasis):
+ x, y, z = coords
+ n1 = multi_fractal((x * 1.5 + 1, y * 1.5 + 1, z), 1.0, 1.0, 1.0, basis) * (offset * 0.5)
+ n2 = multi_fractal((x - 1, y - 1, z), H, lacunarity, octaves, vlbasis) * (gain * 0.5)
+ return (n1 * n1 + n2 * n2) * 0.5
+
+
+## distorted_heteroTerrain:
+def distorted_heteroTerrain(coords, H, lacunarity, octaves, offset, distort, basis, vlbasis):
+ x, y, z = coords
+ h1 = (hetero_terrain((x, y, z), 1.0, 2.0, 1.0, 1.0, basis) * 0.5)
+ h2 = (hetero_terrain((x, y, h1 * distort * 2), H, lacuna
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list