Skip to content

Commit

Permalink
improvement: use the PLY model files for various scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
Walther committed Aug 3, 2024
1 parent 6c47ad0 commit eb6dc76
Show file tree
Hide file tree
Showing 16 changed files with 353 additions and 223 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ply/**/*.ply binary linguist-generated

10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ If you make a PR to this repository, please acknowledge that you are giving all

### Model files

This repository has some example model files for demonstrating triangle-based object imports in addition to the declarative object primitives.
This repository has some example model files for demonstrating triangle-based object imports in addition to the declarative object primitives. Check the following directories:

- Utah Teapot model `teapot.stl` CC0 1.0 Universal Public Domain [Wikipedia](<https://en.wikipedia.org/wiki/File:Utah_teapot_(solid).stl>)
- Stanford Bunny model `bunny.stl` CC Attribution 3.0 Unported [Wikipedia](https://commons.wikimedia.org/wiki/File:Stanford_Bunny.stl)
- Stanford Dragon model `dragon.stl` (stl converted version) CC Attribution [Thingiverse](https://www.thingiverse.com/thing:27666)
- Rubber Duck model `duck.stl` CC0 1.0 Universal Public Domain [Thingiverse](https://www.thingiverse.com/thing:139894)
- Triangular Prism model `prism.stl` Public Domain [Wikipedia](https://commons.wikimedia.org/wiki/File:Triangular_prism.stl)
- `stl/`
- `ply/`
- `gltf/`

## Useful references

Expand Down
2 changes: 1 addition & 1 deletion gltf/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# gltf
# glTF models

Models borrowed from [glTF Sample Models](https://github.com/KhronosGroup/glTF-Sample-Models)
24 changes: 24 additions & 0 deletions ply/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# PLY models

These famous objects are from the [Large Geometric Models Archive at Georgia Tech](https://sites.cc.gatech.edu/projects/large_models/index.html).

| Model | Faces | Vertices |
| --------------- | --------- | -------- |
| Stanford Bunny | 69,451 | 35,947 |
| Stanford Dragon | 871,414 | 437,645 |
| Happy Buddha | 1,087,716 | 543,652 |

The files were converted from the ASCII ply format to the binary ply format using the `ply2binary` program, built from the sources available [here](https://sites.cc.gatech.edu/projects/large_models/ply.html). To quote from the README of that repository:

> These geometry filters have been developed on a Silicon Graphics
> workstation using the native C compiler. The code may very well run
> unmodified on other platforms but this has not yet been verified.
Indeed, the code assumes a different endianness from the running operating system. As a workaround, after running `./ply2binary < ~/example.ascii.ply > ~/example.binary.ply`, you need to edit the header in the binary file:

```diff
- format binary_big_endian 1.0
+ format binary_little_endian 1.0
```

After this change, the binary file can be read correctly by compliant parsers.
Binary file added ply/bunny.binary.ply
Binary file not shown.
Binary file added ply/dragon.binary.ply
Binary file not shown.
Binary file added ply/happy.binary.ply
Binary file not shown.
84 changes: 84 additions & 0 deletions scenes/bunny.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"time_0": 0,
"time_1": 1,
"background_color": [0.025, 0.025, 0.025],
"camera": {
"look_from": [0, 200, -800],
"look_at": [0, 200, 0],
"up": [0, 1, 0],
"vertical_fov": 40,
"aperture": 30,
"focus_distance": 650
},
"objects": [
{
"kind": "PLY",
"comment": "bunny",
"path": "ply/bunny.binary.ply",
"scale": 2500,
"center": [-45, -85, 0],
"rotation": [0, 200, 0],
"material": "white lambertian"
},
{
"kind": "Quad",
"comment": "floor",
"q": [-2000, 0.01, -500],
"u": [4000, 0, 0],
"v": [0, 0, 1000],
"material": "checkerboard"
},
{
"kind": "Quad",
"comment": "back wall",
"q": [-2000, 0, 500],
"u": [4000, 0, 0],
"v": [0, 1000, 0],
"material": "checkerboard"
},
{
"kind": "Sphere",
"center": [0, 800, -300],
"radius": 300,
"material": "lamp",
"comment": "big ceiling light",
"priority": true
}
],
"materials": [
{
"name": "dark lambertian",
"kind": "Lambertian",
"albedo": {
"kind": "SolidColor",
"color": [0.3, 0.3, 0.3]
}
},
{
"name": "white lambertian",
"kind": "Lambertian",
"albedo": {
"kind": "SolidColor",
"color": [0.8, 0.8, 0.8]
}
},
{
"name": "checkerboard",
"kind": "Lambertian",
"albedo": {
"kind": "SpatialChecker",
"even": [0.8, 0.8, 0.8],
"odd": [0.3, 0.3, 0.3],
"density": 0.01
}
},
{
"name": "lamp",
"kind": "DiffuseLight",
"emit": {
"kind": "SolidColor",
"color": [5, 5, 5]
}
}
]
}
117 changes: 66 additions & 51 deletions scenes/dragon.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,93 @@
{
"time_0": 0,
"time_1": 1,
"background_color": [0, 0, 0],
"background_color": [0.025, 0.025, 0.025],
"camera": {
"look_from": [0, 250, -800],
"look_at": [0, 250, 0],
"look_from": [0, 200, -800],
"look_at": [0, 200, 0],
"up": [0, 1, 0],
"vertical_fov": 40,
"aperture": 10,
"focus_distance": 800
"aperture": 30,
"focus_distance": 650
},
"objects": [
{
"kind": "Quad",
"comment": "back wall",
"q": [-2000, 0, 800],
"u": [4000, 0, 0],
"v": [0, 1000, 0],
"material": {
"kind": "Lambertian",
"albedo": { "kind": "SolidColor", "color": [1, 1, 1] }
}
},
{
"kind": "STL",
"kind": "PLY",
"comment": "dragon",
"path": "stl/dragon.stl",
"scale": 12,
"center": [0, 240, 250],
"rotation": [-90, -40, 0],
"material": {
"name": "Dense flint glass SF10",
"kind": "Dispersive",
"cauchy_a": 1.728,
"cauchy_b": 0.01342
}
"path": "ply/dragon.binary.ply",
"scale": 2500,
"center": [-45, -135, -100],
"rotation": [0, 200, 0],
"material": "white lambertian"
},
{
"kind": "Quad",
"q": [-2000, 0, -200],
"comment": "floor",
"q": [-2000, 0.01, -500],
"u": [4000, 0, 0],
"v": [0, 0, 1000],
"comment": "floor",
"priority": false,
"material": {
"kind": "Lambertian",
"albedo": { "kind": "SolidColor", "color": [1, 1, 1] }
}
"material": "checkerboard"
},
{
"kind": "Quad",
"q": [-200, 800, 100],
"u": [400, 0, 0],
"v": [0, 0, 400],
"material": {
"kind": "DiffuseLight",
"emit": { "kind": "SolidColor", "color": [7, 7, 7] }
},
"comment": "back wall",
"q": [-2000, 0, 500],
"u": [4000, 0, 0],
"v": [0, 1000, 0],
"material": "checkerboard"
},
{
"kind": "Sphere",
"center": [0, 800, -300],
"radius": 300,
"material": "lamp",
"comment": "big ceiling light",
"priority": true
}
],
"priority_objects": [
"materials": [
{
"kind": "Quad",
"q": [-200, 800, 100],
"u": [400, 0, 0],
"v": [0, 0, 400],
"material": {
"kind": "DiffuseLight",
"emit": { "kind": "SolidColor", "color": [7, 7, 7] }
"name": "dark lambertian",
"kind": "Lambertian",
"albedo": {
"kind": "SolidColor",
"color": [0.3, 0.3, 0.3]
}
},
{
"name": "white lambertian",
"kind": "Lambertian",
"albedo": {
"kind": "SolidColor",
"color": [0.8, 0.8, 0.8]
}
},
{
"name": "checkerboard",
"kind": "Lambertian",
"albedo": {
"kind": "SpatialChecker",
"even": [0.8, 0.8, 0.8],
"odd": [0.3, 0.3, 0.3],
"density": 0.01
}
},
{
"name": "lamp",
"kind": "DiffuseLight",
"emit": {
"kind": "SolidColor",
"color": [5, 5, 5]
}
},
{
"name": "copper",
"kind": "Metal",
"albedo": {
"kind": "SolidColor",
"color": { "hex": "#b87333" }
},
"comment": "big ceiling light",
"priority": true
"fuzz": 0.35
}
]
}
84 changes: 84 additions & 0 deletions scenes/happy_buddha.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"time_0": 0,
"time_1": 1,
"background_color": [0.025, 0.025, 0.025],
"camera": {
"look_from": [0, 200, -800],
"look_at": [0, 200, 0],
"up": [0, 1, 0],
"vertical_fov": 40,
"aperture": 30,
"focus_distance": 650
},
"objects": [
{
"kind": "PLY",
"comment": "happy buddha",
"path": "ply/happy.binary.ply",
"scale": 2200,
"center": [-18.5, -112, -130],
"rotation": [0, 200, 0],
"material": "white lambertian"
},
{
"kind": "Quad",
"comment": "floor",
"q": [-2000, 0.01, -500],
"u": [4000, 0, 0],
"v": [0, 0, 1000],
"material": "checkerboard"
},
{
"kind": "Quad",
"comment": "back wall",
"q": [-2000, 0, 500],
"u": [4000, 0, 0],
"v": [0, 1000, 0],
"material": "checkerboard"
},
{
"kind": "Sphere",
"center": [0, 800, -300],
"radius": 300,
"material": "lamp",
"comment": "big ceiling light",
"priority": true
}
],
"materials": [
{
"name": "dark lambertian",
"kind": "Lambertian",
"albedo": {
"kind": "SolidColor",
"color": [0.3, 0.3, 0.3]
}
},
{
"name": "white lambertian",
"kind": "Lambertian",
"albedo": {
"kind": "SolidColor",
"color": [0.8, 0.8, 0.8]
}
},
{
"name": "checkerboard",
"kind": "Lambertian",
"albedo": {
"kind": "SpatialChecker",
"even": [0.8, 0.8, 0.8],
"odd": [0.3, 0.3, 0.3],
"density": 0.01
}
},
{
"name": "lamp",
"kind": "DiffuseLight",
"emit": {
"kind": "SolidColor",
"color": [5, 5, 5]
}
}
]
}
Loading

0 comments on commit eb6dc76

Please sign in to comment.