Home Technical Talk

diffuse, specular, normal maps all the time!?

1
ViPr
polycounter lvl 17
Offline / Send Message
ViPr polycounter lvl 17
it's wrong. gloss is important. they are all channels for per pixel lighting. you can't pick and choose; they all belong together in a package. you either enable a model to have the engine do the lighting on it or not. in order to let an engine do the lighting you need all the channels. if you leave some out you could possibly end up with something that looks worse than when the engine did no lighting effects and everything was baked in. just imagine if you had only diffuse and normals, how would you get that to do everything? you couldn't; it would look stupid.

F.E.A.R. has all these channels including gloss and so does FarCry 1 and Unreal Engine 3. what made you think that gloss is not important? just coz Doom3 didn't have it? you're all letting yourselves be influenced by this mistake. i knew this would happen. if that game didn't come out you would all be doing your models correctly now.

i couldn't keep quiet anymore.

Replies

  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    Hehe I knew you would post this here at some point :P

    As we discussed it already my personal opinion, based on doom3/Q4 experience and specifix 3dsmax shaders, would be:

    Normal+diffuse+spec is great to describe a wide array of materials from wood to metal and plastics. Yet it has shorcomings that gloss *seems* to be able to paliate... However for complex materials I feel like just another map is not the holy solution. IE to look good nextgen skin need a dedicated shader. And skin is not glossy is it?

    Plus I don't think that 2 engines handle spec+diffuse in the exact same way.

    But then again - I have no experience with Ue3, and have no idea what the math behind gloss is. But I still want to play with that gloss-ready engine you are coding.Come on Vipr! Pictures!

    As for Doom3, well the Id guys simply created the engine they needed didn't they? Their game takes place in a Mars space station, and I can tell it looked just like that. Why bother adding features if it's already good enough? Any engine is still a hack to fake reality anyway, no matter how many textures are being processed. And one more map to be hand painted for each and every asset means hundreds extra hours spent on the project, which is simply a loss if it's for the sake of a mere tiny cosmetic improvement.

    Pfiew.
  • oXYnary
    Options
    Offline / Send Message
    oXYnary polycounter lvl 18
    Thats seems to be true. Gloss does help better define the differences in how spec shine spreads on the surface. I haven't seen any tuts that show how to manipulate this without gloss. Spec cant alone.
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    just because you can create something that looks good and realistic without gloss maps doesn't mean it's not wrong. you can create screenshots that look very good and realistic with only a diffuse texture map and no lighting but it will start to look strange if you see video of it or if you see various screenshots of it where someone has moved something like the camera, model, or lights.

    and pior, i showed you screenshots of my engine but i'm waiting for someone to make models that will really test it and show it off. so far basically everyone is doing everything with gloss missing. aaargh! so annoying.

    skin has various gloss levels and when it's wet or has baby oil on it, it appears to have high gloss. gloss is actually the smoothness or rougness of surfaces and the skin may not get smoother but the liquid on the skin will have a smooth surface because it is liquid and it seems to become the skin as far as the light is concerned. i THINK this is some of the science of it. some light will reflect going from the air to the liquid surface but not really from the liquid to the skin because the liquid and skin have pretty much the same index of refraction. there is also some skin on a part of our body that basically changes gloss because it changes how much it is stretched. the stretching causes the tiny wrinkles to flatten making the surface smoother.

    and actually about the mathematics. there isn't really an exact way of doing these things. i myself keep changing my shader algorithms and i've come to the conclusion that what the industry needs is to create texture compilers or something where artists create textures in super high res at 64bit float per channel (or something high) and some scripts add, subtract, multiply divide, etc numbers and other textures to them and basically do brightness contrast and gamma adjustments or any mathematical operations or filters whatever to get the textures adapted to a particular game engine or so the programmers can change their shaders and the artists don't have to get all stressed out.
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    I'm sorry but you lost me here:

    "just because you can create something that looks good and realistic without gloss maps doesn't mean it's not wrong."
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    ok i meant realistic looking and when i say wrong i mean very wrong as opposed to slightly wrong because all graphics are kinda slightly wrong,

    and yah i know not everything needs a gloss map but i'd say most things do. some things could do with just a uniform gloss level stated in the material. that would be 1 number instead of loads of different numbers as the texels of a texture.
  • Daz
    Options
    Offline / Send Message
    Daz polycounter lvl 18
    "just because you can create something that looks good and realistic without gloss maps doesn't mean it's not wrong."

    In my book that statement is wrong actually. If it works for most people, it's right. I don't know who you are, but no matter how skilled a programmer you are I think you're failing to understand the entire spectrum of factors that go into making a videogame. Diminishing returns ViPr.

    You keep talking about what is right and what is wrong and I'm afraid that's just a totally nonsensical way of looking at it. It's just not that binary. If you can 'sell' a 3D scene to a player, then it's right, no matter what code is going on under the hood. There *IS* no right or wrong.

    When I look at the world around me I don't see polygonal edges everywhere, so when I see the same in a videogame do I decide in my head that it is 'wrong'? No, I accept that it's a computer generated world and that there are certain limitations and I look at it with a more forgiving perception.

    I'm not disputing that gloss mapping is the technically correct way to go, but posting about it in such a condescending arrogant way is probably not likely to get you too far. Now, if you'd posted something that was far more mature, polite, informative and possibly accompanied by helpful explanatory diagrams, people might actually sit up and take note. Your approach feels all wrong to me.
  • Neo_God
    Options
    Offline / Send Message
    Neo_God polycounter lvl 18
    I think a better approach would be somewhere along the lines of "Why aren't more people taking advantage of this?"

    Honestly I've never worked with a gloss map. I've never been asked to make one. I'm not even sure what one looks like. It probably something I should look into more (along with ambient occlusion, which seems to be growing in popularity). Because one must always get with the times.
  • fritz
    Options
    Offline / Send Message
    fritz polycounter lvl 18
    i for one would like some more info on this gloss thingy.
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    people tell me i'm always angry and negative about everything. i can't help it. it's in my nature. i like your work though, Daz. i wish you'd be the one to make a model for me with gloss. i think using your models would probably be the best way for someone to test if their engine can achieve photorealistic video or not.
  • almighty_gir
    Options
    Offline / Send Message
    almighty_gir ngon master
    the right way of doing something is the most economic.

    if you can save memory space by leaving out a gloss map, and getting the same result, then it makes more sense to do it that way.

    simple as that.
  • Ninjas
    Options
    Offline / Send Message
    Ninjas polycounter lvl 18
    Gloss is nice. Neo_God, it is a map that controls how tight the specular highlight is. That way you can give a tight higlight on patent leather or eyeballs, and a softer spec on skin.

    I have to say that a lot of things are going the way of having their own special shader, so it doesn't matter so much.
  • Eric Chadwick
    Options
    Offline / Send Message
    [ QUOTE ]
    what the industry needs is to create texture compilers or something where artists create textures in super high res at 64bit float per channel (or something high) and some scripts add, subtract, multiply divide, etc numbers and other textures to them and basically do brightness contrast and gamma adjustments or any mathematical operations or filters whatever to get the textures adapted to a particular game engine or so the programmers can change their shaders and the artists don't have to get all stressed out.

    [/ QUOTE ]
    That's the basic idea of what we're doing here, and it is not a trivial task. We've barely scratched the surface. But the idea is a solid one, if you can get it working well.

    Gloss is a nice tool to have, but ultimately I have to make tradeoffs... do I want to incurr another pass for this particular effect, or do I want to spend that pass on something else like a sub-scatter effect? Does that super-duper shinetastic shader end up slowing down the framerate on my target hardware?

    For a "star" item though, like the closeup emotional scene where the babe is glistening with blood, sweat and tears, then the cost is worth it while you dial everything else way down.

    That super-duper specular is only going to show up on the high-end Xbox360 sku, but it's gonna go bye-bye for the inevitable Xbox/PC/whatever port.

    Got any pics to share?
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    i think if you want to leave out a texture map i'd say it's better to leave out the specular map instead of the gloss map. if you've got the right shader that could work well.

    i wrote this explanation a long time ago. don't get furious with me if it's not accurate:
    http://www.geocities.com/vi_pr/gloss_explanation/gloss_explanation.htm
    and when i say things like "correct" or "wrong" take it to mean "relatively more correct" or "relatively more wrong" instead of absolutely correct and absolutely wrong.
  • adam
    Options
    Offline / Send Message
    adam polycounter lvl 19
    I'm more of a fan of cube-map masks than I am specularity/gloss.

    Also, I'd be interested in seeing an asset done using spec, then done using gloss and see the differences side-by-side.
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    with the right shader, the cube map mask is the specular map.
  • Neo_God
    Options
    Offline / Send Message
    Neo_God polycounter lvl 18
    I might not be the best person to post such a comparison. But I quickly figured out the basics of the gloss map. And made a quick one for my zombie head (because its surface types vary) to compare it to the specular map. With the gloss map on, I just set the specularity to 50.

    Gloss Map:
    Gloss.jpg

    Specular Map:
    Spec.jpg

    I like the gooey parts better with the gloss map, however since the spec level is the same throughout the whole model the normal flesh looks way too shiney.
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    you can't just compare things like that; you have to play with the amounts, you have to know which shader to use (in my explanation page at the bottom you can see 2 widely different ways of doing specular and gloss), and also a specular map does not even look like a gloss map, for one thing a specular map is color while a gloss map is greyscale.

    with the shader i like, generally for this model you'd want the wounded part to have parts that go to maximum gloss and the rest to be kinda low gloss. high gloss would make things look wet while low gloss would make things look dry. high specular would make things look more metallic.
  • Illusions
    Options
    Offline / Send Message
    Illusions polycounter lvl 18
    I don't see what you need a gloss map for, when the only thing that determines if something is "glossy" or not is the microscopic structure of the surface. "Glossy" things are generally smooth, and "dry" or soft specular objects are usually well, not smooth. Couldn't the same thing be accomplished through clever use of the bump/normal, and specular maps?

    Yeah, found what I was thinking of:

    http://itchstudios.com/psg/art_tut.htm
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    yes i mentioned the relationship between bumps and gloss maps in my explanation page.

    and of course you can do things to create the illusion of something but it won't be the same and under certain conditions or if people decide to check they'll notice something is not right. or lets put it this way; it's a much better more robust and more correct way of creating the illusion of realism to use gloss maps.
  • Illusions
    Options
    Offline / Send Message
    Illusions polycounter lvl 18
    By clever use I didn't mean illusion, I meant intelligently understanding the surface you are texturing in both its macroscopic and mircoscopic surface detail, and how this works, and then applying it to both the normal/bump and specular maps, and you won't need a gloss map.

    If by correct you mean as how its accomplished by physics in reality than this is the way. If I had time I would demonstrate today.
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    actually ok i think i know what you are talking about and yes that would be a more correct way but it's not feasible, and i also mention why in my explanation page, and anyway if you did use that method you could still use a gloss map to tell the software where to put procedurally generated bumps.

    the most important thing is not exactly how the computer calculates these effects. what's important is that it at least prompts the artists to create art assets in a way which is highly universal and can be easily convertible or portable between different engines/shaders. making textures the Doom3 way means much of the textures will have to be probably scrapped and redone from scratch instead of converted.
  • adam
    Options
    Offline / Send Message
    adam polycounter lvl 19
    Er - who would be making assets that'd be widely transferable between game engines? Especially the major FPS engines. That's a silly assumption IMO. Even if you are on a project that happens to switch engines mid-way through production you still don't PLAN on this. You create the assets to best suit that engine, not to best suit ALL engines.
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    the problem is that engines change specifications during development or at least they want them to. just look at Duke Nukem Forever. it's nice not having to predict at the start of development how sophisticated the engine should be at the game's release. it's nice not having to worry that the game will look outdated if it goes behind schedule and it's nice not possibly having to scrap everything and start over for a better engine.

    just create all the assets as though they are for a hollywood movie and then at the end create all the lowpolys and have the software generate all the textures for the lowpolys from the highpolys.

    this way is extremely convenient if you will have sequels or if the there is a cg heavy hollywood movie related to the game.
  • adam
    Options
    Offline / Send Message
    adam polycounter lvl 19
    Uhm.. what? If I sat there and created every asset as if it were for a CG heavy hollywood movie the game would never get finished.

    You for real or..?
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    you don't have to create them at that high quality. the point is it's nice not having an upper limit on the quality level of the source assets.
  • EarthQuake
    Options
    Offline / Send Message
    Do you have any idea the amount of time that takes to actually do?

    Are you seriously also suggesting using a gloss map, *isntead* of a spec map? Any decent engine will have gloss settings per mesh chunk/shader. How you could posibly go without the detail and color of an actual spec map is beyond me, your asset would look like shit. Gloss is not a replacement for specular value by any means.

    [edit]
    Also your solution is completely useless in a situation where you have mutliple materials in a single texture, say, metal, wood, and cloth. All of these have different spec values and different gloss values, but in this case the spec value is going to be way more important, not to mention spec color. And you can easily find a mid-ground gloss value that will look decent on all of these materials if you've got a proper spec map. The same can not be said in the inverse, you could never have the same spec value on metal as on cloth even if you had a good gloss map..... And even if you somehow managed to get that to work right, you're missing the detail you would get from variation in the spec map as well. You would get gloss variation at best and that is nowhere near close to being "right"

    [ QUOTE ]
    F.E.A.R. has all these channels including gloss and so does FarCry 1 and Unreal Engine 3. what made you think that gloss is not important? just coz Doom3 didn't have it? you're all letting yourselves be influenced by this mistake. i knew this would happen. if that game didn't come out you would all be doing your models correctly now.

    [/ QUOTE ]

    This also makes me want to punch you in the face, just fyi. Learn to write without coming off like a fucking asshole and try again please.
  • Rick Stirling
    Options
    Offline / Send Message
    Rick Stirling polycounter lvl 18
    So - is this just the same as specular falloff/tightness for most practical applications?
  • EarthQuake
    Options
    Offline / Send Message
  • Rick Stirling
    Options
    Offline / Send Message
    Rick Stirling polycounter lvl 18
    Don't most people have that in their shaders these days? A spec map, a spec strength and a spec falloff?
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    no i'm not suggesting gloss INSTEAD of spec map. i want both but i'm saying gloss can be more important than spec.
  • Joao Sapiro
    Options
    Offline / Send Message
    Joao Sapiro sublime tool
    the thing is : why use another map, hence consuming more memory if you can make something look good with just normal , specular difuse ? If there is the need for a gloss map im sure people will use it .
  • motives
    Options
    Offline / Send Message
    motives polycounter lvl 18
    [ QUOTE ]
    Don't most people have that in their shaders these days? A spec map, a spec strength and a spec falloff?

    [/ QUOTE ]
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Rick: Surely spec maps and spec strength are the same thing? Brightness for strength, colour variance for... colour variance. Then just a greyscale channel for falloff. That's just an RGBA image (and I think Doom3 has been modded to use materials like this).

    Anyway, stuff like this is all just hacks and tricks.

    As Daz and others mentioned, as long as it looks fine and runs fast, who cares what maps, parameters, hacks and tricks it uses. A gloss map is just another hack, ideally you'd just control the bumpiness of the surface on a really high level and have a map to specify the brightness and colour of the highlight, as has already been said.
  • kat
    Options
    Offline / Send Message
    kat polycounter lvl 17
    ViPr, leave these good people alone before you get your ass whooped!
  • Rick Stirling
    Options
    Offline / Send Message
    Rick Stirling polycounter lvl 18
    [ QUOTE ]
    Rick: Surely spec maps and spec strength are the same thing?

    [/ QUOTE ]

    You think that, but no. The strength is basically just a multiplier that works with the map.
  • Eric Chadwick
    Options
    Offline / Send Message
    If your specular strength is simply a 0% - 100% range, then brightness of the spec color map does the same thing as the multiplier. You're double-multiplying it, which can be nice I guess, it doesn't all have to be in the bitmap.
  • Whargoul
    Options
    Offline / Send Message
    Whargoul polycounter lvl 18
    Yes, it's sometimes referred to as specular power, cosine power, cosine falloff or glossiness. Cosine power is the most approriate term because it best desribes the math behind it. We either set it on a per-shader basis (set the spec power) or with a per-pixel map, usually stuffed into the alpha of the spec colour map.

    I don't think it's some huge amazing thing - most people use it already, see almost all 360/PS3 videos, the artists are controlling the size of the spec (probably on a per material basis). And most art packages already support it and people use it, perhaps not knowing they are.
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    yah and sometimes like in F.E.A.R. there is a texture and also a material value and that number acts as a multiplier on the texture like a scale. when using integer textures it's good to have scale & bias sometimes to multiply and add numbers to the values in the texture map so the texture map can be normalized so that it uses the full range of possible integer values but then those values can still be converted to more the actual values. it's kind of similar to a runtime contrast & brightness adjustment so you don't lose precision from the rounding off errors of doing it beforehand.
  • Black_Dog
    Options
    Offline / Send Message
    Black_Dog polycounter lvl 17
    [ QUOTE ]
    If your specular strength is simply a 0% - 100% range, then brightness of the spec color map does the same thing as the multiplier. You're double-multiplying it, which can be nice I guess, it doesn't all have to be in the bitmap.

    [/ QUOTE ]

    It can be very nice, because if you are using a fairly grey and dim spec map then DXT compression noise can be large compared to the image signal. In bad cases the result is an awful greeny/purple mess.

    Throwing a multiplier in there means you can use the full range of an 8 bit image format and still get dim spec values, crushing compression noise right down to non-visiblity (and improving precision to boot). This works quite nicely in doom 3.
  • EarthQuake
    Options
    Offline / Send Message
    yeah i would assume so, we do atleast.
  • Eric Chadwick
    Options
    Offline / Send Message
    Oops. forgot about the precision, good point.
  • EarthQuake
    Options
    Offline / Send Message
    [ QUOTE ]
    no i'm not suggesting gloss INSTEAD of spec map. i want both but i'm saying gloss can be more important than spec.

    [/ QUOTE ]

    Only if you were doing a flat material that didnt need any specular detail. Thats the only way i see that being benificial at all.
  • EarthQuake
    Options
    Offline / Send Message
    I knew this would happen.
    gravity.jpg
  • adam
    Options
    Offline / Send Message
    adam polycounter lvl 19
    hahahahahah.. man, I like the cut of your jib.
  • torncanvas
    Options
    Offline / Send Message
    torncanvas polycounter lvl 17
    Now that we're being ridiculous... if you were really leet you'd dynamically invert the spec map so that most of the values for each texture would always be toward the high end, since there's more bit precision there. cool.gif
  • Ruz
    Options
    Offline / Send Message
    Ruz polycount lvl 666
    so from what I read, the 'spec power' or 'glossiness' controls the shape 'and' size of the highlight and the specular controls the intensity of the highlights within that shape?

    if you just had a spec power map ie a texture and a numerical value for the specular intensity, then this would look very similar to doing it the other way around?

    the subtley here is lost on me and is very confusing
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    how about imagining it like this:

    gloss stretches/compacts the width of the bell curve.
    specular stretches/compacts the height of the bell curve.

    in some shaders:
    gloss stretches/compacts both width and height of the bell curve in opposite ways while specular stretches/compacts the height again more after that.

    in answer to your second question. no it's not the same.
  • Rick Stirling
    Options
    Offline / Send Message
    Rick Stirling polycounter lvl 18
    But in most next gen game shaders:

    specular falloff stretches/compacts the width of the bell curve.
    specular map/strength stretches/compacts the height of the bell curve.

    Or am I missing something?
  • ViPr
    Options
    Offline / Send Message
    ViPr polycounter lvl 17
    yah basically, gloss can be called many different things.

    btw i suspect, in actuality, with most shaders, the width of the bell curve is not actually changed but a gamma adjustment is done to the curve.
  • Whargoul
    Options
    Offline / Send Message
    Whargoul polycounter lvl 18
    I doubt anyone does a gamma correction to the curve.

    SpecularValue = (pow(saturate(dot(Normal,HalfAngle))),SpecularPower) * SpecularColour

    and that's it.

    Find the amount the surface would reflect the light source (N dot HA), raise that to some power (either a shander const or a map controlled value) - this shrinks the width of the bell curve as you call it, then scale it by your specular colour (scales the height, and biases it into a colour if it's tinted).

    In use, you also have to scale the specular power by a constant to get it into a useful range (and we picked it to match Maya's Phong shader), because cosine power is usually in the range of 0-100 and the map is 0-1. Scale & bias on the spec colour can help if you're running into precision problems in the lower end, but we don't to maintain compatability with Maya's hardware viewport for quick prototyping.

    Again, I'm not sure why this was brought up and made a big deal, it's super simple, well-known and common in engines/renderers.
1
This discussion has been closed.