Skip to content

Instantly share code, notes, and snippets.

@tylermorganwall
Created November 1, 2025 04:02
Show Gist options
  • Save tylermorganwall/b38b2b832d4b04941fb16f0946196f89 to your computer and use it in GitHub Desktop.
Save tylermorganwall/b38b2b832d4b04941fb16f0946196f89 to your computer and use it in GitHub Desktop.
rayrender pumpkin, 2025
library(rayrender)
single_lobe = csg_ellipsoid(axes = c(1, 1.5, 1) / 2)
double_lobe = csg_combine(
csg_translate(single_lobe, x = 0.5),
csg_translate(single_lobe, x = -0.5),
operation = "blend",
radius = 0.1
)
pumpkin = csg_combine(
csg_combine(
csg_rotate(double_lobe, angles = c(0, 60, 0)),
csg_rotate(double_lobe, angles = c(0, -60, 0)),
operation = "blend",
radius = 0.1
),
double_lobe,
operation = "blend",
radius = 0.1
)
csg_object(
csg_combine(
pumpkin,
csg_group(
list(
csg_scale(pumpkin, scale = 0.9),
csg_sphere(y = -0.2, z = 1, radius = 0.3),
csg_sphere(y = 0.3, z = 0.8, x = 0.3, radius = 0.2),
csg_sphere(y = 0.3, z = 0.8, x = -0.3, radius = 0.2)
)
),
operation = "subtract"
),
material = diffuse(color = "#e27500ff")
) |>
add_object(generate_ground(
material = diffuse(color = "#491e08ff"),
spheresize = 10000,
depth = -0.8
)) |>
add_object(extruded_path(
points = list(c(0, 0.5, 0), c(0.1, 1.2, 0)),
width = 0.4,
width_end = 0.2,
material = diffuse(
color = "#322303ff",
noise = TRUE,
noisecolor = "#081e03ff",
noiseintensity = 50,
noisephase = 150
)
)) |>
add_object(sphere(
radius = 0.05,
material = light(intensity = 100),
y = -0.2
)) |>
add_object(cylinder(radius=0.1,length=0.2,y=-0.35, material=diffuse(color="grey20"))) |>
add_object(obj_model(r_obj(simple_r = T),scale = 0.19,x=0.3,y=0.13,z=0.85, angle=c(-10,10,0), material=diffuse(color = "#e27500ff"))) |>
add_object(obj_model(r_obj(simple_r = T),scale = 0.19,x=-0.3,y=0.13,z=0.85, angle=c(-10,-10,0),material=diffuse(color = "#e27500ff"))) ->
scene_pumpkin
render_scene(scene_pumpkin, intensity_env = 30,width=600,height=600)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment