# Compare refraction angel to TIR angle math problem

Are you taking the roughness of the underlying material into account? Darkness is strongly related to the porosity and the density of the surface and the coating, respectively.

Your stones are quite wonderfull…
Thought the sand in the cracks shouldn’t absorb so much light as the stones…
The same goes to the colored pattern… A plastic material has a very low porosity, which makes the darkening of the surface color almost neglectable…

But the for the mathematical perspective, the vector you’re using in the darkening function seems correct! Just needs a bit of scaling but it looks great!

Wonder if your method will also work with variable wavelengths?

Yes the sub material has its own glossy reflection, with own calculated reflection intensitys ie,the IOR of clear coat in the upper reflection,and the submaterial with own IOR glossy reflection and a diffuse shader for the textures.

I am glad you like it.
You can control the amount of the darken effect with the wet influence,this could be a kind of porosity too.
If you look at stones or asphalt ect,and it beginns to rain,its impressive how dark some stones are appearing if they getting wet.
For this stone testrender i have used the displacement map as wet influence fac.

The math is quite easy.I was at a point to give this darken effect up,because in the most papers the HG is used as volumetric phase direction for the light scattering.And to make this happen in a 2d shader you need something like a subsurface scattering shader.And that was to complicated to me.
Then i found a simple equation how to calculate the singlescatter albedo.i use this equation with the HG phase(using the refracting angle from the 2nd reflection) to get basicly a reduced scattering albedo.(scatter*(1-g))and recalculate then the albedo new.

you could use the wet and HG influence and put in you own porosity and backscatter map if you want.TBH this was just a idea i had with the equation,maybe something is not 100%correct.The equation however is,i have checked it.would be nice if you or someone with more math brainpower could check this,if that all makes sence.

Not sure about that.

BTW i have to make two versions of the shader.This with diffuse shader,and one with a glossy base shader.and maybe the flake version.
Today i have read many papers about glossmeter measurement,and if i can make use of the information i want the reflection falloff to be fit with the paint behavior.To me that makes sence for cycles microreflections to treat it like paint finish from high gloss to flat paint.
If i can get a usefull math from the paper then the shader could be usefull for every kind of paint.
Then i upload this shader.