• 11
• 9
• 12
• 9
• 11

# Specular aliasing : The order 1886 method

This topic is 870 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,

this paper shows a method to compute a normal+roughness map which gives a result not far from the ground truth :

Here the code from the paper :

// ===========================================================================================================
// Computes a new roughness value for a single mipmap texel given a normal map and an existing roughness value
// ===========================================================================================================
float ComputeRoughness(in float2 texelPos, in uint mipLevel, in float roughness,in Texture2D NormalMap)
{
if(mipLevel == 0)
{
return roughness;
}
else
{
float3 avgNormal = 0.0f;
// Sample all normal map texels from the base mip level that are within
// the footprint of the current mipmap texel
const uint texelFootprint = (1 << mipLevel);
const float2 topLeft = (-float(texelFootprint) / 2.0f) + 0.5f;
for(uint y = 0; y < texelFootprint; ++y)
{
for(uint x = 0; x < texelFootprint; ++x)
{
float2 offset = topLeft + float2(x, y);
float2 samplePos = floor(texelPos + offset) + 0.5f;
float3 sampleNormal = NormalMap[samplePos].xyz;
sampleNormal = normalize(sampleNormal * 2.0f - 1.0f);
avgNormal += sampleNormal;
}
}
// Fit a vMF lobe to NDF for this mip texel
avgNormal /= (texelFootprint * texelFootprint);
float r = length(avgNormal);
float kappa = 10000.0f;
if(r < 1.0f)
kappa = (3 * r - r * r * r) / (1 - r * r);
// Compute the new roughness value
return sqrt(roughness * roughness + (1.0f / kappa));
}
}

Thanks

Edited by Alundra

##### Share on other sites

That link is, so far as I remember, based on Toksvig and the best results you can get for relatively cheap. You can also use temporal AA to reduce specular aliasing, cheap and doubly so if you already have temporal AA for other things (SSAO/Geometry/whatever). The Order actually combines both Toksvig based normal mip maps/roughness and Temporal AA together.

There's also "the best known solution" which is LEAN mapping: http://www.cse.chalmers.se/edu/year/2011/course/TDA361/Advanced%20Computer%20Graphics/LEANpres.pdf which s expensive. Realtime still, but expensive. Then there's CLEAN mapping, http://blog.selfshadow.com/2011/07/22/specular-showdown/ Google CLEAN mapping and you'll get a link to the GDC PPT if you want it.

As a next gen bonus there's also LEADR mapping: http://blog.selfshadow.com/publications/s2014-shading-course/#course_content Which combined displacement maps with LEAN mapping to get something approaching REYES style image quality. But with current tesselation performance, cracks in tesselation, blah blah blah, I don't think anyone will be doing that till NEXT gen. VR Gen? Whatever. There's ALSO a really nifty demo showing LEAN, CLEAN, and Toksvig results so you can see them all side by side with performance, but I don't know where it is.

Hope that helps!

Edited by Frenetic Pony

##### Share on other sites
There's ALSO a really nifty demo showing LEAN, CLEAN, and Toksvig results so you can see them all side by side with performance, but I don't know where it is.

You surely speak about : https://mjp.codeplex.com/releases/view/109905

Edited by Alundra