Voxel Project: UV 2
- Kyle W
- Jul 21, 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.

Next Week
With the major issue that came up with the convex collider, I would like to go back and find a way to either allow rigidbody to still work, or mimic physics with my own script. I would also like to restore lighting on the voxel grid, as well as use a better solution than having two sets of uv coordinates on one grid. Most importantly, I would like to have a way for one grid to display multiple materials, similar to how I can paint the grid different colors.
Bình luận