Can anyone verify for me whether or not you can use this binding without getting an error?
And if you can get it to work, how could you even use it?
Can anyone verify for me whether or not you can use this binding without getting an error?
And if you can get it to work, how could you even use it?
I get a syntax error trying to use
Bind "Tangent", tangent
Honestly, though, I don’t know what you’d use it for. Tangents get used in the vertex shader in tangent-space normal mapping. Using BindChannels to pass them straight to the pixel shader wouldn’t do you much good, because you’d get the raw tangents and have to do your normal transformation in the pixel shader, which is an expensive and redundant operation.
I can’t use pixel shaders because Unity iPhone doesn’t support them yet. So I assume it’s useless. Perhaps this binding works in Unity 2.5? (Can’t test at the moment.)
Nope, I tested it in 2.5.1. You didn’t mention iPhone in your OP. I’m not familiar with the iPhone, but I believe it supports some sort of normal mapping in fixed function, so binding vertex tangents might make sense there.
Actually on the iphone tangents are without any use. I would expect Unity iPhone 1.5 to fully drop them for optimized transformation and batching.
The Dot3 normal maps are not in tangent space but normal space as far as I’m aware
As for using it in shaders: Ddoes unity generate tangets at all? As far as I see the tangent generation so far was always part of the shaders.
I know, but I figured it was irrelevant. But then I thought maybe the error only happens because pixel shaders are not supported. It seems weird to include the binding in the documentation if it doesn’t work at all.
No, it only works based on textures, therefore, object space is the only practical application.
http://forum.unity3d.com/viewtopic.php?t=15749
You can do sort of do tangent space normal mapping, by programmatically creating a texture based on the world space normals of a mesh, but that will give you a slideshow, it’s so slow. I even tried just adjusting vertex colors every frame, based on worldspace normals, and I got about 5 fps on my MacBook Pro, doing that. Totally impractical with today’s technology, methinks.
On the desktop there is actually an easy way to overcome the vertex color modification stuff: A 1x1 per side cubemap that encodes the color data and blend the normal map with that. Naturally you can use larger cubemap sides if you want more finegrained data.
As this works even high performant on dX7 its granted that any current gen hardware takes that without any hit at all (learned about that trick through Blitz3D where you don’t have access to the animated vertices on animated models at all to alter the vertex color)
BindChannels is only used for fixed function vertex processing. Now, there’s no concept of “tangent” in fixed function vertex processing, so what you’re doing will not work.
In fixed function T&L, all there is is positions, normals, texture coordinates and colors.