User Tools

Site Tools


specular_lys_new

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
specular_lys_new [2017/04/29 00:19]
adavies
specular_lys_new [2017/05/07 20:41]
adavies removed
Line 80: Line 80:
 It has become very common to use "​roughness texture maps" to describe the specular reflection of a material. Note that these are not equivalent to It has become very common to use "​roughness texture maps" to describe the specular reflection of a material. Note that these are not equivalent to
 actual academic roughness which is defined as the root mean square slope of the profile. actual academic roughness which is defined as the root mean square slope of the profile.
-Roughness texture maps in computer graphics have for practical reasons been defined as a more even distribution of blurriness. In the following we will refer to the roughness in texture maps as "​perceptual roughness"​ and when we refer to roughness we are referring to academic roughness. ​+Roughness texture maps in computer graphics have for practical reasons been defined as a more even distribution of blurriness. In the following we will refer to the roughness in texture maps as "​perceptual roughness"​ and when we refer to roughness we are referring to academic roughness.
  
-Perceptual roughness, roughness and specular power can all be thought of as different parametrizations for the same parameter and it is possible to convert back and forth. For instance the conversions from roughness to perceptual roughness and back again are+Perceptual roughness, roughness and specular power can all be thought of as different parametrizations for the same parameter and it is possible to convert back and forth. For instance the conversions from roughness to perceptual roughness and back again are:
  
 <code glsl>​float RoughnessFromPerceptualRoughness(float fPerceptualRoughness) <code glsl>​float RoughnessFromPerceptualRoughness(float fPerceptualRoughness)
Line 114: Line 114:
 Thus we should not think of perceptual roughness as specifically for GGX or specular power as specifically for Blinn-Phong BRDFs. Thus we should not think of perceptual roughness as specifically for GGX or specular power as specifically for Blinn-Phong BRDFs.
 Finally for those using "​smoothness texture maps". These are simply equal to one minus the perceptual roughness and vice versa. Finally for those using "​smoothness texture maps". These are simply equal to one minus the perceptual roughness and vice versa.
 +
 +
 +[{{https://​s3.amazonaws.com/​docs.knaldtech.com/​docuwiki/​perceptual_vs_rdq_plot.png?​nolink|Perceptual roughness vs academic roughness (Rdq).}}]
  
 === Burley === === Burley ===
  
-In Lys we currently support three ways to distribute blurriness across MIP levels. Burley, Default and Log2.+In Lys we currently support three ways to distribute blurriness across MIP levels. Burley((Brent Burley. Physically-Based Shading at Disney. https://​disney-animation.s3.amazonaws.com/​library/​s2012_pbs_disney_brdf_notes_v2.pdf)), Default and Log2.
  
 Burley is the most straight forward and the one we recommend using for image based lighting. Burley is the most straight forward and the one we recommend using for image based lighting.
-The top MIP level will always be used for a 100% sharp reflection (roughness 0.0) and the offset from the bottom MIP level specified using “MIP Offset” in the specular group determines where we have 100% blurriness (roughness 1.0). The default offset of 3 corresponds to MIP level 8x8.+The top MIP level will always be used for a 100% sharp reflection (roughness 0.0) and the offset from the bottom MIP level specified using “MIP Offset” in the specular group determines where we have 100% blurriness (roughness 1.0). The default offset of 3 corresponds to MIP level 8x8. Checking “Coarse Irradiance” in the 3D Preview will enable using the MIP level at your chosen offset for diffuse lighting in the viewport. 
 + 
 +Note that our implementation of BurleyToMip() below differs from the more typical form as cube maps convolved in Lys are based on RdotL and not NdotH. You can find a more detailed description in [[specular_lys_new#​pre-convolved_cube_maps_vs_path_tracers|Pre-convolved Cube Maps vs Path Tracers]].
  
 <code glsl>​float BurleyToMip(float fPerceptualRoughness,​ int nMips, float NdotR) <code glsl>​float BurleyToMip(float fPerceptualRoughness,​ int nMips, float NdotR)
Line 132: Line 137:
  
 As we can see this implementation has an intermediate step which is explained in section "​[[specular_lys_new#​pre-convolved_cube_maps_vs_path_tracers|Pre-convolved Cube Maps vs Path Tracers]]"​. As we can see this implementation has an intermediate step which is explained in section "​[[specular_lys_new#​pre-convolved_cube_maps_vs_path_tracers|Pre-convolved Cube Maps vs Path Tracers]]"​.
-If this is considered too expensive then a cheap close alternative is to use the following replacement+If this is considered too expensive then a cheaper ​close alternative is to use the following replacement.
  
 <code glsl>​float BurleyToMipSimple(float fPerceptualRoughness,​ int nMips) <code glsl>​float BurleyToMipSimple(float fPerceptualRoughness,​ int nMips)
Line 146: Line 151:
  
 You do this by specifying the "MIP Offset"​ in the specular group. This value represents an offset from the bottom 1x1 cube map MIP level. You do this by specifying the "MIP Offset"​ in the specular group. This value represents an offset from the bottom 1x1 cube map MIP level.
-The default value of 3 corresponds to assigning a specular power of 1 to level 8x8. To help you make the right choice you can check "​Coarse Irradiance"​ in the 3D Preview which will then use the MIP level at your chosen offset for diffuse lighting.+The default value of 3 corresponds to assigning a specular power of 1 to level 8x8.
  
 Next you need to distribute the remaining specular power values. For the Log2 distribution this is done using the "User Scale"​. Next you need to distribute the remaining specular power values. For the Log2 distribution this is done using the "User Scale"​.
Line 259: Line 264:
  
  
-We then use the adjusted ''​fSpecPow''​ to find our MIP level with ''​GetSpecPowToMip()''​. This adjustment is of course just for the cube maps and should NOT be applied to the specular power used with ordinary lights since for these we simply use an n_dot_h based formulation as opposed to l_dot_r.+Note we perform this correction inside ​the functions ​GetSpecPowToMip() ​and BurleyToMip() given above. This adjustment is of course just for the cube maps and should NOT be applied to the specular power used with ordinary lights since for these we simply use an n_dot_h based formulation as opposed to l_dot_r.
 This approach will work with both normalized Blinn-Phong((Morten S. Mikkelsen. Microfacet Based Bidirectional Reflectance Distribution Function. https://​dl.dropboxusercontent.com/​u/​55891920/​papers/​mm_brdf.pdf)) ((Bruce Walter, Stephen R. Marschner, Hongsong & LiKenneth E. Torrance. Microfacet Models for Refraction through Rough Surfaces. https://​www.cs.cornell.edu/​~srm/​publications/​EGSR07-btdf.pdf)) and GGX. In the former case use cosine weighted convolution in Lys. Though it is an approximation it gives results that are close to what the path tracer will provide for the same specular power. The approach will also harden the reflection as we approach the silhouette which is more physically correct. This approach will work with both normalized Blinn-Phong((Morten S. Mikkelsen. Microfacet Based Bidirectional Reflectance Distribution Function. https://​dl.dropboxusercontent.com/​u/​55891920/​papers/​mm_brdf.pdf)) ((Bruce Walter, Stephen R. Marschner, Hongsong & LiKenneth E. Torrance. Microfacet Models for Refraction through Rough Surfaces. https://​www.cs.cornell.edu/​~srm/​publications/​EGSR07-btdf.pdf)) and GGX. In the former case use cosine weighted convolution in Lys. Though it is an approximation it gives results that are close to what the path tracer will provide for the same specular power. The approach will also harden the reflection as we approach the silhouette which is more physically correct.