Builds an earless, low-poly mesh pig from compact data included in rayrender. The skiing outfit includes goggles, a scarf and skis; the spider variant has eight legs, four eyes and procedural copper-colored hair curves.
Default 0. x-coordinate offset of the pig.
Default 0. y-coordinate offset of the pig.
Default 0. z-coordinate offset of the pig.
Default "neutral". Facial expression: neutral, skeptical,
worried, angry, surprised, or excited. cheerful is an alias for
neutral. When omitted with ski = TRUE, the expression is excited.
Default FALSE. Generate an eight-legged, four-eyed spider pig.
Default c(0, 0, 0). Rotation in degrees about the x, y and z axes.
Default c(1, 2, 3). Order of the rotation axes.
Default c(1, 1, 1). Uniform scalar or x/y/z scale factors.
Default 0. Oren-Nayar roughness for diffuse surfaces,
including the skin. Does not affect glossy eyes, lenses or hair.
Default FALSE. Add the ski outfit and skiing pose. If both ski
and spider are TRUE, warns "spiders can't ski" and generates the spider
without ski gear.
Default 12000. Number of procedural spider hair curves.
Set to zero for a bare spider mesh. Ignored for a regular or skiing pig.
Default 1. Multiplier for spider hair lengths.
Default 8. Reproducible spider hair seed; preserves the
caller's random-number state.
Default NULL. Use the built-in rust/copper hair palette.
Supply a single hair() material to override the entire coat.
A scene tibble containing mesh objects and, for a hairy spider, curves.
Geometry, expression heads and the ski pose are assembled in memory;
no OBJ paths, downloads, Blender or rgl installation are required. The
character faces +X, uses Y up, and retains the rotation/scale pivot at
c(0, 1, 0). Feet or skis rest approximately at y - 0.6 before rotation
and scaling. The mask and goggles can obscure eyebrows in skiing poses.
Hair uses tapered bezier_curve() objects with hair() materials. A
finite bounce limit, such as max_depth = 12, is useful for dense fur.
sky_light_hosek = sky_light_image(40,-74,datetime = as.POSIXct("2026-06-21 18:00:00", tz = "America/New_York"))
generate_ground(depth = -0.6) |>
add_object(pig()) |>
add_infinite_light(sky_light_hosek) |>
render_scene(lookfrom = c(5.46, 3.03, 2.48), iso=4,
lookat = c(1.90, 1.65, 0.62), fov=40, samples=16)
generate_ground(depth = -0.6, material = glossy(color="white")) |>
add_object(pig(ski = TRUE)) |>
add_infinite_light(sky_light_hosek) |>
render_scene(lookfrom = c(5.46, 3.03, 2.48), iso=4,
lookat = c(1.90, 1.65, 0.62), fov=40, samples=16)
generate_ground(depth = -0.6) |>
add_infinite_light(sky_light_hosek) |>
add_object(pig(spider = TRUE, hair_count = 5000)) |>
render_scene(lookfrom = c(10.48, 3.31, -3.45), iso=4,
lookat = c(1.97, 1.46, -0.36), fov=40, samples=16)