#
https://blog.libove.org/posts/8f317f9c-9bc0-41cb-bc00-0a3e454781f0/
Turns out, just flipping every cell border edge, if they can be flipped. works perfectly. Resolves all problems and even creates better looking rooms.
Personal Blog about anything - mostly programming, cooking and random thoughts
https://blog.libove.org/posts/8f317f9c-9bc0-41cb-bc00-0a3e454781f0/
Turns out, just flipping every cell border edge, if they can be flipped. works perfectly. Resolves all problems and even creates better looking rooms.
https://blog.libove.org/posts/cdd98eb5-a1e7-4bcf-bf34-345ebcf20c44/
Implemented edge flip for corridors. For each cell which only has horizontal or vertical neighbors the edge between two cells is flipped. This works great but there are some edge cases that still need to be handled.
Geometry generation is now in an okay state. Next improvements are significantly harder and have almost no visual effect. For example merging the "pillar" geometry (green) correctly. At the moment these are just overlapping tubes.
Decided to work on the room layouts instead and started with a classical grid dungeon layout. Corridors still look incorrect and need an edge flip to align the flow of the ceiling correctly.
Progress on room generation.
Added walls to the room and removed the pillars in the room itself. These can still be placed in the data structure but my random generator isn't using them at the moment. The geometry is now mostly done for my purposes. The next step will be tooling to create and edit rooms manually.
I've found a simple way to create UVs for my ceiling geometry, built from Bezier triangles.
For each triangle I compute a LookAt matrix with the normal of the triangle as the view direction. For the up vector I use one edge of the triangle. The UV coordinates can then be calculated by applying this matrix to each sampled points and discarding the Z component.
let mut ps = [
self.room.surface_point(*face, 0.0, 0.0, 1.0),
self.room.surface_point(*face, 1.0, 0.0, 0.0),
self.room.surface_point(*face, 0.0, 1.0, 0.0),
];
ps.sort_by(|x, y| x.y.partial_cmp(&y.y).unwrap());
let v1 = ps[1] - ps[0];
let v2 = ps[2] - ps[0];
let n1 = v1.cross(&v2);
let lt = Matrix3::look_to_rh(n1.normalize().into(), v1.normalize().into());
UV coordinates on pillars and floor working. I've tinkered with UVs for the ceiling surfaces but have not found a solution yet. There are always discontinuities. The ceiling is created with quadratic Bezier triangles.
Any tips would be appreciated.
Cleaned up everything a bit and added a floor. All still in debug colors. Next will be to create proper UV coordinates to enable texturing.
https://blog.libove.org/posts/09353590-1a6d-421c-b77c-ab4220d30205/
Turn the edges of triangles into #geometry.
https://blog.libove.org/posts/f78065ca-93d9-428c-b36f-6131c164d84e/
Now as surfaces. Not sure if the normals are correct yet.