Sphere¶
[1]:
import fresnel
scene = fresnel.Scene()
The sphere geometry defines a set of N spheres. Each sphere has its own position, radius, and color.
[2]:
geometry = fresnel.geometry.Sphere(scene, N=3)
geometry.material = fresnel.material.Material(color=fresnel.color.linear([0.25,0.5,0.9]),
roughness=0.8)
Geometric properties¶
position defines the position of each sphere.
[3]:
geometry.position[:] = [[-2,0,0], [0, 0, 0], [3, 0, 0]]
radius sets the radius of each sphere.
[4]:
geometry.radius[:] = [0.5, 1.0, 1.5]
[5]:
scene.camera = fresnel.camera.fit(scene, view='front', margin=0.5)
fresnel.preview(scene)
[5]:
Color¶
color sets the color of each sphere (when when primitive_color_mix > 0)
[6]:
geometry.color[:] = fresnel.color.linear([[0.9,0,0], [0, 0.9, 0], [0, 0, 0.9]])
geometry.material.primitive_color_mix = 1.0
[7]:
fresnel.preview(scene)
[7]:
Outlines¶
Outlines are applied on the outer edge of the sphere in the view plane.
[8]:
geometry.outline_width = 0.05
[9]:
fresnel.preview(scene)
[9]:
This page was generated from a jupyter notebook. You can download and run the notebook locally from the fresnel-examples repository.