Hey guys, I was recently talking with a buddy of mine, and he mentioned he never used cavity maps before. He uses AO of course, but just never got around to using Cavity.
I think a lot of people are not aware of Cavity maps so I thought I would share my notes, and personal settings I use for cavity maps. (I make notes of stuff I do so I don't forget).
Now I know, cavity map tutorials have been done to death, but the information is sort of here and there on the internet, and some of it isn't up to date.
If your someone who doesn't use Cavity maps... Please give this a try. They are subtle, but they do make a big difference. If you're not using them, you're missing out!
Any ways, enough talk, here are my notes:
My Cavity Map Notes: Make this with Xnormal and Photoshop Filter, with your normals flattened. (if you install xnormal, it should also install this "Xnormal" Filter in your version of photoshop. That's what I use here).
I: Create Cavity Maps
1. Standard EDT: Create 1 EDT Cavity Map with these settings:
(in photoshop, flatten your normals, then go to filter>xnormal>Normals 2 cavity)
x+ y+ z+
EDT
Bright: 0
Contrast: 1
Radius: 8
2. Special EDT: Create 1 "Special" EDT Cavity Map with these settings:
x+ y- z+
EDT
Bright: 0
Contrast: 0
Radius: 8
3. Special EMB: Create 1 EMB Cavity Map with these settings:
x+ y- z+
EMB
Bright: .1
Contrast: .8
Radius: 8
4. Create one more map with the "Find Edges" Trick.
Take your Flattened Normals and go to: Filter>Stylize>Find Edges
De-saturate your layer.
Invert your layer. (Cntrl + I)
Name that layer "Find Edges"
II: Applying your Cavity Maps
(First Backup your cavity maps)
BASE, ambient shadows:
1. Take your AO map and set it to "Multiply" Blending layer above diffuse
SOFTEN SHADOWS:
2. Take your "Special EDT" and apply a level adjustment: Move "Output Levels:" White side to, 128. Move the center (Input Slider) to .7.
Set the Blending Layer to "Softlight", and above the AO map. Play with the opacity of this layer. Try 50 percent for starters.
DETAIL CAVITY:
3. Take your EMB, and place it above your AO and Special EDT Map. Set its blending mode to "Overlay".
Again, play with the opacity. Try 40 percent for starters.
RANDOMIZE CAVITY:
4. Take your "Normal EDT". Place it above all your maps. Set its blending mode to "Multiply". Do a level adjust and clamp the values at the beginning and end of the spikes. (far left arrow to beginning of black spike).
Again, play with the opacity. Try 15 percent for starters. Also, mask out any smoothing error areas, (if your doing hardsurface work).
EDGING, FIND EDGES:
5. Take your "Find Edges layer". Place it above all your maps. Set its blending mode to "Screen".
Now just set you opacity to something really low. When you use this again on your specular, you can make it much stronger. You can even try applying a mask and do a render clouds, or noise filter (or both) to get the edges broken up and random. The purpose here tho is to make your edges pop very slightly. This is not your final edging if you are doing metal work. You will have to paint that yourself. This is just to make the edges pop.
So set the opacity to something like 8 percent.
Tips:
• Place all of these layers in a folder (in photoshop) that is called AO.
• Place the cavity maps in an additional folder inside of the "AO" folder, called "Cavity".
• Copy your AO folder, and turn it off. You will use this later for your specular. When you use this in your specular map, increase the opacity on the various layers in the cavity map and of course the find edges layer.
Alright, this is it. I hope it helps and I hope its clear. Possibly I'll make a proper tutorial for this, and cover some other stuff as well, like painting hair, normal map deeping (via overlay, turn off blue channel, and gaussian blur).
You can also see this tutorial on cavity maps, however, its not up to date with the current version of xnormal:
http://donaldphan.com/tutorials/xnormal/xnormal_occ.html
Replies
I would very much like to see examples of models with and without cavity maps where it actually makes a positive difference to the final result. I haven't been impressed with my own experiments, but maybe there are techniques that produce good results.
For example, I overlaid the batarang in PS and don't see anything that wouldn't be achieved by adjusting the levels of the spec map a tiny bit or even rotating the camera a fraction, but I also don't think it is a good example where a cavity map would make any difference anyway.
whhhhhyyyyyyyyyyyyyy!?! why do people still do this
If I am doing say a leather bag or a pair of shoes then I will use x normal cavity maps which are great, but for human faces I am not as sold on the results so i use the first method combined with a photo overlays
Using the xN or CB converters can give you some ok results, quite similar to a bake, and can often look good on some full organic models, but with hard models it often looks pretty bad, and doesn't really make any sense, as the normal map is going all over the place to compensate for the low poly smoothing, and the converters are still trying to use that info to determine cavity areas.
And yeah, using the blue channel of the Normal map is also pretty wrong, even though it can look good sometimes. I don't see why this should be necessary if you're baking out some clean Ambient Occlusion and Cavity maps from your high poly, they should suffice.
It's actually close to what you get with a Crazybump (or XNormal cavity) pass but far more accurate and without any artifacts.
Then you can use this for masking out weathering/scratches/dirt etc. in addition to your AO (since AO takes into account the occlusion of large scale surfaces while a curvature map is purely information about the shape of the highpoly surface).
Edit: Some links for curvature shader info, in case anyone's interested:
http://www.tomcowland.com/mentalray/tc_curvature/index.html
http://www.rpmanager.com/plugins/TensionMod.htm
~ Quoted For Truth. It looks so goddamn lame. I'd never dream of using it on my textures.
I would love to see this added to RTT or upgrade polyboosts Render > Render Surface Map. Right now it only calculates the cavity of the selected object which means your sculpt and low poly need to be unwrapped exactly the same and then you bake the high and hope that it all lines up.
Zbrush does a pretty good cavity map, quickly. Provided you take the same steps and unwrapped the sculpt before hand and you use its lowest sub-d as your final mesh. Not that flexible...
Cavity map in RTT... seems like problem solved.
Yes, I am sure. If you read what he wrote, you'll see he's not talking about that at all.
Vig, unless I'm hideously mis-reading what kdm3d wrote, he's talking about multiplying the blue channel over his diffuse/spec whatever textures, not multiplying it over the normal-map. That'd make even less sense
Unless you're referring to Lamont's post with the other wiki link about putting the AO in the blue channel? In which case, yes, renormalizing will most likely wreck your normals.
Take it as one of the principles of animation (to use a loose analogy). If you animated a straight "ACCURATE" walk cycle it would look wrong, uninteresting etc. You have to exaggerate the movements to get it to look right.
That can happen when you have textures as well. just a straight AO bake doesn't give you as much read and definition to recognize something racing by it as you trying to shoot the guy behind it.
And yes, straight copying it over wouldn't work well, levels and opac have to be adjusted. Since the blue channel ONLY holds the depth data, and no directional data, your not putting shadows any where they wouldn't be, your just exagerating them.
~ I can't express how truly against this I am. It makes textures so lame. Just learn to paint.
Its not a matter of learning how to paint, its unifying an entire environment with its assets and characters and making it read at 200 mph...
perna. I appreciate the crit. Your right if you are going for absolute realism, you might not want to use that trick. I'll find some examples at some point to better illustrate. Its not that I dont have the proper AO bake, I do, its just this adds to the exaggeration of the texture:)
I'm unpopular today:)
So why we do this, because we find it useful, simple . Don't put the yell on the sky, because it's a common practice as far as i know.
BTW: http://www.tomcowland.com/mentalray/tc_curvature/index.html
I have been years doing these kind of things with Zbrush, and it's something very very very helpful for props.
Example: from this simple subdiv object, we can obtain a very cool map that gives a bit of volume, it's basically a displacement map. You just need to subdivide your subdiv model in Zbrush and generate a displacement map.
I do find it extremely helpful to hear everyone's view on cavity maps though. The method I outlined above was really an adoption of that tutorial link I mentioned on the xnormal site. I suppose I considered it "the correct" way to do things, since it was on the xnormal site, without truly knowing.
Anyways, I have been back and forth a lot with my own rules in cavity maps, and perhaps them not being a 100 percent accurate is the reason. Basically, if something isn't working, I simply make it really subtle, or mask it out all together. Problem solved.
I do want to learn more about the curvature map, as that sounds like a better option. So I'll be def. looking into that soon.
Now I am likely wrong, but I thought baking a cavity map, and converting it from the normals is pretty much the same thing. Which is why I didn't mention baking cavity maps. Because the normals show changes in surface angles, and that is what makes a cavity map different from an AO map (the changes in surface). I thought converting normals to cavity maps was more flexible and easier to do. Is this not true?
Dreamer: I don't know why your hating on kdm3d's trick so much. I don't get that worked up about anything in 3d, lol. You could also paint your AO btw, but personally I'll stick to rendering that out as well. I'm afraid I don't understand your logic. If the blue channel trick works, then do it. If it doesn't work, then don't. That's how I see it anyways.
I think with any technique there is a formula in a professional game development environment. The factors include speed, aesthetics, economy, and end result. All have to be factored in in a pro environment, and balanced precariously.
Why take the time to paint an AO or a cavity map, when its MUCH faster to render it (or convert it) With not much (if any) hit to aesthetics, no hit to economy, and very little (if any) hit to end result. An instructor once told me, "dont reinvent the wheel" if its there, dont go through the time and wasted effort to recreate it. (that could be taken wrong so I want to clarify that I am STRICTLY referring to painting vs baking:) )
Whether its technically accurate or not (I doubt) but it looks ok.
Btw, I'm primarily thinking of scifi/unreal style assets when I'm referring to the results. I don't have as much experience with organic/characters, so I won't comment on its effectiveness there.
I'm not saying that generated maps aren't useful, because that is half of the 'next gen' pipeline, but I want to recommend against the line of thought that a cavity map is a quick way to achieve depth in a texture and doesn't require the artist to do it manually, because the results just aren't the same.
This is exactly my take on it, too.
The vast majority of the time with a normal-map bake, the blue channel is not doing anything you want to represent in your diffuse texture - in fact it will often be something you don't want in your diffuse at all, since as Per said all it represents is one vector component in the relative difference between an arbitrary high and low poly mesh.
So yes, while it might work at 16% opacity on the occasional texture, most of the time you're probably not doing anything all that good, or anything you couldn't have achieved much more accurately with a good AO bake or Crazybump/XNormal pass (although as pointed out, those are just cheap quick tricks for getting a rough approximation of surface curvature, which you'd be better off getting from your highpoly if possible).
A lot of the time if you're using a Crazybump pass from a normal-map baked from highpoly, you will have to paint out artifacts from the high/low difference represented in the normals.
Blaizer: That's a nice trick to get a simple difference map in ZBrush, it does look useful.
PredatorGSR: I completely disagree, I think a curvature map (which is what most people I believe are trying to discuss here when they say "cavity map") is very useful when texturing, it can save you huge amounts of time since it represents valuable information from your highpoly mesh that you can use for texturing (I mainly use them as masks for dirt/weathering/scratches etc).
Using a curvature/cavity map as an overlay is a perfectly valid way to "pop out" key shapes, in fact you will probably find that many top studios do this as a routine when texturing highpoly models, for detail, consistency and efficiency. Trying to do that by hand (as you seem to be suggesting) is ludicrous, sure you can do a little bit of painting here and there to get some focal points worked out, but to try and highlight every little edge and darken every little crease and crack by hand is just insane when you have the option of a cavity/curvature map. I don't understand why you would be against this method?
Because it is different to an AO map, it represents different information, be aware of that. These things are not interchangeable. I wouldn't dream of starting to texture a normal-mapped asset without a good AO map baked from my highpoly source, and a good curvature map from the same source (falling back on a Crazybump/XNormal pass if I don't have access to a curvature map bake).
Armed with an AO bake and a curvature map bake, you can do pretty much anything you need to with a normal-mapped asset texture.
The thing is, I haven't seen a cavity map be effective in "popping out key shapes", I've always had to paint in highlights into the spec map in order to do that. I don't want to get entrenched into a position here, I'm all for any technique that generates good results, I just haven't seen them in this case, and I would love for someone to convince me otherwise by providing real examples.
You can use it for weathering, change of surface roughness, it can even help faking translucency ... super useful stuff. Multiply is evil tho.
I remember hearing that XSI bakes them very well and accurately.
I myself use a nice little psd action at work doing an okay job at them, generating them from the normals (not as good as Crazybump, but very close) ; at home I use Crazybump because I have more time to experiment and play with stuff. I think this thread needs more pics, might try to post some later.
This is a cavity map using xNormal using EMB following the guidelines in the original post. This is generated from a normal map that was baked from a HP mesh.
I don't see how a map like this is beneficial for a final texture, as it will conflict with the lighting, and doesn't seem to do much that the AO and normal map doesn't do already.
Hope you don't mind me cropping your normal-map texture here, it's a great example actually, perfect for use with Crazybump since it appears to be generated for a completely flat lowpoly mesh.
You would see "low poly triangle" artifacts appearing if it was baked to a custom lowpoly mesh, especially for smoothed hard surface models, which is why I would recommend a highpoly curvature bake over postprocessing a baked texture.
As you can see, using different "widths" can be very powerful - I use the wider ones (topmost crazybump pass in that image) as a base for weathering masks - inverting that and using Levels on it means you can very quickly pick out all the "deep" parts and throw away the raised edges.
Similarly you can use Levels to limit the output to just the raised bits, getting a nice initial mask for wear and tear detailing on sharp edges (paint chips, scratches, etc).
Obviously painting into these once you have them as a base is only going to help, but in many situations you rarely need to edit them. I usually use the 99% pass as a low-opacity Soft Light layer on my diffuse and mid-opacity Overlay layer on my specular, to really make the raised edges shine up in the specular (as appropriate, obviously, don't do this on things that aren't meant to have shiny edges!).
Similarly the darker bits will darken down and help prevent "sparklies" that you will see in a lot of "next-gen" games where there is a high specular brightness in the deep cracks, which results in a wet and shiny look that should nearly always be avoided.
Now, a properly rendered curvature map would be more accurate, and in general would look more deep. Still, the Crazybump pass is often very close, and provides a great help. BTW everybody seems to forget that Crazybump (just like every other normalmap manipulation tool) is sensitive to y-up/down. Its in the preferences menu, better double check that before doing anything.
To me, not seing why the top map is wrong, is very close to adding a greyscale normalmap or blue channel overlay 'just because'. Some might not notice it, but it looks terrible.
I'd still be curious to know if inverting the green channel gives you a better result with the XNormal filter, I can't believe that the filter would output maps that broken unless some settings are wrong.
Edit: BTW, the direction this whole thread has taken has made my mind boggle a little, I mean, game artists working with normal-maps have been using these techniques (or very similar ones) for at least two years now, and still there are people out there (and I mean actual game art professionals, not students halfway through a game art course) who find this completely new to them? I find this mildly scary.
Like BradMyers said when he started the thread... if people aren't using this stuff when texturing normal-mapped assets, then they're seriously missing a trick and probably wasting a whole lot of time and effort...
Inverting the green channel did indeed fix the lighting issue with the xNormal map, it creating something akin to your 3rd example. The thicker maps in crazybump definitely seem like the most useful though.
Oh the issues the lack of examples can cause :P In my experience, in production a lot of this stuff is learned by someone trying it and showing it to everyone else, or arguing about it over lunch. If you don't happen to be there for that, it is tricks like this that are easily overlooked. Lots of studios don't use a high poly workflow either, which is another factor.
Hence the value of polycount
Edit: It seems kinda odd that the green channel needed to be inverted, since the map was baked in xNormal using +x+y+z.
I think there's a setting you can change in Crazybump to account for that, but since I always work with that format it's fine.
Did you ever consider trying stuff like that out yourself? Like, if you could clearly see that the output map was useless, did you consider why it might have been like that and try to solve the problem yourself? It sounds like you've tried this before and encountered similar problems and just given up as a result?
Looks practically the same as the one pior made in crazybump, just need to up the contrast a bit more.
you'll need that - http://www.rpmanager.com/plugins/TensionMod.htm
apply the modifier to your highpoly as well as a material with a vertex color map in the diffuse channel.
in the modifier you disable everything but the stuff under convexity/concavity.
check "do convex", "relative to ref pose" and "mask by edge selection". the mapping channel obviously has to be the same as it is for the vertex color map in the material.
the rest you'll have to mess with to get results you like. to check how the edges look i just render it. there might be a good real-time way i dont know of though . once you're happy you RTT it as a diffuse pass.
if there's an easier way please share .
I baked the normal map in xNormal with +x +y +z. In the cavity settings, it was set to +x +y +z. There are 7 different methods that can be used to calculate a cavity map xNormal, each of which produces a different result. It is counterintuitive to have to invert the y channel within the same program.
There was no real reason for me to expect that the map was incorrect, since cavity maps aren't something that are widely viewed on game art forums. I thought thats just the way they were, and used them as a guide for texturing, but turned them off for the final output.
This has been a civil discussion, I don't appreciate the insinuation that I'm lazy or an idiot.
And actually that is what the swizzle is for on the xnormal filter. If you look at my settings, I have -y for the "special EDT". The reason I have +y on the "Normal EDT" is because it's my weird randomize, neutralize layer. You probably won't want this, but I normally make this just to see if it helps the textures.
But like Yozora says, EMB is the most important part of my notes. That's where the detail from the cavity map comes into play. The other cavity maps (EDT ones), are just to manipulate the AO further.
Anyways, If your normals work correctly with Marmoset, then your settings for cavity should be (+x, -y, +z).
In my notes I have this in red, but I'm not sure how to do colors on these forums.
Here is an example of me following my own tutorial. I already see a find edges area, that I have to mask out. So these textures are by no means final. Hopefully, they will give you guys an idea of how this all works out for me.
just out of curiosity... anyone notice the difference between the two? Or tell me what was done to the two?
I think most people should also avoid using any edge technique as a simple overlay, multiply or add. I find that they all work best as masks for other manipulations. Like use the highlights of a cavity map to mask in some scratches, or use the deep parts of AO/cavity to adjust the hue or add some dirt texture rather than just "darker"
As engines and lighting gets better you should be using less of this, if you contrain your texture too much you dont let the lighting do its job. I think that's why multiplying the blue channel by your diffuse is such a bad idea. Your dark areas of your normal map are the areas where there's nice detail and variance, i mean the areas that are giving us the -reason- for using normal maps and if you're just making them darker you're not letting the lighting in the shader do its job.
From what i read i still don't understand if there is a difference, although it kind of looks that curvature shading can give a somewhat more detailed though wilder (as in somthing usable) results than cavity shading.
Can someone answer me?
What drived me to find answers about this was this thread where i try to make a Nodal Tree in Lightwave that gives very good surface shape hints to a viewer, in order to evaluate someone's modeling work ona given object, instead of smoothing everything out in the render like normally happens.
This as nothing to do with hand painted, game engine, hi-res bake, UV Textures Maps, etc. It's of this gameworld focus of yours here, that i appoligize if i inconveniently invade, but would appreciate any leads or answers. :thumbup:
Images of the thread to explain what i'm talkin about
The Breakdown. You guys might not have much about the shaders on the right because they are obtained only when rendered, but i guess the ones in the left fit the discussion.
A bigger render trying to demonstrate a modeling work the best i can for now.
Another object with a later version of the Node Tree. Image
Cheers
Using the CB occlusion map generated from the normal map as different kinds of masks for the diffuse/spec is really useful.
Would be nice if you could bake it from the high poly though (would be more exact of course), is there any way to do it in xNormal? Can't really seem to get anything from the cavity map there...
By the way, I love you guys, Polycount rocks.
i'd guess that the cavity map takes care of the conCAVE areas and the convexity map gives you a mask for the exposed areas. i'm not sure though if cavity bakes in xnormal take intersecting geometry into account so a tweaked AO bake might give you better results for a deposit mask.
Totally agree with you Jordan. The material should be the measuring stick when using any technique. I also prefer to use most my maps as masks. Still it really depends on the material because there are situations where just the maps will get you 90%. As tech gets better and we can see through the mud of compression and low res textures it will definitely expose bad techniques though.
k back to work for me.
No no... again my post is about the discussion, but not focus in this forum main themes. Dpont's Node works in Lightwave render. For this particular character is takes like 45 seconds to cache it, but after this it will use that cache every frame unless you ask him to calculate every time after deformations. So it's not soemthing fast. but if you use the cache the render is very fast, since it's just like render a texture map.
-> "Turntables"
My post is more on a wide technical question. What is the difference between cavity maps and corvatures shading. And GENERALLY, for what are they used best?
But anyway, yes, thats what i point in my post in NewTek's forum: CORE will have SSAO. If they could have Curvatures, it would be nice to evaluate the meshes's creases, bumps, etc in modeling process.
Doesn't Zbrush has soemthing similar?
Cheers