-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from KyroVibe/kyro/maze-mesh-2
Materials, Meshes, and all around Polishing
- Loading branch information
Showing
52 changed files
with
2,217 additions
and
633 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Hunter Barclay, Jordan Casper, and Josh Martin | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,81 @@ | ||
# Maze Group Project | ||
This is a group project for CS464. Team is Hunter Barclay, Josh Martin, Jordan Casper. | ||
|
||
## Usage | ||
|
||
### GitHub Pages | ||
The project is hosted with GitHub pages [here](https://kyrovibe.github.io/MazeGroupProject/). | ||
|
||
### Self Hosting | ||
This web app can be used with a simple http server and accessed by most if not all web browsers. | ||
|
||
For http servers, theres a number of quick options for testing: | ||
- NPM package `http-server`: | ||
``` | ||
$ npm install -g http-server | ||
$ cd /path/to/repo/ | ||
$ http-server | ||
``` | ||
- Golang package `claat`: | ||
``` | ||
$ go install github.com/googlecodelabs/tools/claat@latest | ||
$ cd /path/to/repo/ | ||
$ claat serve | ||
``` | ||
- Python `http.server`: | ||
``` | ||
$ cd /path/to/repo/ | ||
$ python3 -m http.server | ||
``` | ||
|
||
## Planning | ||
[Trello Board](https://trello.com/b/FvLTHeI2/maze) | ||
[Trello Board](https://trello.com/b/FvLTHeI2/maze). | ||
|
||
## Technologies Used | ||
This project will use JavaScript within an html page. We will make use of WebGL for 3d graphics. | ||
|
||
## The Code | ||
### Core Components | ||
#### Renderer | ||
TBD | ||
|
||
#### Maze Generation | ||
##### Example | ||
![maze example](/docs/maze-sample.png) | ||
|
||
This is an example of a generate maze. The start is marked with an `S` and the end is marked with an `E`. | ||
|
||
##### Algorithm | ||
The maze generation starts with a grid graph, with each node connected to its vertical and horizontal neighbors. We then construct a second graph that starts with some random node in the former. Then if it has a neighbor not in the new graph, we randomly select one to add to the new graph and create an edge between the start node and the new node. We then recursively do this for the new node, then reevaluate and do this until all nodes in the original graph are in the new graph. | ||
|
||
We store all leaf nodes of the new graph (except for the start node if it is a leaf node) and sort them in ascending order by distance from the starting node. We then use a difficulty factor to determine how close to the front or back of this list we pick the end point. | ||
|
||
#### Main Game Loop | ||
### Techniques of Note | ||
#### Batch Rendering | ||
For rendering the walls of the maze, we will be utilizing batch rendering to try and make rendering multiple of the same mesh faster. | ||
Batch rendering is a technique used to efficiently render multiple instances of geometry in a single draw call. | ||
The *loadBatchInstances* method handles the loading of batch instances into buffers meant for rendering. | ||
It iterates through a subset of *batchInstances* based on the provided start index and the batch size. | ||
For each batch instance, it calls *writeInstanceToBuffer* on the batch instance. This method writes the instance's vertex, normal, texture coordinate, and index data into the respective buffers. Incrementing offsets ensures that each instance's data is placed correctly in the allocated buffers without overwriting previously loaded data. The method returns the number of batch instances loaded during this iteration. | ||
The *draw* method utilizes the loaded instances to perform draw calls efficiently. It renders batches in iterations, minimizing redundant calls and ensuring the rendering of all loaded instances. | ||
|
||
#### Frustrum Culling | ||
With making use of batch rendering, we'll be using frustrum culling to determine which parts of the maze can actually be seen by the user and only render those. This will cut down on the number of objects we need to render considerably. | ||
|
||
## Assets | ||
### Meshes | ||
The [Sphere Mesh](/assets/meshes/sphere.obj) was created in Blender, used for testing materials. | ||
|
||
### Textures | ||
The following textures were all distributed under a [Creative Commons License](/assets/textures/CC_LICENSE.md) and were sourced from [3D Textures](https://3dtextures.me/): | ||
- [Terracotta Tiles Textures](/assets/textures/style-brick2/) | ||
- [Stylized Bricks Textures](/assets/textures/style-brick/) | ||
- [Stylized Grass Textures](/assets/textures/style-grass/) | ||
- [Stylized Dry Mud Textures](/assets/textures/style-dry-mud/) | ||
- [Ground Dirt Textures](/assets/textures/ground-dirt/) | ||
|
||
## License | ||
This repository is under the [MIT License](/LICENSE.md). | ||
|
||
Read below to see which assets/files were sourced under different licenses. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Blender MTL File: 'None' | ||
# Material Count: 1 | ||
|
||
newmtl None | ||
Ns 500 | ||
Ka 0.8 0.8 0.8 | ||
Kd 0.8 0.8 0.8 | ||
Ks 0.8 0.8 0.8 | ||
d 1 | ||
illum 2 |
Oops, something went wrong.