Bending Time
  • Home
  • Technical
  • Blog
  • About

Lifelike Virtual World Blog

PBR Tester

7/3/2024

0 Comments

 
As promised, following up from my Ocean Rendering blog post, I am providing my Physically-Based Rendering (PBR) test project in this post. A zip file containing the simple Unity project can be found here.
 
As discussed in my previous posts, a game engine’s rendering pipeline tends to not help us out when rendering the whole planet for a variety of reasons, one of which being computing the ocean wave geometry in ECEF or ENU coordinates, for example. This is why I’m implementing my own PBR solution so I can embed custom coordinate calculations in the pipeline.
 
There are many PBR references on the web. I primarily used the following resources:
  • https://learnopengl.com/PBR/Theory
  • https://www.jordanstevenstechart.com/physically-based-rendering
  • http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
  • https://www.pbr-book.org/
 
I used Unity 2021.3.11f1 LTS but the project is so simple it should be trivial to go to an older version of Unity. When you first open the project, open the TestPbr scene and you'll see a sphere off to the side of the main camera and the light as shown below.
Picture
Unity PBR Test Project
​There is a separate Test Viewer game object that you can move around independently from the light to get various vantages.
 
When you run the project, in the Game view, you can see the sphere being lit up by a shader. Select the TestPBR game object in the Hierarchy panel and you will see the little UI I put together in the Inspector to test Bending Time’s basic PBR rendering.
Picture
PBR Test with Inspector UI
​The first section is the Shading model. I provide the following "complete" models:
Picture
Complete Shading Models
I say complete models because this section controls all the presets for the remaining sections, which I describe below. They are complete shading models.
 
The next section allows you to select the primitive being shown. The sphere is all I’ve really used.
 
Next we have the light colour and intensity. So far, pretty straightforward.
 
The next three sections provide options to play with the light contributions from the three main sources: Diffuse, Ambient and Specular.
 
For Diffuse, I implemented basic Lambertian shading as well as the Oren-Nayar model.

For Ambient, I simply provided a “constant” model where you just set the intensity (or % contribution) of the ambient light.
​
The interesting part is in the Specular section. I modeled the specular using the typical contributions from the:

  • Normal Distribution Function (NDF),
  • Geometric Shadowing Function (GSF), and
  • Fresnel effect.
Picture
Specular Contribution Options
​I chose ranges and presets based on the linked-to resources above and what seemed to make sense. It seemed like I should be able to create a decent looking PBR sphere based on this but it seems to fall short of what PBR screenshots I’ve seen.
Picture
Cook-Torrance Model
​I would love for someone to look at this project and see what could be improved/fixed. I’m also providing it with the hope that other people can learn about PBR shading by using and experimenting with it.
 
Lux terrae.
 
--Sean
0 Comments



Leave a Reply.

    Author

    Sean Treleaven, Founder of Bending Time Technologies, building a lifelike virtual world.

    Posts

    -20240910 The Business of Bending Time
    -20240907 The Business of Virtual Worlds
    -20240827 Sun, Moon and Stars
    -20240821 Atmosphere/Sky Rendering
    -20240817 Forest/Ground Rendering
    - 20240703 PBR Tester
    - 20240630 Ocean Rendering
    ​- 20240609 Terrain Rendering
    ​​- 20240519 Earth Coordinate Systems
    - 20240513 
    It's Your Planet
    - 20240407 Hello Again, World


    Categories

    All

    RSS Feed

Copyright © 2025 Bending Time Technologies Inc. All rights reserved
  • Home
  • Technical
  • Blog
  • About