Skip to content

Instantly share code, notes, and snippets.

@agrif
Created May 24, 2021 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agrif/d22d62aadf89b575e4c5ef4dbfd8e777 to your computer and use it in GitHub Desktop.
Save agrif/d22d62aadf89b575e4c5ef4dbfd8e777 to your computer and use it in GitHub Desktop.
import carbide
import numpy as np
s = carbide.scene.Scene()
s.camera.resolution.modify(1920, 1080)
s.renderer.spp = 64
a = carbide.scene.Sphere()
a.translate(-2, 0, 5)
a.emission = carbide.scene.ConstantTexture.grey(2.0)
s.primitives += [a]
for _ in range(100):
c = carbide.scene.Cube()
c.scale(0.5)
c.rotate(np.random.uniform(-1, 1, size=3), np.random.uniform() * 360)
c.translate(*(np.random.uniform(-1, 1, size=3) * 2))
c.translate(0, 0, 10)
if np.random.random() < 0.1:
c.bsdf.albedo = carbide.scene.ConstantTexture(1.0, 0.0, 0.0)
s.primitives += [c]
print(s.dumps(None, indent=4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment