Closed bfops closed 9 years ago
This should hold off until https://github.com/bfops/playform/issues/84 is done; lazy terrain generation will add some wrinkles into calculation of per-vertex normals, since they might need to be updated as more terrain is generated.
When a new block is generated, normals should be calculated for every triangle. Per-vertex normals will be created by averaging out the normals for the triangles that touch each vertex. For vertices that lie on the edge of the block, this means that we'll have to look at adjacent blocks to get all the triangles.
If those blocks don't exist, then we'll calculate the vertex normals from the available information, and update the averages when those blocks are generated.
It seems kind of difficult for a vertex in a block to figure out it "corresponds" to vertex from a neighboring block.
normals per-vertex instead of per-triangle 70985805f7c9a50a7ed858e78e71e3196d2feb74
calculate averaged vertex normals within each tile 607aeb9e0f530e1d583659e1db7a047a313be180
Next step is to have vertex normals be the average of all the triangle normals they touch, including across tile boundaries (but not across block boundaries). The final part is smoothing across block boundaries too, detailed a little above.
per-block smoothing 23257c483c6ee9729e2eb55bac0e828e76310c76
Generate normals locally by sampling the noise function for an approximate derivative 9328f4c17056604f167719db3cf19ca1be170204
http://www.reddit.com/r/rust_gamedev/comments/2k66gy/playform_a_progress_report/cllza4f