PBR Shader Demo

PBR Shader Demo

Location - here

Model -

Created in Blender 2.8 using Google Maps and irl photos for reference. Building footprints and dimensions were recreated using GPS measurements and visual references. All modeled assets were created personally including, buildings, trees and terrain. Full scene view comes in at 735k tris (post-optimization), including all vegetation.

Textures -

Tree leaves and small branch texture created using Blender 2.8. Small branch was modeled, and populated with leaves using Blender’s particle system, then baked to a 2k albedo only texture. All other textures were acquired from Poliigon and were imported at 4k whenever possible to stress the VRAM capacity.

Project settings -

The scene was constructed in Unity 2019, using default “ultra” settings, with the exception of disabled VSync for benchmarking purposes. GI is realtime, and no baked or precomputed lighting was used in scene to maximize the lighting stress on the system. A build was tested on two machines.

On a R9 3900x / RTX 2070 Super system clocking over 300fps in an empty scene, 65 - 120fps was maintained in the scene depending on the number of assets in frame.

On a i7-5700HQ / GTX 970M system clocking over 130fps in an empty scene, 35 - 63fps was maintained in the scene depending on the number of assets in frame.

Triplanar material shader -

A single PBR triplanar shader setup, in specular and metallic workflow variants, were used for all non-foliage materials in the scene. Materials made use of, but were not required to include albedo, normals, specular/metallic maps, and ambient occlusion maps.

A secondary albedo and normal detail layer could be utilized to maximize texel density at extremely close distances. Testing showed that lowering texture resolution to 1k sufficiently maintained detail with aid of the detail layer.

The triplanar sampler was tuned to result in minimal distortion of non-orthogonal faces in blending. For example, tightly beveled stair edges exhibited minimal bleeding on radius, and both albedo and normal maps behaved acceptably on rounded objects such as the tree trunks.

Subsurface scattering shader -

A subsurface scattering foliage shader was used for the small branches and leaves of the trees. The shader samples the albedo alpha layer for opacity clipping masking.

For non-opaque light behavior and the appearance of light transmission, a custom Blinn-Phong based shader was constructed. The modified Blinn-Phong model was altered to use a blend of light color and albedo color to determine the specular reflection.

A secondary light model was constructed using a transformed view direction and light direction dot product to simulate back lighting.

Unity’s shadow maps were used to mask the effect to prevent non-direct lighting from contributing to luminescence.

Simplex noise based vertex displacement was added to create the impression of wind disturbance.


Amplify’s Impostor system and Unity’s LOD scaling features were used to lightly optimize the scene. A single level of detail step was included to make use of impostors when objects were at 25 - 35% of full view. Due to the geometry of the scene, this meant that the small optimization netted a roughly 30% savings in tris at full view.


Noise and Shader Demo

Noise and Shader Demo

 Model -

Smooth shaded low poly model created in Blender.

Fish Shader -

Two tone color generated by interpolation based on vertex position relative to object space. Albedo texture detail created generated using a trigonometric modification of Simplex noise algorithm. Specularity controlled by filtering generative albedo texture.

Animation applied to static mesh asset by applying object space depth masked sinusoidal wave to vertices in shader. Animation period offset by transform “y” position to create variation in animation cycle while maintaining single non-GPU-instanced material.

Terrain -

Generative terrain chunks created using Perlin noise implementation on two multiplied scales.

Terrain texture created using multiple layers of Simplex noise relative to fragment’s “x” and “z” positions.

Behavior -

Fish spawn in multiple distinct boids flocks, using only cohesion, alignment, and random position.

Finite state machine controls fish reaction to player, switching between boids flocking, and linear gaze avoidance.

Behavior opitmized by limiting and scheduling flock positional reference allocation with a centralized controller.