Created
July 21, 2020 21:20
-
-
Save Eliah-Lakhin/a42caebfc0bac8b3369825f11c1b565e to your computer and use it in GitHub Desktop.
JHT-Rhai example
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
system.scene = Scene(|| { | |
this.add_light(PointLight(Point3(1.0, 2.0, 3.0)) | |
.set_brightness(1.0)); | |
this.add_light(PointLight(Point3(-3.0, 3.0, 0.0)) | |
.set_brightness(10.0)); | |
this.material.persist(); | |
this.material.shininess = 0.0; | |
this.material.color = Rgb(0.2, 0.4, 0.6); | |
this.add_shape(Tile(10, 10), || { | |
this.inflation_pattern = [ | |
0.5, | |
Planar().set_camera(Camera(|| { | |
this.position = Point3(0.0, 1.0, 0.0); | |
this.target_orientation = South(); | |
})), | |
Flat(|| { | |
this.warping.add( | |
WarpChain(Motion(Value()).set_octaves(4)) | |
.scale_u(Vector2(5.0)) | |
.scale_v(Vector2(10.0)) | |
.then_warp_translation() | |
.scale_u(Vector2(3.0)) | |
.scale_v(Vector2(3.0)) | |
.then_warp_translation() | |
); | |
this.view.scale(Vector2(2.0)); | |
this.add_pattern(Landscape(Motion(Value()).set_grow_factor(1.0))); | |
}) | |
]; | |
this.complexity = 2.5; | |
}); | |
this.material.restore(); | |
this.material.persist(); | |
this.material.color = Gray(1.0); | |
this.material.reflection = 0.5; | |
this.material.roughness = 0.45; | |
this.add_shape(Sphere(1.0).set_center(Point3(0.0, 1.5, 0.0))); | |
this.material.restore(); | |
this.material.color = Rgb(0.7, 1.0, 0.7); | |
this.material.reflection = 0.9; | |
this.add_shape(Cuboid(7.0, 3.0, 0.1).set_center(Point3(0.0, 1.5, -3.0))); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script produces the following image based on JHT rendering capabilities: