
Execute code to add a cube in Blender using bpy, call bpy.ops.mesh.primitive_cube_add at location 0,0,0 with scale 1,1,1, and run the script to observe the cube at the origin.
use numpy with blender to import np, create a [0,1,2,3] array, loop through objects with bpy.data.objects.remove to clear scene, then place four cubes along the x axis with smaller size.
Generate a sine wave in numpy by applying sin to an array from linspace 0 to pi*2 with 10 points, illustrating procedural scene generation.
Modify the z axis to create terrain slopes by summing base_z (from np.repeat) with random_z (random numbers divided by 2). Run the script to observe reliefs and variable terrain.
Use sin to shape a hilly terrain by computing NumPy sin values, iterating with a for loop, and adding their sum to z to form hills along the y axis.
Explore how to shape procedurally generated hills by adjusting the sin-based period, increasing frequency to create multiple hills or decreasing it for extended hills.
Generate a forest in Blender using numpy and the beta distribution to place trees, tuning alpha and beta, with a size of 50 to widen the spread.
Center the figures in procedurally generated scenes by adjusting beta_random and subtracting half of size or scale; run the code to observe the centered result in the scene.
Introduce a scale variable and multiply the x and y formulas by scale to enlarge the town; run the code and adjust size and scale to control house placement.
Merge terrain and forest scripts into a single Blender Python workflow, rename duplicates to beta_a and beta_b, forest_size and forest_scale, then adjust the z-axis to place the forest above ground.
Copy the import script to bring models from Blender files, replace the cube with the imported model and use loop coordinates, and set the file paths for trees and houses.
Position trees and houses on ground level using a shrinkwrap constraint in blender. Create add_shrinkwrap to attach objects to a target surface with a project axis set to negative z.
Create a lookAt function using mathutils vector operations to orient houses toward the town center, employing position, target, normalization, dot product, acos, cross product, and delta_rotation_euler for z-axis rotation.
Demonstrates generating random tree sizes by implementing increase_random_size to update obj.delta_scale with a random value on all axes during tree insertion, producing trees of different sizes.
Learn to insert multiple models randomly by building arrays for trees and houses, randomly selecting among them during placement, and adjusting beta_a and beta_b to rearrange trees.
Learn to remove duplicate positions in procedurally generated scenes by applying np.unique in the loops that insert trees and houses, eliminating repeated elements in the array.
Create isNearObjects to prevent close object placement by measuring distances with the Pythagorean theorem, using a used_positions list to enforce a minimum distance when placing houses and trees.
Export the procedurally generated scene to glTF 2.0 for use in another application, after tweaking parameters and terrain color, importing other models, and finalizing a scene you like.
Import a blender scene into Godot by exporting glb, save as a Godot file, enable ground collisions with a trimesh static body, and import the player model with keyboard controls.
Model a tree with Blender as part of the procedurally generated scenes course; follow the guide to create your own resources and save the finished model to a separate file.
Model a house using the course's resources, following this guide to create your own models, and save your finished work in a separate file from the code you write.
Hello and welcome.
If you are a designer or developer who is interested in creating scenes automatically with unique features and the ability to use them in an external application, this course is for you.
This course focuses on creating multiple Python scripts that will help us create a scene with a variety of elements in it.
For this, we will use Blender and its scripting section where we will use Python and the NumPy library.
With NumPy, we will use multiple of its function to generate multiple sequences of numbers that will help us to create 3D coordinates.
These coordinates will be used to create a terrain, a forest and a little town.
This course may be attractive to you because it can help you save time when you are designing scenes with the ability to add your custom elements to the script.
In addition, you will have access to the content created during the course.
I hope you find the content useful and that you can apply it to your personal projects.
Have fun and happy learning.
In this course you will learn:
How to Use NumPy to create coordinates in a 3D space.
How to procedurally generate a terrain with random features.
How to create a forest by using the beta distribution.
How to use a parametric formula to generate town.
Import external models.
Export the scene to use it in Godot.
You will require:
Blender 3.X.
Be familiar with Python or basic programing. You can follow the videos if you don't have any experience.
Optionally Godot to import the Blender scene.