Skip to content

Instantly share code, notes, and snippets.

@agrif
Last active May 24, 2021 05:06
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/57fce55772e5d64e58424f98a142c636 to your computer and use it in GitHub Desktop.
Save agrif/57fce55772e5d64e58424f98a142c636 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
s.renderer.spp_step = 4
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.color(1.0, 0.0, 0.0)
c.emission = carbide.scene.BladeTexture.color(0.5, 0.0, 0.0)
c.emission.modify(blades=6)
else:
c.bsdf.albedo = carbide.scene.CheckerTexture(res_u=4, res_v=4)
s.primitives += [c]
def update(status):
print('{}: {} / {}'.format(status.state.name, status.current_spp,
status.total_spp))
s.render('render.png', update=update)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment