Simple implementation of octahedral impostors in Godot. Inspired by shaderbits article and this Unity implementation. This implementation uses only one plane to imitate a three-dimensional object from multiple angles.
Clone git repository:
git clone -b v2.0-new-baker --single-branch https://github.com/wojtekpil/Godot-Octahedral-Impostors.git
Or just download a source code zip file and copy addons/octahedral_impostors to your own project. Go to Project -> Project Settings... -> Plugins and enable "Octahedral Impostors"
Features:
Full & Hemi Sphere mode impostors
Depth based frame blending
Paraller baking alghorithm
Shadow mesh baking
Dynamic lightning support
Builtin Light & Standandard (ORM) profiles
Custom image atlas resolution and frames number
Image atlas dimmensions size optimalisation for selected maps
Alpha Cut (Scizzors) or Dither
Atlas Covarage ratio (WIP)
Extensible profiles and map baking algorithms
Atlas texture post dilatation
Batch impostor baker:
VisualShader Nodes:
The user interface is integrated with the editor. Just select any GeometryInstance
(MeshInstance, ImmediateGeometry, etc..) and a button called Octahedral Impostor
will show up. Selecting a node tree with a GeometryInstance
will also work. CSG nodes aren't supported and would have to be converted. You can also use new batch baking mode described below.
Once you're in the baking window, you will have access to the following controls.
Standard
baker will generate additional textures. Use Light
for better performance.Click Generate
and select where you want to save the impostor and its images; preferably inside their own folder. Wait until the progress bar gets to 100%. It should automatically (re)import the generated textures:
Tips:
MultimeshInstances
In a generated shader, sometimes the parameters should be changed to achieve better results.
Its new type of resource storing a list of atlas maps to be baked together with
desired impostor shader & shadow impostor shader. User can create custom profiles
with new map baking scripts (check /plugins/octahedra_impostors/scripts/baking/maps
) and shader (can be created using provided VisualShader nodes).
There are currently two builtin versions of shaders:
Shader | Standard | Light |
---|---|---|
Sphere mapping | :heavy_check_mark: | :heavy_check_mark: |
Hemisphere mapping | :heavy_check_mark: | :heavy_check_mark: |
Grid blending | :heavy_check_mark: | :heavy_check_mark: |
Depth maps | :heavy_check_mark: | :heavy_check_mark: |
Shadows | :heavy_check_mark:* | :heavy_check_mark:* |
Metallic textures | :heavy_check_mark: | :x: |
Roughness textures | :heavy_check_mark: | :x: |
AO textures | :heavy_check_mark: | :x: |
Alpha cutoff | :heavy_check_mark: | :heavy_check_mark: |
Alpha dither | :heavy_check_mark: | :heavy_check_mark: |
Mipmaps | :x: | :x: |
Custom shaders can be easly added using custom baking profiles.
To create scene with automatic impostors LOD system each mesh object (or a group of objects) intented to be baked must be a child of OctaImpostor node.
Impostor can be configurable in Inpsector Property panel:
Remember to postion the OctaImpostor node on the scene, try to keep child nodes translation close to [0,0,0].
After all desired meshes (with OctaImpostor parents) are placed on the scene Go to Project -> Tools -> Scene Octahedral Impostor Baking
. Select Settings
tab and choose directory to save all of the generated impostors. Its recommended to select empty directory. You can also overwritte some per impostor settings here.
Go back to QueuedScenes
tab. Select all OctaImpostor nodes you want to bake.
Click Generate
and close baking window after its done.
You can experiment with Lod Distance
settings in each of the OctaImpostor nodes for best results.