Gold texture on iphone

We would like a metal material(which is difficult enough to find for things which are not unity) where the specular colour is modifiable as well as the main colour so that any range of metals may be created from bronze to gold. Normally such an effect may be obtained by using a cubemap, however our attempt for a subshader would not run on the iphone graphics hardware, because to many passes were required.

Another problem is when using a spherical environment map the texture wraps to quickly around the object, so a semi transparent texture should probably be superimposed to give the effect that the material is static.

If you have such a material please pakage it including its dependinces such as the shader and the textures and post it here. if not, but you are familiar with shadelab please do your best to help others solve this problem.

Unity seems decidedly lacking in the metal and glass shader departments.

Here is our code for our attempt at basic gold

Shader "iphone/VertexLitGold" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,0)
        _SpecColor ("Spec Color", Color) = (1,1,1,1)
        _Emission ("Emmisive Color", Color) = (0,0,0,0)
        _Shininess ("Shininess", Range (0.01, 1)) = 0.7
        _Reflect ("Reflection", 2D) = "white" { TexGen SphereMap }

    }
    SubShader {
        Pass {
            Material {
                Diffuse [_Color]
                Ambient [_Color]
                Shininess [_Shininess]
                Specular [_SpecColor]
                Emission [_Emission]
            }
           
            Lighting On
            SeparateSpecular On
            SetTexture [_Reflect] {
            	constantColor [_Color]
                Combine texture * constant, previous+primary
            }
        }
    }
}

To admins, if this is not the right section for this post please move it. We realize it could also belong in iphone dev. or collaboration.

Some issues with your shader:

*SeparateSpecular On doesn’t work on iGPUs.

  • , previous+primary just puts white + white into your alpha, which is useless.
  • You don’t need to do Combine texture * constant. You’ve already got the color coming in from the lighting calculation.
  • Why would metal have emission?

Here’s a quick attempt at gold. I’m not bothering to include a spheremap, as I just tested with one of the first results on Google Images. Throw your own in there and let me know what you think. I’m not sure what you mean by your second paragraph, so I didn’t try it. I’ll modify this if you give me a better idea of what you meant.

Shader "iPhone/Vertex Lit Metal" { 

Properties
{ 
	_Color ("Main Color", Color) = (1,1,1,0)
	_SpecColor ("Spec Color", Color) = (1,1,1,1) 
	_Shininess ("Shininess", Range (0.01, 1)) = 0.7 
	_Reflect ("Reflection", 2D) = "white" { TexGen SphereMap } 
} 

SubShader
{
	Lighting On
	Material
	{ 
		Diffuse [_Color] 
		Ambient [_Color] 
		Shininess [_Shininess]
		Specular [_SpecColor]
	} 

	Pass
	{ 	
		SetTexture [_Reflect] {Combine texture * primary Quad}
	}
}

}

348576–12133–$vertex_lit_metal__gold_material_118.unitypackage (75.9 KB)

Or what about a matcap like this: http://forum.unity3d.com/viewtopic.php?t=42026&highlight=matcap

I’m using it for chrome parts in my project, i feel like it’s doing a nice job but it feigns reflection.

============================
This illustrates the problem read the video description:

See how quickly and strangely the spheremap wraps around the geometry?

It just looks like a spheremap to me. Which is to say, the normals of the mesh, based on the viewing angle, correspond to certain texels. The only way to see no movement in a spheremap is to model a relatively high-poly sphere. Personally, I don’t understand what the point of a spheremap is, other than making things look funky shiny, like Metal Mario. I understand what you’re saying, but I don’t know of any way to do better. So if you have a concrete idea of what you want to do with the “semi transparent texture” you mentioned, I’ll try to implement it; I just don’t understand what could improve things.

A couple suggestions to try:
Paint more dark grey into the edges of the circle on your spheremap. Then the “reflection” won’t seem to affect the entire surface.
Try ObjectLinear or EyeLinear instead of SphereMap.

Unfortunately, without the ability to use cubemaps, the effect is probably never going to give the impression of realism.

Pardon me for resurrecting an old thread but I’d like to use the gold shader in Unity 3 but it apparently doesn’t work for lightmapped objects. Now that Unity 3 uses surface shaders, is it possible to update this to run in Unity 3? I’m looking at the source now but not sure where to start.