Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/charlesaverill/zenith
A wireframe renderer written in OCaml
https://github.com/charlesaverill/zenith
Last synced: about 6 hours ago
JSON representation
A wireframe renderer written in OCaml
- Host: GitHub
- URL: https://github.com/charlesaverill/zenith
- Owner: CharlesAverill
- License: mit
- Created: 2023-10-10T04:04:16.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-18T06:37:06.000Z (about 1 year ago)
- Last Synced: 2024-04-20T00:54:42.533Z (7 months ago)
- Language: OCaml
- Homepage:
- Size: 46.7 MB
- Stars: 19
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZENITH
![ZENITH Logo](media/logo.gif)
ZENITH ("Zen Engine for Navigating wIreframes In Three-dimensional Holographic space") is a wireframe renderer written in OCaml.
## Usage
ZENITH is built with [dune](https://dune.build), and depends on the OCaml `Graphics` library. To run:
```
# Will render the Utah teapot .obj file
make run
# Will render each object around a circle
OBJS="path_to_obj path_to_another_obj ..." make run
# Renders the demo shown below
OBJS="objs/uv_sphere.obj objs/torus.obj objs/star_destroyer.obj \
objs/pyramid.obj objs/cube.obj objs/blender_monkey.obj objs/arwing.obj" make run
# Renders the lambda cube below (uses a debug feature set at compile-time)
OBJS="objs/lambdacube.obj" make run
```![demo](media/demo.gif)
![lambdacube](media/lambdacube.gif)
## Writeups
| Checkpoint | Summary |
| ----- | ----- |
| [Bad Perspective](media/bad_perspective/BadPerspective.md) | My meshes are close to rendering correctly, but some issue with my perspective transformation maps some vertices to the origin |
| [Success 1](media/success1/Success1.md) | My meshes now render properly |
| [Success 2](media/success2/Success2.md) | I can now load meshes from `.obj` files |## Notes
### Blender
If you want to color your Blender models, the only shader compatible with the `Kd` (diffuse color) field of a .MTL file is Principled BSDF.
The logo [model](objs/zenith.obj) and [material](objs/zenith.mtl) were designed in Blender and are a suitable example of supported .OBJ and .MTL vernacular.
Blend file available [here](media/logo.blend).### Supported .OBJ Vernacular
```obj
# Comments
# Vertices
v 0.0 1.9 -5.8
v 1.1 0.4 -0.7
v 38.4 0.2 7.1
# Lines
l 1 2
l 2 3
# Faces
f 1 2 3
# Faces with vertex normals (ignored)
f 1/1/1 2/2/2 3/3/3
# .MTL File Locations
mtllib mymat.mtl
# Material Usage
usemtl MyMat
```If two faces share edges but not materials, the face occurring later in the file will overwrite those edges' colors.
### Supported .MTL Vernacular
```mtl
# Material Name Declarations
newmtl MyMat
# Diffuse Color
Kd 0.5 0.75 1.0
```### Axis configuration
```
Y
|
|
|
--------- X
/
/
/
Z
```