Home Technical Talk

Specular map question

polycounter lvl 18
Offline / Send Message
FAT_CAP polycounter lvl 18
Hey - I've posted question this in my competition thread aswell - but I think that this is a better place to post it really... I know how easily posts can be missed in the competition forum if your not taking part yourself. smile.gif

If this is against any board rules - MODS - please feel free to delete this thread.

I was wondering if anyone can help me out with some specular map questions I have (thats the next on my list to move onto).

How do I control the strength of the shine on different parts of the model? not just the brightness of the spec but the actual "glossiness".

i.e - the eyes should have small, "tight" highlights on them as they are very shiny and wet. However the skin should by less shiny and therefore the highlights would be larger and more diffuse. The teeth would have a specular somewhere inbetween the two.

How would I go about doing this in the constraints of this competition? I know that you paint a spec map much like a bump mamp - with white areas being more shiny and black areas being less-so... but this will only let me control the sttregth of the spec wont it? Not the actual "diffuse-ness" or "tightness" of the shine itself?

Reading this back - Im not sure if Im getting my point across very well!!! I dont really know the technical terms for what Im trying to achieve - or even if it is possible at all.

Anyway - I hope someone can help me out on this one - not long till deadline time now! laugh.gif

Replies

  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Hi FC

    We had a neat discussion about this issue (and also many others) on the old board. I think I have it archieved somewhere, I'll see what i can do.

    Besides that(and i don't know if it works or not) maybe you could try to use the bump map to get the control you want.

    If you place many many little dots on the bump instead of a plain grey color, chances are that your spec highlight will be 'spread' accross these little dots, resulting in a less glossy, more rubber-like surface.

    I still have to test this out myself, but I *guess* it may work okay?

    Any other ideas polycounters?
  • Eric Chadwick
    Pior's right, the bump map idea is exactly what's going on with specular width. Fine bumpiness = wide highlight. It may help to think about specular as being just a reflection of the light source. So when a surface is bumpy you're breaking up the reflection into lots of little reflections. Good example is the reflections of headlights in a rainy street at night.
  • pior
    Offline / Send Message
    pior grand marshal polycounter
    Hmmm yeah Per I thought about that but I had no chance to check this in practice hence I thought it could be useful to share the idea anyway smile.gif

    And, well, even if fine details like that 'could' be added on a highresolution bump, the problem is not solved when the texture size decreases as LOD is getting down. Damn.

    Is there a game engine that actually gives control to the specshape, as you suggest it? I always thought this factor as something hardcoded and hard to tweak. But yeah maybe it's doable, say, in doom3?

    Now that I think of it, I believe that Vahl managed to pull off something of this kind. He managed to create nice 'wet paper' effect on the flamethrower texture some weeks ago, dunno how he did that tho. He might have an answer for you F_C.

    This spec control is certainly a very important issue smile.gif Can't wait to see it solved!

    pior
    www.pioroberson.com
  • kleinluka
    Offline / Send Message
    kleinluka polycounter lvl 18
    like, shaders?
  • FatAssasin
    Offline / Send Message
    FatAssasin polycounter lvl 18
    Bump maps will break up the specular highlight, but not really change how sharp it is. In a 3D app like Max, the spread of the specular highlight is controlled by the Gloss map. Pure white gives you sharp highlights, like in the eye, and closer to black gives you a nice spread out shine, like on cloth. Most, if any, game engines aren't going to give you two maps for specular control, but I'm sure that will change in the future.

    Example:
    Two spheres with the same gloss amount, but one has bump. Notice that the highlight doesn't change size.
    specSample01.jpg

    To change the overall size of the highlight, use a gloss map. Sphere on the right has a lower gloss value and so the highlight spreads over more of the object.
    specSample02.jpg
  • FatAssasin
    Offline / Send Message
    FatAssasin polycounter lvl 18
    [ QUOTE ]
    FatAssasin: I find it funny that in your example of the highlight not changing size, it actually does change size wink.gif

    [/ QUOTE ]

    I knew someone was going to say this. It really doesn't change size. I'm talking about the spread of the highlight over the entire surface of the sphere, not the illusion that it's gotten bigger because it's broken up a bit.

    Here's another example:
    specSample03.jpg

    Each sphere has a progressively smaller bump value applied to it. According to your theory, the last sphere should have a highlight that covers a lot more of the sphere than the first one, which has no bump. But instead the specular highlights are equal. And in fact, they are more or less the same size on all spheres. And, yes, I am using super sampling for the render.

    Specularity in 3D is a complete hack, it's a way to fake what happens in the real world. This is why there is more than one control for the specular highligh in 3d apps. In Max, it's the Gloss value, in Maya, it's Roughness, Highlight Size, or Eccintricity.

    If you really want to prove your point, create two spheres with radically differenct specular highlight sizes, like I have in my second example from my first post, using only a bump map. It just won't happen.
  • FAT_CAP
    Offline / Send Message
    FAT_CAP polycounter lvl 18
    Cool guys. Lots of discussion on the subject here - it seems like a problem alot of us have come up with before.

    I'd actually thought of the bump map/ spec map with small, fine bumpiness - should give a "wider" specular highlight, driving home after I posted the question.

    However, when I got around to trying it that night. I couldnt get the results I was wanting by simply using a spec map. However, I thought this might be down to my own unlearnedness in spec map/ material situations omre than anything!!!

    The post by Ether (Caroline) in the pimping and previews is the sort of thing I was aiming for - where the lip has a tight specular over it - and the skin has a more diffuse shine...she used more complex material settings than a simple spec map though.

    So it seems that this sort of thing cant be done with the simple spec maaps we have available to use in realtime situations at the minute - at least not with only 1 alpha map - for speclarity?

    My original querey was directly linked to my competition entry for the Polycount Elementals challenge - so things like the glossiness material attribute aren't feasible solutions for me - only 1 alpha per map.
  • Eric Chadwick
    One thing to consider is that spheres don't scatter a bumpy specular as well as flat surfaces, so it should be wider when seen on a flatter surface.

    Per128, please do.
  • FatAssasin
    Offline / Send Message
    FatAssasin polycounter lvl 18
    [ QUOTE ]
    FatAssasin: You talk of what happens in the real world.

    [/ QUOTE ]

    No, I'm talking about what happens in a 3d rendering engine. You keep bringing up real world examples, and that just isn't going to help with the problem of controlling the size of spec highlights on the computer. I'll repeat, that's why there is more than one control for specularity in 3d apps. The sharp highlight on Ether's model comes from using a wetness map in Brazil's Skin shader. This is very similar to the Gloss map in Max's basic shader that I keep refering to.

    And Fat_Cap, when you couldn't get the results you wanted it isn't because you don't know what you're doing, it's becuase it's doesn't work that way in 3D.

    I would really love to see some actual examples of the specular hightlight on an object increase dramatically in size (like the difference between wet lips and dry skin) using only a bump map. It's a very popular misconception, and I'm trying to make sure it doesn't get passed on to someone just starting to research the matter.

    Per128, you don't need to get your website up, just render out an example and post it up. If I'm wrong I'd really like to be educated as well.
  • Eric Chadwick
    Maybe not the best example, but maybe it gives you some idea.

    bumped_specular.jpg

    3ds max 5.1
    Scanline renderer
    Max 2.5 Star supersampler
    Specular Level = 100
    Glossiness = 75
    Left = no bump, right = bitmap Bump @ 100
  • FatAssasin
    Offline / Send Message
    FatAssasin polycounter lvl 18
    Okay, now make the specular highlight bigger to cover a greater area of the face using a smaller bump map. That's the theory right? I guarantee it's not going to happen.

    Fat_Cap: To answer your initial question, "How would I go about doing this in the constraints of this competition?", what are the exact constraints?

    Generally, in a game engine you're just not going to get the same amount of control over specular highlights that you're going to get within Max or Maya. You might just have to live with the limitations imposed by the contest rules. But I'm not familiar with what those are.

    You can use normal maps right? Well, try using that to control specular size like Per and Eric say you can do with bump maps, but ultimately I think you're going to be dissappointed with the results.

    I think you're best bet is to find a good medium sized highlight you can live with and then change the intensity using a spec map. I know that's not the answer you're looking for, but usually that's what you have to live with when making game ready art.

    I don't know if you can use a reflection map, but that might be worth experimenting with. Use one map that contains sharp detail for the eyes and other very shiny parts, and then the specular map for softer, less shiny parts and keep the intensity low.
  • Eric Chadwick
    [ QUOTE ]
    [FatAssasin] Okay, now make the specular highlight bigger to cover a greater area of the face using a smaller bump map. That's the theory right? I guarantee it's not going to happen.

    [/ QUOTE ]
    Right, but it's not gonna happen because software lighting doesn't emulate real-world lighting properly. There's a lot of scattering and light bouncing going on with real bumpy surfaces. A really wide highlight like you showed earlier is not a realistic one, unless the surface has a lot of scattering going on.

    Neil has some nice examples here.
    http://www.neilblevins.com/cg_education/aniso_ref/aniso_ref.htm

    I agree that since we have very limited specular controls in current game hardware, it's probably better to come at it from another angle, like multiple reflection maps, or even by calling different mips from the same refmap (if you have that kind of control available). Although I do know for a fact you're not likely to get per-pixel mip-lookup control, since that approach is hardware-unfriendly (too bad though!).

    [ QUOTE ]
    [Per128] Remember that there's no world-size to specular highlights, only an angle-width size, so if your normal map surface goes through a higher range, the specular highlight will appear smaller. Maybe it's time I uploaded my website, I have a tutorial on this subject.

    [/ QUOTE ]
    I for one would like to hear more about this. I'm not quite understanding what you're saying Per128.
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 20
    the exponent of the specular term in the phong lighing equation is responsible for its shape afaik

    color = attenuation*(max(0,dot(N,L)*diffuse + pow(max(0,dot(N,H)),shi)*gloss)*lightColor

    so the *gloss = specular map is just a multiply layer how much of your specularity is visible, the "shi" shininess factor would change the shape of the highlight.

    since exponential functions are expensive and mostly approximated, there aint much variety in games yet. However with modern gpus it shouldnt be much of a problem anymore to get very decent shader support and change the exponent and with it the size.
  • Eric Chadwick
    [ QUOTE ]
    [CrazyButcher] so the *gloss = specular map is just a multiply layer how much of your specularity is visible

    [/ QUOTE ]
    3ds max has it labelled backwards, not sure why. The spinner for Specular Level controls brightness, and the spinner Glossiness controls width/falloff.

    We're using an exponential curve, not too expensive as far as what I hear. Here's an example of it running in our engine, ignore the temporary goofy distortion which will be going away soon. Anyhow, Specular Level was left constant, while Glossiness has been altered...
    specular_glossiness.jpg

    Hardware is apparently pretty limited with what it can do for your specular. This was from an ATI Radeon 9800 XT. On a NVIDIA GeForce FX 5200 there was some ugly dithering and banding. Oh well, not that visible in a typical gameplay scenario really.
  • FatAssasin
    Offline / Send Message
    FatAssasin polycounter lvl 18
    [ QUOTE ]
    FatAssasin, for someone with complete disregard for light theory, you are surprisingly absolute in your opinions.

    [/ QUOTE ]

    Easy there, big fella. I think we can continue to have an intelligent discussion about this. My whole point is that real world light physics don't apply when talking about how to get a certain effect in a game engine, which is explained perfectly by Eric when he says, "Right, but it's not gonna happen because software lighting doesn't emulate real-world lighting properly." That's been my exact point all along. I'm trying to give Fat_Cap an answer to his question that will work in a game engine and look good, not try to explain light theory and how light bounces around on objects in the real world. While it is definitely good to know the physics behind what happens in reality, I believe it's even better to know how to get what you want using the tools at hand.

    Eric: Cool examples. I didn't know this functionality was being developed in a game engine. Glad to hear it is. I would also like to point out that it demonstrates the other point I was making, that is you need two controls for the specular size. One spec and one gloss (or whatever you want to call it).

    So to sum up, what I'm trying to say (not very successfully it seems) is that in the particular case of wanting to control the size of a specular highlight in a 3d game engine, a bump map isn't going to do get the job done, regardless of how bumpiness works in the real world. What you really need are two seperate controls, as Eric has shown in his last example.

    I'm not trying to start a war here, just tying to help out a fellow artist get the effect he's after, which everyone here is also trying to do. I just don't agree that a bump map is the right road to go down. smile.gif
  • Eric Chadwick
    I'd like to hear more about "...if your normal map surface goes through a higher range, the specular highlight will appear smaller..."
  • poopinmymouth
    Offline / Send Message
    poopinmymouth polycounter lvl 19
    I have not yet used an engine where I could break up the specular to the degree I want using only a bump map. I crave a 2nd map that controls the spread of the specular, as well as the main map to control intensity and color. I think this is one of the main problems I have with most normal mapped games. Despite the bump/normal texture, the specular behaves the same over the whole object, making it look like a painted figurine or action figure. If there was a map to control the specular behavior in all its variations, I think we could get some much more believable materials in games.
  • FatAssasin
    Offline / Send Message
    FatAssasin polycounter lvl 18
    [ QUOTE ]
    FatAssasin: We'd already established that the bump map route was not a viable one for real-time purposes before you even joined the discussion.

    [/ QUOTE ]

    Sorry, I didn't see that post then. That's all I've been saying this whole time. So we're actually in total agreement. I love it when we find out that we actually can all get along. smile.gif

    About my "stance that a finely grained bump map controlling the size of highlights is a 'popular misconception'", I'm talking about the very specific instance of using bump maps for controlling the size of specular highlight in a game engine. I'm not talking about theories and what happens in the real world, which I've tried to explain more than once. So I stand by my stance and sincerely doubt that we'll ever see bump maps used to control specular highlights in a game engine. The fact that it's a popular misconception in this particular case is bourn out by the first two posts in the thread.

    So I'm not doubting your general theories of light or any of your equations. I'm sure you know way more about the subject than I do. So please keep in mind that I'm talking about the practicle usage of bump maps for controlling specular highlights in a game engine, and since we've already agree that it's not a good way to go, maybe we can think of other ways of helping this young man out.

    Any ideas?
  • Whargoul
    Offline / Send Message
    Whargoul polycounter lvl 18
    What you guys really want is control over the spread of the specular highlight, right? In Maya you have the "Cosine Power" attribute for Phong materials. Even the name shows you what you are controlling: the power that the specular colour is taken to, to achieve the final colour. Crazy Butcher has it accurate in his lighting equatoin. This could potentially be controlled by a map, and yes, you can fake it with a bump map, but it's usually not worth the trouble. To do it properly, you need a very high-rez bump map or you end up with speckelling (like Eric's face example). | And if it's very high-rez, you then need massive super sampling to capture all the small highlights to blend them together. You end up with flahsing, sparkly highlights otherwise (trust me, I've tried it - lots). You have to deal with filtering, and it can make the surface light poorly: you really only want to blur out the highlight and leave the base surface alone. The best way to handle this is with the proper attribute (power / gloss / whatever it's called).

    It's entirely possible to do this with the newer shaders (we are, on our new Xenon/PS3 game). Since they support loops & branching, you just have a loop that does the pow as many times as defined by the material attribute passed in. We do it on a polygon level (each poly has a material which specifies the spec power as well as the coloured gloss map to multiply it). It could be done with a separate map too, just use a texSampler to get the pixel colour, set it in range and use that as the number of pow loops to perform. I decided not to, as it's another map, and it just didn't need that much control. This can also be emulated on the older shader models, by having hard-coded shaders for each specular power (you only need a few in reality to get most of the looks you want). For exampole, Doom3 always used the same shader, so it always has the same degree of specular spread. If they'd added a couple others, they could have had nicer materials.

    The soft, spread out highlights are a low power (cheaper in the shader - less ops) and the tight, hot ones are a very high power. Good for metals and the like.
  • Eric Chadwick
    Great post. This will be good fuel to add to the fire in my talks with one our programmers, who asserts that the bump alone should be enough to control the specular width.
Sign In or Register to comment.