Author Topic: Support for texture variations  (Read 1350 times)

JSwigart

  • Newbie
  • *
  • Posts: 16
    • View Profile
Support for texture variations
« on: November 27, 2018, 03:10:26 AM »
Ability to define an array of albedo,normal,displacement within a voxel definition as texture variations that are deterministically randomized for the world voxel position

JSwigart

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Support for texture variations
« Reply #1 on: November 27, 2018, 02:31:58 PM »
Actually, this is probably not a good way to implement this, as it would not be possible to add new variations without changing the appearance of an existing world. This is probably better implemented at the biome level instead.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 6642
    • View Profile
Re: Support for texture variations
« Reply #2 on: November 28, 2018, 09:37:19 PM »
It could be implemented at voxel definition level but yes, it would add complexity to a core data structure that may also impact overall performance. I agree that adding more flexibility to biome definitions is the way to go. Already in roadmap.

JSwigart

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Support for texture variations
« Reply #3 on: November 30, 2018, 08:18:20 PM »
I'd like to revise this request in a way that I think it both more useful and probably easier to implement.

The purpose of this request is obviously because texture variation across a voxel environment is desired, however I don't think the solution is to just randomize a set of grass tiles for instance, because although that provides more variation, it does it in a way that provides no control over the variations chosen. Suppose one variation doesn't look good next to another variation, etc.

Enter 'world space' texturing. The approach is this, use world space, in combination with texture wrapping, to be able to use textures larger than a voxel size so that a contiguous section of the same voxel type will not appear identical. It's still deterministic, because it's world space, but it's also much more artistically controllable.

Portal Knights appears to use this sort of technique. Notice how the stacks of greater than 1 voxel for things like dirt in particular(natural voxel types)
https://i.ytimg.com/vi/87a7n-zyZuw/maxresdefault.jpg
https://cdn.mmos.com/wp-content/gallery/portal-knights-overview/portal-knights-dessert.jpg

This is preferable to biome variation because biome level variation requires discrete voxel types, which artificially inflate voxel definition counts, which eat block indices, which in turn have gameplay related issues as well, such as losing the voxel variation after you pick up the block. For example, if you had 4 grass variations, you probably wouldn't have 4 different item types that maintain the mapping from the world voxel to the inventory item, you'd probably just have it pick up a grass item. When you place it back down though, unless you are tracking with that item somehow the variation that it was(which then has implications with stacking, etc), it will likely not maintain its appearance. Since all the desire of this is aesthetic based, a purely aesthetic approach would be most desirable. Faking it at the biome level has a cascade of undesired consequences.

I think the data pipeline might look like this.
Say my voxel texure size is 128
For a grass block I might create a 256x256 texture for each face or certain faces, etc, which contains 4 variations.
I also need to check a box for the texture that marks the texture as multi-texture variant, so it doesn't simply rescale it and put it in the texture array
At startup, it could still cut that texture into 4 for the sake of putting it into the texture array, but it would also need to remember that this grass block texture maps to one of 4 textures depending on world space

Thoughts?

JSwigart

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Support for texture variations
« Reply #4 on: November 30, 2018, 08:21:25 PM »
Portal knights is doing a bit more than just world space texturing, because they layer a bevel effect onto the texture as well for each side that doesn't have a neighbor. I believe we looked closely at this in the past and determined that the bevel effect was a texture/normal trick, though I'm not sure if it is layered onto the base block texture or if they have a smarter edge-aware texture selection.