Home Technical Talk

Skewed Specular Highlight?

polycounter lvl 13
Offline / Send Message
TychoVII polycounter lvl 13
So I baked some normals down on to the barrel of a rifle I'm working on and all the specular highlights are going every which way. I tried with the cage and with an offset, but always the same. If anybody could enlighten me as to why this happens I'd appreciate it greatly.

Skewed_Spec.jpg

Replies

  • EarthQuake
    Options
    Offline / Send Message
    That is a problem with your normals. Looks like some smoothing errors there. What app was it baked in, and what app are you previewing it in? It may just be a matter of inverting hte green channel in your normals.
  • TychoVII
    Options
    Offline / Send Message
    TychoVII polycounter lvl 13
    Hey man. I baked it down in Max 2010 and am previewing it using Max's hardware realtime preview. I'm quite positive it's got nothing to do with the green channel since i've never had to flip it before for previewing this way, and I even flipped it anyways just to be sure. I honestly have no clue. Here's what the low poly smoothing groups look like.

    Skewed_Spec2.JPG
  • Ghostscape
    Options
    Offline / Send Message
    Ghostscape polycounter lvl 13
    reset X-forms on the low-poly model and rebake, if the transforms are off it can screw up your normals/bake.

    export your projection cage in the modifier first so you don't have to set up the cage again before you reset X-forms.
  • TychoVII
    Options
    Offline / Send Message
    TychoVII polycounter lvl 13
    Ghostscape, thanks for the help. I tried what you suggested, but still no dice :/
    This isn't the first time this has happened to me either. I kind of thought it would be one of those common problems that everybody but me knew how to fix. Guess I lucked out this time and got a genuine pain in the ass bug. I don't know if this would be of any help, but here's a shot of the texture.

    This UVW layout is only the barrel that you see above.

    Skewed_Spec3.jpg
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Max's normal baking and display is quite poor IMHO, I've never been able to get a totally clean artifact-free bake, even when the same meshes in other apps (Maya, XNormal, in-house tools) produce perfect results.

    I think it's either a problem with the baker or the way it calculates tangent space in the viewport.

    Does it look better or different if you render it with the scanline renderer, or even with Mental Ray?

    I bet the problems would go away if you baked and previewed it in XNormal (or Maya if you have it available).
  • TychoVII
    Options
    Offline / Send Message
    TychoVII polycounter lvl 13
    I'm rather astounded now. I've tried baking down with scanline, mentalray and Xnormal and all have yielded the same result.

    I created this shape in a few minutes to see if the same problem would arise and it did. I wonder now if anybody else is able to recreate this issue? Here is the shape I made as a test:

    Skewed_Spec4.JPG

    The bottom is the original high poly, the middle is the cage I used, and the top is the final result on the low poly. I don't suppose anybody would be willing to try this in Maya?

    EDIT: I tried it in Marmoset and it appeared to be working correctly, but I don't know if that's because it's a problem with Max or because Marmoset's lighting environment is based on skyboxes instead of traditional specular hotspots.
  • Ro-Sham-Bo
    Options
    Offline / Send Message
    Just render the image............the highlight will then be fixed......Once again previewing from the viewport is just that....a preview... And by the way tycho this is brad so you know im awesome and always right, thanks lol.
  • EarthQuake
    Options
    Offline / Send Message
    Actually, if your asset is ever going into game, then the realtime preview is what you want to use as the offline render is not accurate. So, doing renders in max to preview your normals is the LAST thing you want to do, as the asset with be horribly broken upon import into a game engine if you rely only on that.
  • ctrlZ
    Options
    Offline / Send Message
    I recreated it and its perfectly fine here. in max 2008 DX/standardfx. I dont think your normal map is 100% right.. may be I am wrong but it has some jigglez and wiggles where there should be smooth surface.. that has nothing to do with your issue though.. I think you should play with hw shader settings a bit.
    >>IF possible just use it with default settings only applying your normal map on it.. take a snap and then just apply any other normal map of any other object you have.. and see if those surfaces are still having similar highlights or not.
  • TychoVII
    Options
    Offline / Send Message
    TychoVII polycounter lvl 13
    ctrlZ could you provide an OBJ that includes the low and high poly? I'm curious to see if it's a Max version specific thing.

    I tried previewing it in the Unreal Engine and it STILL happens, by the way.
  • Neox
    Options
    Offline / Send Message
    Neox godlike master sticky
    what shader are you using to preview the normals? maybe its just the shader?
  • rasmus
    Options
    Offline / Send Message
    I think this is a Max-related illness, as far as I can recall. Could be graphics card/driver related too, but I'm not sure. Try flipping the triangulation of each and every one of those quads, and I'm pretty sure the hilight will skew the other way, which I think it always will, more or less. Your normalmap looks perfectly fine to me. Tried other shaders? Xoliul maybe?
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    A lot of people seem to miss it, but the reason some of them are going left and some right, is because of the invisible edges. You want to have all you windings point in the same direction. Might fix some of the issue.
  • EarthQuake
    Options
    Offline / Send Message
    Ah yes the invisible edge thing! This can be a major pain in the ass in max, as max seems to render the quad without respect to which way the invisible edge is facing. You would think it would be smart enough to render it correctly. I've had to "debug" issues like this by going in and turning edges after i've baked to get the best results in max. This is nothing short of totally ridiculous as you dont need to do this sort of thing in any other app.
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    Not entirely correct EQ:

    -It's not random. They start off correct. Doing Chamfers messes it up (the chamfered part has them going the other way), I think Connects might do it too. Also, Shift-moving edges might be a culprit too. Thing is you just need to go in and fix it.

    -You have to fix it BEFORE the bake, since the normalmaps are actually baked for a specific winding, so you need to rebake if you change one.

    And ehm, I'm pretty sure when I first had this issue, I also saw the "zig-zagging" of specular in Unreal Engine ?
  • TychoVII
    Options
    Offline / Send Message
    TychoVII polycounter lvl 13
    Figured it out! It has NOTHING to do with the baked map or the baking process. I don't know why I never noticed it before, but the problem persists even in the Unreal 3 engine. It seems to be entirely based on the invisible triangulation lines.

    I did some experimentation and found out how to fix the problem if it's absolutely necessary.

    Xoliul, for some reason your shader seems to display the troubled highlights on a group-smoothed low poly object even before applying a normal map. I cooked up an illustration of what I did. Also, extrusion seems to be what causes the nastiness, but I didn't try any other method.

    Skewed_Spec5.jpg

    Skewed_Spec6.jpg

    Skewed_Spec7.jpg

    Skewed_Spec8.jpg

    Skewed_Spec9.jpg

    Skewed_Spec10.jpg

    Skewed_Spec11.jpg

    This method also DOES work after the bake. I flipped every other triangle after applying my normal map and the highlights reoriented just fine one by one.

    Skewed_Spec12.jpg

    If anybody knows of or finds an alternate method for fixing this problem or knows of a means for preventing it (other than not using Max) please post it here.
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    Thought so :)

    My shader displays the specular skewing on an non-normalmapped object yes, because it uses a way more advanced specular calculation than a simple, crappy default material.

    And I'm certain that doing this after the bake won't work in all cases. I remember many times, on surfaces more complex than a cylinder (car bodies), things got worse when I flipped the traingulation, and were fixed once I rebaked.

    BTW, I think we need a script for this!
  • Whargoul
    Options
    Offline / Send Message
    Whargoul polycounter lvl 18
    I always triangulate my mesh before baking normal maps - it's the only way you ensure that the baking software , app & game engine triangulate your mesh the exact same way.
  • EarthQuake
    Options
    Offline / Send Message
    Xoliul wrote: »
    Not entirely correct EQ:

    -It's not random. They start off correct. Doing Chamfers messes it up (the chamfered part has them going the other way), I think Connects might do it too. Also, Shift-moving edges might be a culprit too. Thing is you just need to go in and fix it.

    -You have to fix it BEFORE the bake, since the normalmaps are actually baked for a specific winding, so you need to rebake if you change one.

    And ehm, I'm pretty sure when I first had this issue, I also saw the "zig-zagging" of specular in Unreal Engine ?

    My experience comes from importing meshes from modo into max, so i'm not really doing any extruding etc etc in max. I swear i've had to adjust these sort of things after the bake(having not actually changed anything, aside from smoothing groups), but its been a while since i've done it.

    Regardless, this is an absolute mess, as apps like maya etc will handle quads and even ngons perfectly without the need to triangulate/mess with "invisible edges". This is just another in a long list of things that are broken in max's normal render. =)
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Whargoul wrote: »
    I always triangulate my mesh before baking normal maps - it's the only way you ensure that the baking software , app & game engine triangulate your mesh the exact same way.

    Ideally you'd just talk to your programmers and get them to make sure the model format you export takes the vertex normals directly from your app :)

    That way you know that whatever you see in your app is the same as what you see in-game. And it also means you don't have to worry about the triangulation because the vertex normals are what matter (and yes, they will change when you triangulate the mesh).

    Only issue then is you have to bake normal-maps in your app or through an in-game tool, but this is probably better for pipeline anyway. Adding more apps always makes things more complicated especially when it comes with trying to preserve normals and triangulation.
  • ianucci
    Options
    Offline / Send Message
    ianucci polycounter lvl 9
    Has this issue been fixed in Max 2011?
  • Fang
    Options
    Offline / Send Message
    Fang polycounter lvl 7
    Nope, still there in Max 2011, at least from my experience.

    I have noticed this problem before, didn't know what to do about it, but turning the tris works well, so thank yah.

    +1 for script
  • Michael Knubben
    Options
    Offline / Send Message
    I'm confused why invisible tri edges would even matter? Surely baking normals only looks at vertex normals, which should be identical no matter how the edge is turned, or am I misunderstanding the process?

    Either way, I've had this problem and it was a big annoyance, so I'm glad to at least know a workaround.
  • Eric Chadwick
    Options
    Offline / Send Message
    I think it matters because of the way the normals are interpolated across each triangle, from vertex to vertex. If you've ever painted vertex colors, you've seen how a quad's internal edge affects the gradient across it.
  • teaandcigarettes
    Options
    Offline / Send Message
    teaandcigarettes polycounter lvl 12
    I think it matters because of the way the normals are interpolated across each triangle, from vertex to vertex. If you've ever painted vertex colors, you've seen how a quad's internal edge affects the gradient across it.

    Thanks Eric, I've been wondering about this issue myself.




    If you look close enough you will even spot this issue in UDK. When using modular meshes that use unique normal maps (and use a single smoothing group as a result) I've had issues where specular highlights would not align, even once the normal map was applied. To counter this I've been mirroring every second static mesh, but it was a very tedious task. Nowadays I simply use symmetry before baking and UV mapping to make them tile seamlessly. If anyone encounters shading problems with long, tilable meshes (which have the normals set to soft) then I highly advise you to do the same. Might save you a headache in the long run.
  • Michael Knubben
    Options
    Offline / Send Message
    Eric: That's true, and I had noticed it with vertex-painting, but it just never made sense to me. Thanks for the answer.
  • Farfarer
    Options
    Offline / Send Message
    EarthQuake wrote: »
    Ah yes the invisible edge thing! This can be a major pain in the ass in max, as max seems to render the quad without respect to which way the invisible edge is facing. You would think it would be smart enough to render it correctly. I've had to "debug" issues like this by going in and turning edges after i've baked to get the best results in max. This is nothing short of totally ridiculous as you dont need to do this sort of thing in any other app.
    The same thing happens in modo.

    The triangulation of quads in the viewport and in the renderer/baker is the opposite of how the quads get triangulated when you run the Triangulate tool. (You can test it by twisting a cube and then hitting triangulate.)

    Which means that if you bake your normal map using your quadded model, it appears to bake and display fine but when you triangulate and export your model, it screws up the normal map subtly as the invisible edges all get turned in the triangulation process, throwing the vertex normals off a little bit.

    It's very annoying :/

    modoTriangulation.jpg
  • final_fight
    Options
    Offline / Send Message
    final_fight polycounter lvl 9
    Is there a 3ds Max script to do this kind of triangulation automatically? So, anybody knows?
Sign In or Register to comment.