I am currently working on an iphone/android app and am looking for a shader that accepts vertex color from the geometry made in 3DS max, but multiplies this with a texture and applies the lightmap for the scene as well. Does anyone have any idea where I should start?
You may be able to take what you find from what I recommended in your other thread, and this simple shader, and add to it what you need. Follow up if that’s not enough. I’ve got some more code for you, if you’re talking about integrating Unity’s Beast lightmapping, which I take it you are.
Also, what is the reason for lightmapping with both vertex colors and a texture?
The reason for this is that my designer wants to approach iphone designing as they used to for the NDS, where they only used very small textures for patterns and vertex colors for variations. The lightmapping is indeed for beast I will look into those resources. I tried the strumpy shader editor as well, I just couldn’t get it to work.
Will get back to your offer if I cannot get it to work with the resources provided… If you have any tips on what I just wrote please let me know
Here’s what you’ll need to know that’s specific to Unity’s lightmapping:
The lightmapping texture Unity provides is called unity_Lightmap in the shader.
The automatically-generated second UV does not need to be rotated in the shader, but it does need to be scaled and translated. The matrix for this is called unity_LightmapMatrix. If you’re using high precision (which I don’t recommend - I have been using medium precision in my vertex calculations, and I would use low more often, if not for the fact that swizzling is slow with low precision), then you should use that knowledge to simplify the calculation:
I was wrong. This document says the SGX uses 1, 2, or 3/4 component operations depending on high, medium, or low precision, respectively. So you should probably use the first, more complex-looking calculation I offered.
So far I came up with this, but my guess is I am right now using a lot of not needed shader lines, cause of the unity pipeline? I haven’t worked on a solution that involves your suggestions yet, to be honest I have no clue where to even begin I have been working in unity for a while, but always avoided working with the shader section… hehe