Shaders:PBRShaders

From Spring
Revision as of 21:28, 24 September 2018 by Maddox (talk | contribs) (Hello world)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

PBR stands for Physically Based Render, it's a technique for 3D surface shading that tries to replicate the physical properties of light when hitting a given surface. More info: https://en.wikipedia.org/wiki/Physically_based_rendering

One of the main advantages of PBR - besides looking extremely good for minimal effort by the artists - is how streamlined the process of generating the textures becomes. Regardless of if you created the textures \in an image editing program or in a dedicated texturing app like Substance Painter, you know that "what you see is what you get" - ie. the final look of the model in the target gaming engine will be the same as what you're seeing in your authoring software.

SanguinarioJoe (from Spring 1944) & Ivand (from ZeroK) have developed powerful PBR shaders for the Spring engine.


Ivand's PBR shader's install instructions
What you will need:

  1. Latest maintenance engine. Grab it here: https://springrts.com/dl/buildbot/default/maintenance/
  2. Custom unit shader gadget. Every mod has a bit different code, check if your game has it, if not copy from somewhere else. ZK variant: https://github.com/lhog/Zero-K/blob/pbrCUS_v1/LuaRules/Gadgets/api_custom_unit_shaders.lua
  3. PBR shader: https://github.com/lhog/Zero-K/blob/pbrCUS_v1/ModelMaterials/Shaders/pbr.lua
  4. PBR meta-material definitions: https://github.com/lhog/Zero-K/blob/pbrCUS_v1/ModelMaterials/10_pbr.lua
  5. model definition with PBR extension: https://github.com/lhog/Zero-K/blob/pbrCUS_v1/Objects3d/unit.dae.lua (replace "unit" by your actual unit model's name)
  6. unitDef file (ZK style, you might prefer your own): https://github.com/lhog/Zero-K/blob/pbrCUS_v1/units/unit.lua
  7. model and textures (not on github, provide your own). Make sure texture filenames and channel mappings are specified correctly in unit.dae.lua


If this all sounds too complicated from the first sight, you can just clone this demo branch: "git clone -b pbrCUS_v1 https://github.com/lhog/Zero-K.git". It's all in there except for textures and .dae file