Hey guys, maybe you can help me out with a problem I’m having. I should preface this all by saying I know little to nothing about scripting or programming, so this question will probably be pretty basic. But I’ve taken a look through the forums, and can’t seem to find anything.
I’m trying to get a shader working for an iPhone game project being done in unity. I need a shader that fulfills the following requirements:
*Accurately displays transparency based on an alpha map; trunk is solid, leaves are transparent, etc.
*Accurately maps light, shadows and texture
*Displays and accurately shades polygon backfaces
I’ve found a few shader scripts on the wiki, but I’m having some problems getting them to work.
http://www.unifycommunity.com/wiki/index.php?title=VegetationVertexLit
This shader works as advertised, except it produces strange transparency artifacts where there is no Alpha Map data to cause it.
http://www.unifycommunity.com/wiki/index.php?title=VegetationTwoPass
This shader negates the artifacts, but the resulting texture is about 50% darker than it should be.
I’ve narrowed this problem down to lines 24 and 41:
combine texture * primary, texture
However, I can’t find any in-script reference to ‘Primary’ anything, and I can’t remove the string without causing lighting errors.
Any thoughts on how to fix this?
(PS: “Copy the polygons and invert them” isn’t an acceptable alternative to having functional backfacing. The game objects are too close to 300 vertices already, and we can’t afford the extra geometry.)