Sitat av
Quakecry
Siden han ikke svarte, jeg har ikke peiling på hverken python eller blender. Men her er hva GPT svarte når jeg spurte den om å lage en figur (freak figuren) som står i en foss mens fugler flyr ovenfor.
"Here is a sample code in Python that you can use in Blender to create the scene described:
Kanskje du klarer å lage noe mening ut av det, eller fortelle om det er et nogenlunde OK utgangspunkt.
Kode
import bpy
# Set the render resolution
bpy.context.scene.render.resolution_x = 1920
bpy.context.scene.render.resolution_y = 1080
# Add a plane for the ground
bpy.ops.mesh.primitive_plane_add(size=20, location=(0, 0, 0))
# Add a cube for the figure
bpy.ops.mesh.primitive_cube_add(size=1, location=(0, 0, 1))
# Add a cylinder for the waterfall
bpy.ops.mesh.primitive_cylinder_add(radius=5, depth=10, location=(-5, 0, 0))
# Add a series of particles to represent the birds
bpy.ops.mesh.primitive_uv_sphere_add(size=0.1, location=(5, 0, 5))
bpy.ops.object.particle_system_add()
bpy.context.object.particle_system.point_density_radius = 0.5
bpy.context.object.particle_system.settings.count = 1000
# Set the background image
bpy.context.scene.world.background_image = bpy.data.images.load("image_file.jpg")
# Animate the figure
bpy.context.object.animation_data_create()
bpy.context.object.animation_data.action = bpy.data.actions.new(name="Figure Action")
# Create a keyframe for the start of the animation
bpy.context.object.animation_data.action.fcurves.new(data_path="location", index=1)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points.add(1)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points[0].co = (0, 0, 1)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points[0].interpolation = 'LINEAR'
# Create a keyframe for the end of the animation
bpy.context.object.animation_data.action.fcurves[0].keyframe_points.add(25)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points[1].co = (0, 0, 2)
bpy.context.object.animation_data.action.fcurves[0].keyframe_points[1].interpolation = 'LINEAR'
# Render the animation
bpy.ops.render.render(animation=True)
Koden feiler på linje 17, men rekker å lage et par enkle former før den kræsjer. En overflate, en sylinder og en liten kube.
Sist endret av Dodecha; 28. desember 2022 kl. 14:36.