Source Engine Tangent Basis?

card carrying polycounter
  • Offline / Send Message
  • Joined
  • 23 Topics
  • 2.3K Replies
Farfarer card carrying polycounter
Anyone know what code it uses to generate it's tangents?

You can't feed explicit tangents in, it does that stuff itself.

If I can find it, I'll throw together an xNormal plugin to bake normal maps synced to Source.

Replies

  • Ark
    • Offline / Send Message
    • Joined
    • 44 Topics
    • 1.6K Replies
    Well since Valve use Maya id assume it's based around that.
  • cptSwing
    • Offline / Send Message
    • Joined
    • 6 Topics
    • 1.9K Replies
    cptSwing card carrying polycounter
    Used to use XSI, so yeah. Not sure that helps :)
  • Ark
    • Offline / Send Message
    • Joined
    • 44 Topics
    • 1.6K Replies
    I think they dropped XSI soon after HL2 released. I know it's still used by some of there artists, but I believe there pipeline is built around Maya now. Last time I checked there jobs page it was Maya, XSI and Modo experience.

    Unless they have some custom in-house tools/plugin, id say Maya's tangent basis is your best bet.
  • EarthQuake
    • Offline / Send Message
    • Joined
    • 251 Topics
    • 11.8K Replies
    Ark wrote: »
    Unless they have some custom in-house tools/plugin, id say Maya's tangent basis is your best bet.

    Most studios/engines do(have a custom tangent basis) whether on purpose or by chance is another story. Most studios in my experience don't even know what "synced" means as far as normals, even Epic until recently didn't have a solution for synced bakes in UE3.

    So it would be much, much more surprising to me if Source is synced to Maya, or XSI, or anything common than if it isn't.

    Sorry Farfarer I don't have any useful info for you.
  • Ark
    • Offline / Send Message
    • Joined
    • 44 Topics
    • 1.6K Replies
    Yeah I was going out on a whim and guessing since they use Maya then more than likely that, if like you say EQ they don't have something proprietary regarding baking/tangents.
  • r_fletch_r
    • Offline / Send Message
    • Joined
    • 28 Topics
    • 3K Replies
    I've never seen a valve asset that looked like it was synced(looking at portal/L4D2). wouldn't be surprised if they're not doing it.
  • Farfarer
    • Offline / Send Message
    • Joined
    • 23 Topics
    • 2.3K Replies
    Farfarer card carrying polycounter
    Last I spoke to someone from Valve, Maya and modo were the tools they used most. But XSI before that and I'm not convinced it was synced then and I doubt it's changed since.

    Perhaps I can email them and they'll tell me. They've always been helpful and friendly in the past :)

    edit: I think I've found it. I'll check tomorrow and see :)
  • cptSwing
    • Offline / Send Message
    • Joined
    • 6 Topics
    • 1.9K Replies
    cptSwing card carrying polycounter
    I used to bake my maps for Source in XSI way back when, and never noticed any glaring faults - but looking back the assets I made were cringeworthy anyway, so I probably happily ignored them ;-)
  • Farfarer
    • Offline / Send Message
    • Joined
    • 23 Topics
    • 2.3K Replies
    Farfarer card carrying polycounter
    Well, I've written it and it's giving out normal maps that aren't total garbage.

    Might not be able to actually test it with SourceSDK for a day or two though. I'll keep you posted :)
  • Farfarer
    • Offline / Send Message
    • Joined
    • 23 Topics
    • 2.3K Replies
    Farfarer card carrying polycounter
    Well, it's not perfect (yet?) but it's not far off...

    Here's 1-smooth-group cube I was testing with;
    sourceTangentBasis.png
  • Ace-Angel
    • Offline / Send Message
    • Joined
    • 204 Topics
    • 4.7K Replies
    Nice! This should work with all source based games, as long as the Dev's didn't change any math behind the renderer, right?
  • Farfarer
    • Offline / Send Message
    • Joined
    • 23 Topics
    • 2.3K Replies
    Farfarer card carrying polycounter
    Yeah, hopefully.

    The code I'm using says 2005 on it, but the SDK version I'm testing is 2007 (can't make mods on 2009 I don't think).

    I'll check tomorrow that it's not changed since then if I can.
  • Farfarer
    • Offline / Send Message
    • Joined
    • 23 Topics
    • 2.3K Replies
    Farfarer card carrying polycounter
    Hah, so I did some testing and as far as I can tell, the default MikkTSpace gives out exactly the same result as the Source Engine synced version I wrote.

    Well, that was a nice excercise, at least...
  • ZacD
    • Offline / Send Message
    • Joined
    • 245 Topics
    • 10K Replies
    I wish xnormal would list what engines are synced to what normal map, or if someone would make a chart...
  • Farfarer
    • Offline / Send Message
    • Joined
    • 23 Topics
    • 2.3K Replies
    Farfarer card carrying polycounter
    This is the first engine I've seen that MikkTSpace works with.
  • Ace-Angel
    • Offline / Send Message
    • Joined
    • 204 Topics
    • 4.7K Replies
    WAIT! You mean Source is essentially (currently) XN compatible out of the box?!
  • Farfarer
    • Offline / Send Message
    • Joined
    • 23 Topics
    • 2.3K Replies
    Farfarer card carrying polycounter
    Seems that way.

    If you find otherwise, please send me your meshes and I'll try and find out why.
  • cptSwing
    • Offline / Send Message
    • Joined
    • 6 Topics
    • 1.9K Replies
    cptSwing card carrying polycounter
    Haha.. years before he even created the tangent space thingy, right?

    (maybe he looked at valve's code?)
  • Scruples
    • Offline / Send Message
    • Joined
    • 16 Topics
    • 511 Replies
    Well he did add support for PRT normal maps which are a Valve creation iirc.
  • Amsterdam Hilton Hotel
    • Offline / Send Message
    • Joined
    • 50 Topics
    • 1.1K Replies
    max bakes have always given very, very close results w/ source
  • EarthQuake
    • Offline / Send Message
    • Joined
    • 251 Topics
    • 11.8K Replies
    max bakes have always given very, very close results w/ source

    With 1SG/no hard edges though?

    Or after you've taken the time to make the smoothing look good with default max shaders?
  • Ace-Angel
    • Offline / Send Message
    • Joined
    • 204 Topics
    • 4.7K Replies
    max bakes have always given very, very close results w/ source

    I don't think it means, what you think it means.

    Normal Map, no matter the baker, won't automatically show seams or make your model look bad, they will take the data and show it as it's meant to be shown. Even if it's a very dirty NRM Map in the renderer, it will still show it's meant to be shown pending on how you baked it, as long the 'process' was clean.

    In this case, in the case of Source and XN, from the looks of it, you can get rid of the more 'mundane' tasks, which will take several minutes to hours to fix and make sure 'it looks right', and can squeeze out extra shortcuts to get the asset looking as you wish.
    cptSwing wrote: »
    Haha.. years before he even created the tangent space thingy, right?

    (maybe he looked at valve's code?)

    Or maybe Valve sneaked it during the entire Source Film-Maker time? Wouldn't surprise me if they did, making lives of newbies who don't know baking just for visual purposes that much easier.
  • Bek
    • Offline / Send Message
    • Joined
    • 36 Topics
    • 1.8K Replies
    Bek dedicated polycounter
    If I could just interrupt with some noob questions that get progressively off topic:

    When you say 1 smoothing group cube, do you mean a cube where all faces are smoothed + continuous (t net I guess) UV's, or a cube with no smoothing (all hard edges / split uv's)? If it's the former is the idea to show that the normals are synched and even the crap cube will look right with the baked normal? Time to read EQ's recent thread again!

    How do you change what maths xnormal bakes with?

    What should I be using if Marmoset Toolbag is my target engine? I've looked through the documentation but didn't find any reference to what tangent basis it uses.
  • Farfarer
    • Offline / Send Message
    • Joined
    • 23 Topics
    • 2.3K Replies
    Farfarer card carrying polycounter
    cptSwing wrote: »
    Haha.. years before he even created the tangent space thingy, right?

    (maybe he looked at valve's code?)
    Haha, the code's actually pretty standard - most things tend to have small variations or bolt-ons to well defined methods. Valve's is based on nVidia's code... which is probably based on someone else's...

    The real benefits of MikkTSpace are all of the safety checks it has. It accounts for a lot of edge cases and potential screw ups to give rock solid consistency across a wide array of circumstances.
    Bek wrote: »
    If I could just interrupt with some noob questions that get progressively off topic:

    When you say 1 smoothing group cube, do you mean a cube where all faces are smoothed + continuous (t net I guess) UV's, or a cube with no smoothing (all hard edges / split uv's)? If it's the former is the idea to show that the normals are synched and even the crap cube will look right with the baked normal? Time to read EQ's recent thread again!

    How do you change what maths xnormal bakes with?

    What should I be using if Marmoset Toolbag is my target engine? I've looked through the documentation but didn't find any reference to what tangent basis it uses.
    Yes, 1 smooth group so it's all smoothed, the UVs are a standard cube "cross" shape. And yes, the idea is that (within the limitations of all normal maps) if you've got a synced baker/renderer that even a crap model like a smoothed cube will look correct.

    xNormal has a drop-down for Tangent Calculator plugins in it's options (plug-shaped button on the bottom left). You'll need to get some more to see anything other than the default MikkTSpace option there, though.

    Not sure what Marmoset uses. I imagine if you export an FBX with tangents and binormals in it, then it'll use those.

Leave a Comment