chunky icon indicating copy to clipboard operation
chunky copied to clipboard

Generate PBR maps

Open jackjt8 opened this issue 3 years ago • 2 comments

Re: #751 - One of the issues blocking PR #1276 from being merged is what to do in the event a certain block surface doesn't have a PBR map. Or, in the event that no PBR resource pack is loaded can we still somehow implement PBR features.

Generating PBR maps may prove useful.

  • Emittance Maps - Multiply the emittance by the perceived brightness of the albedo and have a customisable threshold slider.
  • Normal Maps - Treat texture as "grayscale" heightmap. ie if the pixel is brighter than the one to its left the normal will point to the left (same thing for up down and right). FYI - Complementary Shaders use the length function = sqrt(R² + G² + B²) so it's not exactly grayscale.

PBR maps that it may not be possible to generate:

  • Perceptual Smoothness
  • Reflectance (F0)/Metalness
  • Porosity/Subsurface scattering
  • Material AO
  • Height Map

jackjt8 avatar Jun 12 '22 14:06 jackjt8

As discussed on Discord, implementing this does not help with the pbr map issues. To fix those, we need a way for a ray to know the previously hit material and whether that had PBR maps. PBR maps are per texture, material properties are per block.

Ideally, we would change this so that material properties are per material (~ texutre) of a block. Then we can check if the material has pbr maps and if not, just don't multiply them.

As an intermediate solution with less effort, we could make a ray remember the texture it hit and use that to check for pbr maps.

leMaik avatar Jun 12 '22 20:06 leMaik

CC0 - Minecraft PBR Texture Generator (.blend)

This tool converts a normal Minecraft texture (or really any texture, but it hasnt been tested on normal textures yet.) into a PBR texture with 8 maps! This tool needs Blender to work, make sure to install it if your going to use this tool.

Given the tool is CC0 it may be worthwhile to port the functionally to Chunky. That way, if any PBR map is missing we could fallback onto a generated map.

jackjt8 avatar Jun 13 '22 19:06 jackjt8