This might be a bit of a noobish question, but I'm a bit unclear on this. I'm looking at some materials in an Unreal3 project, and instead of having a baked specular texture (or alpha channel, etc), a lot of the speculars are generated in the material node editor, along the lines of diffuse->desat->multiply->multiply->specular.
Now, my gut tells me this is a poor, inefficient way of doing things, but it may be that the memory/space savings outweigh the node processing costs. It may even be that the node processing costs are completely negligible (so please, enlighten me if this is the case).
So ignoring the obvious failings of simply using a desaturated diffuse as your specular, is this a common method of doing things? Or is it something I should maybe bring up to the TD?
Replies
In regards to speed: Keep in mind you have a very limited texture buffer on your GPU, especially if you go with XBox or PS3 development. In these cases, adding even a half-res Specmap takes away valuable space from the buffer, while another instruction most likely doesn't hurt the performance at all.
Thanks for the additional info on the 360+PS3 stuff as well!
I've gotta say this makes me cringe a bit, spec is generally the life of a material. Unless its something that has very little/no reflection. On certain materials like metal, rubber, certain plastics, lacquered wood etc, the spec is often what should get the most love.
Pulling a spec from diffuse should only really be done in cases where the spec is very simple or the material isn't really reflective. A spec map is a dataset of values, very often those values should not be the same value as your diffuse. Especially when you need to have any sort of material variation, say multiple materials on the same texture. For character art/skin, you end up with your diffuse being mostly the same value, but your spec should vary quite a bit depending on what part of the body etc. The eyelids should have much more spec than the elbows for instance, but that wouldn't even be reflected in the diffuse map, so you can't extrapolate that sort of data.
This is true, but at the same time 90% of game art is background stuff - building trims and piles of rubbish and random shit that nobody is paying attention to, so it's not worth spending the time/effort/texture memory on well defining the specifics of a well-handled leather bookcover when there are 900 books on the shelves and a dozen other tchotkes and the shelves are only in a room that the player walks through inbetween combat arenas.
If you're making an FPS weapon or a character or a hero prop, sure, go nuts, but 90% of game art is under the eye for 1% of the time.
Spec/gloss maps are awesome for important, dynamically-lit stuff (characters, fpsweapons etc) For mundane stuff it might not be worth it.
Even If you have somewhat important static object that requires strong material separation (like, gold, iron and concrete together) it might be beneficial to channel-pack masks and do some work in material editor instead. This way you can make some parameter controllers to tint, brighten/darken stuff, add grime, overlay detail, add reflection maps, make surfaces wet e.t.c. on the fly.
Again, this all is Unreal specific.
So this is an excuse to do it wrong?
Edit: Im with EQ on this, your spec is the life of the material. Just cause its not on the screen, the same as a char/wep doesn't mean it should not get some lovin. Your just creating a less appealing environment to run through. Yes its more on the engine but this isn't the 90s anymor either
More a case of how you spend your time and processing budget/memory.
as tech improves this argument will loose relevance.
I was however speaking more on a fundamental basis, and when we start to talk fundamental material representation, the spec map is often the life of your texture.
Too many artists fail to see the importance of spec, and just do some quick contrast adjustments on their diffuse textures, even for important assets. So it certainly is worth discussing.
There are some tricks though how to pull off a better Specmap from just the Diffuse, if you can invest some time in Shader tweaking. For example:
Imagine you have a fire-extinguisher with a red metal part and a greyish handle and some golden (yellow) parts.
Create a (Master-)Material for such cases, which allows access to the different Channels of the Diffuse. You know that the Red and the Yellow Parts are most reflective, so you might want to get a bigger influence of the Red Channel and least influence on the Blue Channel or even better substract the blue channel. If the assets Texture allows to seperate Materials by color that's a cheap way out and will often result in very good specularity differences
e-freak: Good pointers there, cheers. From the look of some of the speculars here, though, I think the artists might require slightly more fundamental education on the purpose/benefits of specmaps... Some of these are pretty pointless. o_O
another reason for doing that node based way is to not have to load another texture just for spec. depending on platform it could be pretty deadly for your framerates if everything had an extra texture just for spec.
also it's so much faster to quickly iterate your spec like that. arguably you could say that hey, when you are done experimenting with nodes you could just go into photoshop and polish it up. but usually for most intents and purposes I'd argue that the assets look "good enough".
This has been mentioned by almost everyone in the thread so far.
Certainly absolutely 100% not something I would agree with. If you're going to use a unique texture anyway, don't waste your time messing about with diffuse controlled specular. The relationships between diffuse and proper specular are extremely important, so both maps should generally be worked on at the same time. As you change your spec you may need to change your diffuse and vice versa, so making a completed diffuse and then adding a unique spec at the end is not only a poor way to work, but a time saving method is the last thing it would be.
Photoshop is very quick to iterate a spec map, I would say that. =P
Personally, I don't really want to talk about whats "good enough" I mean clearly the quality bar should be set by art direction and artists should have a well established idea of what is good enough, so its completely subjective to sit around and say what is good enough.
The only thing really worth discussing is how you can get the most quality, as you can always cut down from there. However, if artists do not understand the best ways to work and get the best results, you can't really go "up" from "good enough". So its best to really understand how this stuff works. I would rather base my workflow around getting great results and then cut it down when needed, than base it around doing the bare min. of work required to get the job done. But hey, thats me.
One of the big problems is that many artists simply look at specular as something you throw on haphazardly at the end to make your model look cool. This is really not the case, specular is essential to defining material properties, and you should have base spec/gloss values blocked in with your base diffuse colors to get a proper material read before you even start on detailing or anything else with your textures.
Man, I was waiting for someone to suggest this.... How about instead of using a specular map, we use the diffuse but plug in another texture to control it? Brilliant!!!
Well this only makes sense if your extra texture is very low res, but honestly, I would rather settle for a proper spec map that is low res at that point.
Oops, my bad, I mean creating a RGB like this:
And using that as a base with the AO to create not only a proper spec, but also a mask to control the Gloss/Power if need be.
...
...
...
Why the hell did I write that previous post like that, is beyond me. Sorry.
The great thing about Shader-Graphs is that you can easily insert If-Options, where you can add multiple variations to the Mastermaterial as well. Basically you could offer your fellow Artists the option to just use a random Spec-Color and Intensity (2 Instructions), use a Greyscaled Diffuse (4 Instructions), use a filtered Greyscaled Diffuse (8 Instructions), load a (lowres!!!) RGB-Mask for filtering (12 Instructions and a bit of texture buffer) or load a proper Specmap (loads of texture buffer and additional Instructions). (The numbers are just guesses!).
Additionally write an email to everyone on your team and explain them the difference in terms of how fast they will burn the 360 with 2k specmaps on every noodle-can in the skybox.
Edit: In general, if you haven't done yet: Do this awesome Mastermaterial Tutorial (Part 1 linked):
[ame]
I think it's even from a fellow Polycounter?
We use RGBCYMW (100, 010, 001, 011, 110, 101, 111), assign these 7 colors to highpoly objects to define various materials. Bake that down and use a script to extract those to their own layers in PS. Its really easy to just grab those masks and quickly set up diffuse, spec and gloss values to block out materials.
Then make sure you're using some quick file saving script to save d/s/g/n all at once, and its super fast to tweak material properties.
Thats Ryan
Yeah, this is something I'm seeing here. There doesn't appear to be a huge well of understanding of the real purpose of specmaps amongst the artists. I mean, it could be they're just rushing and don't give a shit, but I doubt that, since the rest of the stuff looks good. Even ignoring the fact that the specmaps are generated from diffuse via material nodes, a lot of the specmaps are all kinds of wrong (too bright, no material differential, etc).
That's a nice one, I'll have to keep that handy.
For some ungodly reason, the artists here refuse to adopt that. The TD's tried many times to get them to do that, but I can't understand why they won't. o_O
Its quite worrying how many folks still treat spec/diffuse seperately and think the diffuse lighting isn't reflection.
It really is easy to understand when you've broken down how it works and studied it. Here's a quick visual-
That said, I do remember the main reason for leaving out proper spec was to optimize, but the shaders the artists came up with always looked like wasteful spaghetti to me...not really sure why they never developed master shaders for that stuff.
We do this here (I use a PS action, which I hesitate to call a script - are you guys doing something fancier? I just have an action I run on a doc that I paste my baked maps into in a certain order that breaks them out nicely for me). James Taylor had a quick save script in his vTools and eventually a tech artist at work just re-wrote it so it'll crunch the output .tgas to our in-game format at the same time and force an update in-editor.
I'm assuming your PSDS are set up like this:
~d
- mat 1
- mat 2
- mat 3
~s
- mat 1
- mat 2
- mat 3
~g
- mat 1
- mat 2
- mat 3
~n
- mat 1
- mat 2
- mat 3
Reading what you wrote it sounded like you were setting them up like
~mat 1
- d
- s
- g
- n
~mat 2
Which seems more useful for porting a base material to a new PSD than the other way, but much more difficult to script.
And yeah, +1 for gloss having a bigger impact on material definition than spec intensity.
On my last project we had d/n/s and then a mask, which was rgb and did gloss, env reflection, and was originally going to do procedural dirt, paint, and like 3 other things until we scrapped it because the green channel has shit for detail after compression and isn't suitable for paint, and the procedural system would have required a lot of environment overhead for what we wanted to do.
And yeah, ultimately the reason for going with spec derived from diffuse was disk space/download size, and memory footprint concerns.
Among other things, I'll definitely be putting something together to that end. A lot of the current speculars make me want to stab my eyes with a fork.
A 32 bit compressed texture is the same size as two 24 bit compressed textures, so its the exact same memory use, all you save is a texture call. There really isn't ever reason to use grayscale spec in alpha over a full color spec, unless you have some specific shader restrictions.
Its a very common misconception that you're saving something when you throw textures into your alpha, but its not really the case.
Yeah, gloss is hugely important. To me, you can't do a proper asset with multiple material types without d/s/g/n. You end up with the doom3 style "everything looks like plastic" without some sort of gloss control. For simple assets you can get away with just a shader value, but anything with a lot of material variation, a gloss map goes a long way.
In Unreal terms, you can put the specular in the green channel, and the green in the alpha channel, then use normal map compression to slightly dodge artifacting - since unreal represents green with an extra bit and again when calculating lighting. This works best with slightly older versions of Lightmass prior which compensated less for the bit difference, it might not work so well now. As a result your scene is less green and your greyscale specular is preserved with more accuracy than had it been in alpha.
You might lose a bit of red however.
I know this thread is Unreal specific, but i'll broad it up a bit and say it really depends on your engine / shader system.
I don't know how Unreal works, but with CryEngine3 material editor, with a few minutes tweaking your material (spec strenght and color, glossiness,fresnel tweaks and environment cubemaps set up right) you get the exact same result as you would have if you had a spec map on it.
That's why for C2 we ended up getting rid of a lot of spec maps, and let the shaders do most of the work.
Granted, in some situations we needed spec maps, but in general if your material editor and shader support is powerful enough, you can get away without a spec man.
There's also a lot of "what if's" here, if you're working on a FPS weapon, you will obviously use a spec map to complement your material, but if your working on a environment asset for production, with a few sub-materials, it's generally cheaper on performance to get rid of spec maps and try and put the shader to do all the work.
So again, depends on whether or not your doing production work, and depends on the tech your using; if your doing shit for your folio, obviously always make spec maps; if your making a game that NEEDS to run on console with limited buffer for textures, then most of the times let the shader do the work is a wise decision.
Also, forget about using the alpha channel for your spec map. It's a lot more expensive than using a separate texture for the spec map; plus with a separate spec map you can add color variance to the reflections.
Right for certain types of simple materials, all you really need is some shader parameters, esp if you're only representing one type of material per texture or meshchunk/material chunk.
Even beyond that, a lot of materials really do not need a spec map at all, too often do I see someone make a crate, or a concrete wall, both dry/matte materials that would not need any reflection, but use some crazy ass spec map with loads of detail in it.... Then end up with a wet looking crate/concrete wall, as if you NEED to use specular on every material.
So yeah, common sense goes a long way too. =D
Throw the spec in the alpha channel of the Normal Map.
DXT5 and 8bit alpha.
Works ok.
I think you're missing the point, + alpha = double the texture memory, so the same as an aditional 24 bit texture but a lower quality spec map as its greyscale.
I've seen it used it a lot as rim lighting hack, stylistic choice, means of separating characters from background or various gameplay reasons but how often do you actually use it for driving specular intensity? It's sort of expensivish in UDK and effect is often too subtle for justifying instruction count.
Also, this post was interesting too. Appears even seemingly diffuse surfaces have pretty prominent specular components.
That blog post only shows off the changes in specular strength but fresnel also accounts for color variation in materials with colored spec (even the brown reflections in bronze etc get more white the closer the angle between your eye and the light source gets to 180 degrees. You can test this with a christmas ball and a blank paper).
So if you're gonna bother augment the spec with shader calculations, there's no reason not to apply a fresnel term.