Moss / Snow / Dust shader - deferred

A shader that simluates snow / moss / dust masked on to the upwards facing normals of an object based on it’s position and tangentspace normals is that really possible in a deferred renderer ? I cannot wrap my tiny artist brain around the normal calculations to do this :slight_smile:

Put the normals in world space, and the Y component determines how ‘up’ it is facing. So something like:

lerp(noDust, fullDust, saturate(worldNormal.y));

saturate clamps the possible -1 to 1 range to 0 to 1.

If your shaders are in tangent space, you will need to get them into world space (I’m not talking about tangent space normal maps, which are fine, but the shader calculations- you said ‘tiny artist brain’ so I’m being explicit, sorry if this is obvious). Also, if your shaders are in tangent space, they should REALLY REALLY REALLY be in world space.

Why is it different for a deferred renderer?

But by the time the normals reach the deferred render stage, the normal/albedo mix has already occurred and is simply given to the renderer.

I can only speak of our own deferred renderer, but in ours there is no such difference or limitation as to what you can do with a shader or the math you use to create them.

They are identical except that the normals are converted to View Inverse Transpose space before they are passed to the renderer, but that is optional, not every def. renderer does it that way.

Unless I am missing something that you are trying to do… :slight_smile:

Their probably isnt any difference in regards to deferred, i just mentioned it in case there was :slight_smile: Thanks for being so specific Rob :slight_smile:

Updates: Succes! cheers :slight_smile:

I did this for a snow/frost effect, works really nice :slight_smile:

at least for snow/frost too, i remember seeing a trick where ATI used the normal to look up into the mip levels for a noise texture and multiplied that by the snow color/texture. Cool net effect.