Shading tests – Dirtmaps

by - 2012/02/08 29 Comments Artwork

With the production start of project Mango getting close it’s a good idea to test your own workflow a bit … because when instead you’re swamped with tons of work you can’t spend time thinking how to make things smarter and faster. So I tried to put together some questions and topics that always bothered me when I do environment models and shaders. Nothing amazing or innovative, but hopefully good for speeding up work, here’s what I came up with:

You got to love a carefully painted custom texture map, with all those subtle (or strong) weathering effects placed in the right spots just for that object.

Only issue: painting textures takes a lot of time! :)

Speaking of environments, that’s a real issue: your environment is often made of tons of different pieces, all quite detailed as models but not that important by themselves to afford the time for accurate custom painting. In my experience, in arch.viz. you only can afford tileable textures and no custom painting, in games you have to custom paint, and in movies you ‘simply’ need the best quality and realism…

Still, in any case it could be handy to have some kind of automation to get some weathering effects (based on the shape of the object) without custom painting, and keeping the unwrap phase reasonably fast. ‘Automation’ for this stuff won’t help quality much, but speeds things up. So it’s good for minor objects or as a base for important ‘hero’ pieces.

 

That’s the idea behind the tests below, dealing with: batch-bake of AO/dirtmaps, unwrapping multiple objects together, node shaders (cycles in particular)

 

Batch Bake – Dirtmap script 

First part of these tests is a small python script – just a proof of concept by now, if the idea works it will need quite some polishing (I’m an env. artist, my python is really basic…). In the image below you can see the UI, the process and results :

Using the script, what you get is a mix of different AO maps, which works well as a base map for weathering effects: then you can either paint manually over that (in Blender or Gimp). Or you can use that dirtmap directly in a node shader: mixing it with some tileable grunge splotches and patterns to give variation and realism, then using it to control and mix tileable maps and brdfs.

A sample result: a kit of sci-fi greeble pieces (note: all this is just a technical tests, not much to do with the style that will be in the actual project)

 

Cycles node shaders :

Using that dirtmap and with the help of some quick vertex color paint, you can then create some pretty complex shaders in cycles (or BI nodes as well). For organization, node-groups are just great: they work as instances, so you can reuse parts of your shaders in different materials.

So, in this case, the group can contain everything (brdfs, tileable textures ) except the dirtmap, then create various materials with that group (instanced!) and just replace the dirtmap. How this performs at render time (compared to custom painted textures) is still a question: it forces you to use many mix-nodes and complex node-trees, but on a full scene should save quite some memory on total texture size (dirtmaps don’t need to be that much high-res, the rest is tileable textures that can be reused for various materials).

 

Cycles renders of the kit :

Some parts use a metal shader, some use a plastic shader :

And the same kit, quickly scattered on a sphere, rendered on hdr background (from openfootage.net) :

 

 

 

  1. Tadd says:

    Wow these look pretty slick – good test!

  2. Lukas Tönne says:

    Do i have to say it? These look really great!

    In my own selfish interest of course i hope it will bring some more attention to node groups. You already pointed out how putting an outer group around these nodes would be helpful. Instancing is a powerful feature as well.

    Let me know what other feature are needed for nodes and groups. Better to add new stuff as early as possible. Keep up the good work!

    • Ni:Zu says:

      Thanks!
      I’m a big fan of new node groups options (names and positions for sockets , that really made groups reusable as presets!)

      What would really be useful for this setup is nested groups ,
      So you can group for organization (..reuse the generic part of the shader brdfs, tileable maps) and -inside that group- have some ‘functional’ groups like that 3-steps-stencil. (i use it often , and it’s just a bunch of math nodes, but un-grouped is really ugly and confusing..)

  3. Diego Herrera says:

    This article made me drool all over myself.

  4. Impressive. It makes me want to buy making of Mango project right away.

  5. sozap says:

    very nice !

    I used to do stuff like that, when working with blender internal, I did a little trick. All objects has their own dirtmap assigned to UV, and I created a shadeless material with the textureface option. Then using material node editor I could mix this material with other materials to create generic materials that can be used on every objects…
    I guess in Cycles it’s different but maybe the texface option could be or is already implemented. Then you can have one material (for instance metal) that can be used on every object, instead of having different metal material for each object , because of the dirtmap…

    Hope it could help… By the way I’m really intersting on mango production, blender open movie looks better and better each years ! keep up the good work !!

    • Ni:Zu says:

      Thanks , interesting !
      I never used that trick (texture-face, BI nodes) but i get the point.

      I was indeed thinking about tex-face and the general idea of ‘per-object’ textures when i started this , then it worked well enough ‘manually’ creating groups and materials per each group (with help of nodes group instances)

      But it’s something to keep in mind !

  6. Goro says:

    Impressive result!

    Where we can get the script? I would love to to dissect it :D

    • Ni:Zu says:

      Right now the script is still a very buggy proof-of-concept , as soon as it’s decent i’ll make it available !

      • I’ve wanted a script like this for some time now. Would it be possible to use this script and render other info to the texture such as a lightmap?

        • Ni:Zu says:

          Lightmaps are indeed similar, but lots more variables..
          So this script is just for base texturing, it actually uses some code from a lightmap script i started this summer, but it’s much simpler.
          (i’d love to finish that script when i have a project where it fits , but that was for game lightmaps anyway, plus i’ve no idea yet if Mango will use any light baking)

          In general for game lightmaps, Blender has great tools for baking textures, the only thing missing would be the ‘batch’ automation part ..
          Trouble is, that while it’s relatively easy to write a simple ‘ad-hoc’ batch script to bake AO (or even lightmaps) just how you like them, it gets very complicate to make a script that works for various workflows and different projects..

      • n-pigeon says:

        Cool! Thx :) It surely will be a good learning material ;]

  7. Lamhaidh says:

    Love the clever use of AO to streamline the dirt maps. Have you considered trying to use Dynamic Paint to create add some wind affects as well? Could be especially useful in cases where you’re dirt mapping vehicles.

    • Ni:Zu says:

      Hi,
      Yes i tried Dynamic Paint :),but with little success. It seemed very cool to actually simulate rain ‘washing’ dirt on facades.

      I stopped testing because it seemed impossible to get a good effect with less of 100k or a million particles , and above 10ks particles the simulation started to be difficult to manage and slow to bake.

      Also the problem with it, is that scripting the setup of the right particle system is way more complicate than just a batch bake.

  8. Ciriaco says:

    Another possible solution is develop the ability to use vector textures, *.svg files as textures.
    http://airplanes3d.net/downloads-svgtex_e.xml

  9. tibe3 says:

    Renember: Auto-Baking multible surface can be also quite usefull for architecture, to actually bake radiosity maps.

    …especially considering the game engine.

    Not tried in Blender, but its also a nice ram saver to slightly distort the dirtmap by a procedural texture OR use it as an alpha map for the procedural texture. Even better control its parameters (is this actually possible in blender ?): So you downsize the resolution of the dirtmap much more drastically. (thinking of the 5k rez here…)

    • Ni:Zu says:

      Hi,
      late reply..

      i’m not using procedurals often to detail and add grunge, i generally prefer tileable image textures because they give more character (..like the right shape for scratched paint patches etc..)

      But that’s the idea , the maps i called ‘dirtmaps’ are AO bakes with smooth gradients , to become real dirtmaps they need to be blended with some noise/grunge.

      And indeed it’s convenient for memory usage to keep the dirtmaps low-res and blend it with a noise map.

      I’m still looking for the best way :a mix or multiply node works well . You get better results with more complicate setups , but i’m not sure how much slower a complicate node tree with lots of blending/mixing nodes is.

  10. Alexandre says:

    on the last picture: CYLES shader??

  11. endi says:

    I use this method for years. :)

  12. chimeric_idol says:

    Very interesting and inspiring work Ni:Zu. I was thinking to use similar technique in my final project using Houdini so it is incredible useful to see how you approached it. Regards!

  13. congcong009 says:

    maybe the GPU node calculation could help you to speed up! :) awesome step in of this tech!

  14. MxD says:

    Impressive! Very nice! I really like these little dirty guys :-) ! Very realistic !

  15. mark says:

    any chance you will release the script soon? it’s just what i need at the moment

  16. [...] can read/watch a little more about it here and [...]

  17. Matt Howarth says:

    Hi Nicolo,
    great work on TOS. have you a greeble sample (blender file) that we could download to have a look at? I want to check out the shader tree. It’s quite complex to rebuild from your video, but we will if there’s nothing on the dvd or available to download.
    keep up the fantastic work.

    Matt

  18. Excellent site you have here but I was wanting to know if you knew of any
    discussion boards that cover the same topics talked about here?
    I’d really love to be a part of community where I can
    get comments from other knowledgeable individuals that share the same interest.
    If you have any suggestions, please let me know.
    Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>