Created
May 24, 2021 01:15
-
-
Save agrif/d22d62aadf89b575e4c5ef4dbfd8e777 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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