import scene3d
SKY = scene3d.Sky.CLOUDS
GROUND = scene3d.Material.Grass.Bright
SPHERE = scene3d.Material.Planets.Earth
scene = scene3d.Scene()
scene.set_sky(SKY)
ground = scene.set_ground(length=20, width=20)
ground.set_material(GROUND)
ground.set_tiling(8)
sphere = scene3d.Shapes.Sphere(diameter=2, segments=32)
sphere.set_material(SPHERE)
sphere.set_position(0, 1, 0)
scene.add(sphere)Now Experiment!
You’ve covered a lot in Lesson 1. Here’s what you now know how to do:
- Call functions with parameters to create shapes (
Sphere,Box,Cylinder) - Control size and position using
diameter,set_position, andset_scale - Apply colors with hex codes and
set_color - Paint the sky with
set_sky— using a hex code or aSkyconstant - Apply materials with
set_materialand adjust shine withset_glossiness - Use constants to name values once and reuse them everywhere
The cell below is your sandbox. It starts with a simple scene — a sky, a ground, and one sphere. The rest is up to you.
Ideas to try: - Add more shapes — a box, a cylinder, another sphere - Give each shape a different material or color - Change the sky and ground to match a theme (space, a meadow, a city) - Use set_scale to squash or stretch shapes into something new - Define constants at the top to describe your scene’s “material library”