Voxel Project: Final
- Kyle W

- Aug 5, 2022
- 2 min read
Adding Textures
Following up from last week, I worked on adding textures to the voxel while still being able to paint individual voxels. I replaced the standard Unity material with a shader that is modified to take in two textures: the dynamic texture used for painting the voxels, and a normal texture. In addition to the uv coordinates from last week, I also now feed a second set of uv coordinates into the voxel mesh for texturing. However, I ran into some issues while trying to use Unity's standard shader as a base, as it used some unfamiliar syntax and the documentation is a lot more sparse compared to their C# script documentation. To get around this I swapped to the unlit shader, which is a little more straight forward, so for now the voxels don't have lighting.

I was also able to fix the textuing issue from last week by adjusting the offsets I use on the uv coordinates, so now there isn't any weird fuzziness with the textures. However, I ran into a completely separate issue while testing the voxels. When adding the slicing mechanic to the voxels, I had added a rigidbody, and in order to simulate physics, I had to enable the convex option for the collider. Because of this, the mesh collider is overriden with a simpler version of the collider that doesn't have any holes in it. Because of this, I've had to disable the physics on the voxel mesh for now, and most likely will have to come up with a way to simulate physics in the future.

Materials
I also tried adding a the ability to paint materials as well as colors, though I'm not sure how good of a feature this is to have, since it means theoretically an infinite number of materials are loaded and unloaded in a single mesh. Additionally, for each unique material, the mesh has to be divided into separate sub-meshes, further complicating matters. Because of this, I don't think it is very performance friendly




Comments