'Dirt and decay' with Osl shading...

This in fact is a thread which has its beginning in the recent ‘bevel shading’ thread. First was the very successful Osl bevel script which Piotr Adamowicz wrote, used afterwards by Bobizib in a node setting for producing a ‘dirt and decay’ effect. The results were astonishingly good, so I thought that this ‘dirt and decay’ producing setting deserves definitely a separate thread of its own. I think that it is a setting that can give ideas for producing even more complex settings that would result in even more rich effects of this kind…

Below there are some of my experiments done with the use of this nodes schema… I am still a newcomer as to the working with nodes but I tried to add some bumps to the whole setting and there appeared some nice results. I suppose that those who have expertise in the use of nodes may enrich it significantly…

A sample illustrating different amounts of ‘decay’ on the same object:


A sample with bumps:


And a sample with a sand cover-like effect:


Wow, those look great!

I love the decaying effect, I simply love it!

I did try to build a node arrangement so as to put decay on the outwardly directed edges and dirt on the inwardly directed ones (as is shown in the image below… it is faked by combining two different render results, just for illustrating the case) but I did not be able to achieve a solution.

Also, it would be good to have a bump adding function which could be increased or decreased in intensity independently of the increasing or decreasing of the main effect’s (the ‘dirt and decay’ effect’s) amount. The only thing I did be able to achieve so far was combining the effect with bump but in this case whenever you increase or decrease the bump amount you are obliged to increase or decrease the effect amount too.

We have to ask Bobizib for help… :slight_smile:


Hi Fatesailor, happy you use this quick tip :slight_smile:
About your issues, i can’t test for now but i think it’s doable

  • for in/outward dirt, if i remember correctly, you have multiple modes in the osl node i used (look at the small tut i made on previous thread). Play with this mode (you should have inward/outward/both depending on 0/1/2 mode)

  • For bump i’m not sure i understand it correctly… If you need your bump stronger, why not using the “strength” factor of the node bump? (it should not modify the dirt effect but only affect bump strength, i’m maybe wrong).


Edit : About your sand effect, i’m not sure Dirt is the way to go (at least for basic sand coverage, it’s ok for detail filled of sand).
As sand cover objects only on top of +/- horizontal surface, you should use the “geometry” normal output, then pass it through a separate RBG and use blue to mix sand material and “your Object base material”.
Of course you can multiply this value and coloramp it to have more control on the effect (multyply this value by a large procedural noise can give you more randomness too :slight_smile: ) and then adding the “dirt” effect to it (or using dirt with another kind of sand, bite darker for example).
Hope you find it usefull :slight_smile:

Edit : here is this quick effect : http://www.pasteall.org/pic/show.php?id=70691. Just replace orange by sand and work on the coverage randomness

Wow, a lot of ideas… going to study and try them… Thanks Bobizib… :slight_smile:

Hey, a bit off topic but your experiment make me think that, with some work, it could be possible to create a really basic dDo workflow inside blender.
Probably not worth to give it a try for now, but when an official Dirt node ll come in blender (i think it ll be a new kind of AO node as texture) it should probably be interresting to look at it :slight_smile:


Yes indeed… it is an idea that came to me too when experimenting with your node setup… but it is something that needs some simplification (a separate ‘dirt’ node as you said) for its being more practical in its use. Now the node setup is too complex and it seems that it slows down the rendering too.

Having an easily and efficiently working ‘dirt’ node would be great, however… ‘dirt’ and ‘decay’ is an element that enriches most decisively the 3D objects and it should be a must -to my opinion- for every 3D app.

I tried out the OSL grunge shader and got some nice results by mixing it with the techiques described on the Sculpting with UVs and Displacement thread.


Atom, combining the ‘dirt and decay’ shading with the sculpting with uv maps idea may result in interesting results, really. However, the so much detail in the model of your render makes the shading effect nearly invisible. I think that a model with less detail would make the effect clearly visible and nice looking.

Fatesailor, can you post a blend of your node setup for the first image? I’m digging the degraded metal material.

Below is a very simple scene with the nodes’ setup Joel… have it in mind, the effect’s amount is controlled from the ‘dirt control’ group’s third node from left (there you change the value and so you acquire the effect in the amount you need)… play with the nodes’ parameters and you will understand the shading’s working way…


Here is the image texture I used too (it is Bobizib’s in fact)… you upload it in the ‘dirt control’ node group’s ‘image texture’ node:


Finally found the way to have ‘dirt’ and ‘decay’ together… it is a matter of making two sets of nodes as polar opposites (the one for the ‘dirt’ which accumulates in the indented edges and the other one for the ‘decay’ which occurs on the outdented edges of the object) and combine them. Below a result:


That’s really cool - though there are some anomalies at the bottom of the image where the paint is scraped off in what should be a cavity? Any idea what is the reason for that?

Keen observation Blender Matt… I too am aware of the problem but, to be honest, still have no any answer as to its reasons… :slight_smile:

How did I miss this thread!!?!

where is the osl script?

The script is on Pasteall.org so it will expire if it has not already. But there is a copy in my horse scene that you can get here.

Check your UVs you probably missed some piece :slight_smile:

Thanks for the link Atom :slight_smile:

thanks so much!