• Stars
    star
    529
  • Rank 83,810 (Top 2 %)
  • Language
    C#
  • License
    MIT License
  • Created over 5 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tiny, GPU-based Bent Normal and Ambient Occlusion baker for Unity.

--> Successor/cousin repository

BNAO

alt text alt text

Features

  • Supports baking ambient occlusion or bent normal maps from low-poly geometry, right in the editor.
  • Supports baking with alpha-tested materials.
  • Bakes textures for selected objects and automatically groups meshes into same output textures based on material usage (with option for overriding grouping).
  • Can bake tangent, object and world-space bent normal maps.
  • Automatically uses normal maps present in original materials for a higher quality result.
  • Can bake objects with or without occlusion from other scene objects.
  • Can convert normal maps from tangent to object space and vice-versa.

Requirements

BNAO runs on regular (as in, not compute) shaders and thus does not demand much from your GPU. However, it does require support for floating point and shadow map format render textures. To check if this is supported on your platform, use these functions:
SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBFloat);
SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Shadowmap);

What are bent normals?

alt text
Bent normal maps store the direction of least occlusion (in other words, the direction in which the most ambient light is coming from) in a texture.
They can be used to occlude cubemap reflections based on the view direction in a much more realistic way than just multiplying with an ambient occlusion term. They can also be used to get an ambient color value which more closesly resembles a ray traced result.
For details on how to implement these effects in your own shader, see the file "Shader Implementation Example.txt".

Can I specify a max distance for the ambient occlusion?

No. The baker uses depth textures (similar to shadow mapping) to determine ray intersections, which makes it impossible to bias the result based on distance.

The normals convertor outputs weird results!

Make sure your texture settings for the input texture are correct. For TS normals just set "Texture Type" to "Normal Map". For OS normals, leave it at "Default" but uncheck "sRGB (Color Texture)".

More Repositories

1

MinimalAtmosphere

A minimal atmospheric scattering implementation for Unity
C#
459
star
2

BakerBoy

A single-component, GPU-based universal ambient occlusion and bent normal baker for Unity. The successor to my BNAO respository
HLSL
302
star
3

MeshDecal

A simple mesh decal component for Unity
C#
210
star
4

TerrainPrettifier

A small GPU-based component designed to aid in cleaning and refining satellite/DEM based terrains directly inside Unity.
C#
185
star
5

CloudNoiseGen

A static utility class for Unity which handles generating and loading periodic, cloud-like (perlin-worley) 3D noise textures on the GPU.
C#
127
star
6

VolumetricTracer

A simple way to render soft, volumetric bullet tracers in Unity. Only needs a unit cube and a material to render and supports instancing.
ShaderLab
117
star
7

CapsuleOcclusion

Unity package implementing clustered capsule/character occlusion
C#
92
star
8

VertexColorBaker

A tiny vertex color baker for Unity that runs on the GPU, implemented as an AssetPostprocessor
C#
86
star
9

SDFGI

A Monte Carlo path tracer implemented on the GPU in Unity, using Signed Distance Fields.
C#
77
star
10

Celery

Mask
24
star
11

SphericalHarmonicsDev

ShaderLab
10
star
12

SphericalHarmonics

HLSL
9
star
13

TNM084_Lab3

A procedural lava ball in Unity
C#
5
star
14

BasicPlayerMovement

A super simple Unity demo featuring two ways of doing basic player and camera movement.
C#
5
star
15

AtomicSurfer

A super-rad surfing/shark shooter simulator.
C#
4
star
16

TextureProcessor

Static utility class for processing texture on the GPU.
C#
4
star
17

InfinitePain

A RougLike FPS created during a game jam
C#
4
star
18

LiTHeLan_Final

C#
3
star
19

LudumDare38

C#
2
star
20

iMat

Java
1
star
21

MoS

C#
1
star