I have applied a detail albedo to my objects that I want to stay exactly as it is in my uvs in maya but when I bake lighting in unity then play the game suddenly the uvs get all messed up. In editor it looks great but as soon as I hit play its horrible looking - this seems like a unity bug.
Editor bug aside Im guessing this result in game is because the lightmap has hijacked my second uv set and has moved and scaled and rotated it to fit it into the lightmap for the whole scene. What can be done? This is for mobile, so can I somehow get the standard shader to use uv3 or uv4 and put my detail map where it wont be effected by lightmapping uv values?
You’ll unfortunately have to write your own surface shader for this, or go through the Standard shader code and make a copy that uses the UV channel you want.
My understanding is in the editor the secondary UVs are left alone and Unity supplies the shader a scale and offset value to correctly position the UVs into the light map. However this is bad for batching as every material has these unique values, so at play that scale and offset get baked into the secondary UVs. The result is more optimal batching, but your UVs are wrong.
Hi Bgolus yeah I suspected as much, seems odd to me that this is the fuctionality straight out the box but I guess unity didnt expect people to use the standard shader with detail maps on a lightmapped game. Also seems wrong that I have to hit the play button to see the broken result, I worked for a couple of weeks making art that looked great in editor and not knowing it would be broken as soon as I hit play, sad times. Im a game artist so I dont need to hit play all that often when tasked with certain jobs, just make the art look great and put it in the project, I will bear this detail map issue in mind in future.