Skip to content

Commit

Permalink
Merge pull request #53 from snagy/master
Browse files Browse the repository at this point in the history
Additional work to README appendix
  • Loading branch information
snagy authored Oct 19, 2017
2 parents a946552 + 39df837 commit cc59f4a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,17 @@ Finally, we can compute the final color by summing the contributions of diffuse

`finalColor = (diffuseLight + diffuseColor) + (specularLight * (specularColor * brdf.x + brdf.y))`

Some Results
Appendix
------------

Here are some resulting renders from the demo application.

**Telephone Model**

![](images/Telephone.gif)
The core lighting equation this sample uses is the Schlick BRDF model from [An Inexpensive BRDF Model for Physically-based Rendering](https://www.cs.virginia.edu/~jdl/bib/appearance/analytic%20models/schlick94b.pdf)

**BarramundiFish Model**

![](images/BarramundiFish.gif)

Appendix
------------
```
vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);
vec3 diffuseContrib = (1.0 - F) * diffuse;
```

In this section, you'll find alternative implementations for the various terms found in the lighting equation.
Below here you'll find common implementations for the various terms found in the lighting equation.
These functions may be swapped into pbr-frag.glsl to tune your desired rendering performance and presentation.

### Surface Reflection Ratio (F)
Expand Down Expand Up @@ -162,10 +156,34 @@ float geometricOcclusion(PBRInfo pbrInputs)
}
```

### Microfaced Distribution (D)

**Trowbridge-Reitz**
Implementation of microfaced distrubtion from [Average Irregularity Representation of a Roughened Surface for Ray Reflection](https://www.osapublishing.org/josa/abstract.cfm?uri=josa-65-5-531) by T. S. Trowbridge, and K. P. Reitz

```
float microfacetDistribution(PBRInfo pbrInputs)
{
float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
return roughnessSq / (M_PI * f * f);
}
```

### Diffuse Term
The following equations model the diffuse term of the lighting equation.
The following equations are commonly used models of the diffuse term of the lighting equation.

**Lambert**
Implementation of diffuse from [Lambert's Photometria](https://archive.org/details/lambertsphotome00lambgoog) by Johann Heinrich Lambert

```
vec3 diffuse(PBRInfo pbrInputs)
{
return pbrInputs.diffuseColor / M_PI;
}
```

***Disney***
**Disney**
Implementation of diffuse from [Physically-Based Shading at Disney](http://blog.selfshadow.com/publications/s2012-shading-course/burley/s2012_pbs_disney_brdf_notes_v3.pdf) by Brent Burley. See Section 5.3.

```
Expand Down
Binary file removed images/BarramundiFish.gif
Binary file not shown.
Binary file removed images/Telephone.gif
Binary file not shown.

0 comments on commit cc59f4a

Please sign in to comment.