Sphere#

[ ]:
import fresnel
scene = fresnel.Scene()

The sphere geometry defines a set of N spheres. Each sphere has its own position, radius, and color.

[ ]:
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.

[ ]:
geometry.position[:] = [[-2,0,0], [0, 0, 0], [3, 0, 0]]

radius sets the radius of each sphere.

[ ]:
geometry.radius[:] = [0.5, 1.0, 1.5]
[5]:
scene.camera = fresnel.camera.Orthographic.fit(scene, view='front', margin=0.5)
fresnel.preview(scene)
[5]:
../../_images/examples_01-Primitives_00-Sphere-geometry_8_0.png

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]:
../../_images/examples_01-Primitives_00-Sphere-geometry_11_0.png

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]:
../../_images/examples_01-Primitives_00-Sphere-geometry_14_0.png

This page was generated from a jupyter notebook. You can download and run the notebook locally from the fresnel-examples repository.