Skip to content
This repository has been archived by the owner on Jul 17, 2021. It is now read-only.
/ voxel-textures Public archive

Unity jobified voxel with runtime generated texture atlas.

License

Notifications You must be signed in to change notification settings

Hertzole/voxel-textures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voxel Textures

This repository is very much inspired by this repository where they managed to have a greedy mesh with properly textured meshes. The only problem I found was that the texture atlas was pre-made. So I set out to fix that by generating the atlas during runtime and avoiding duplicate textures on the atlas.

This entire repository is just a proof of concept!

Job system

I also put the cube building inside a job mostly just to make sure it works inside the job system.

How the atlas generation works (roughly)

  1. Get all the unique textures
  2. Pack it into an atlas
  3. Figure out the X and Y index of each texture using the rect array returned when packing the atlas
  4. Calculate the atlas X and Y size (not in pixels but "texture amount")
  5. Calculate the atlas rect.

I commented the code to the best of my abilities so you can hopefully see how it works. There's only one script that generates a test cube with the textured applied.

Credits

bbtarzan12 and their repository for the shader and base code.

Image

About

Unity jobified voxel with runtime generated texture atlas.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published