Gem Shader on iPhone

Hello

Is it possible to have something similar to the Gem Shader to work on the iPhone?

Some ideas:

  1. You can get fake reflectivity by using spherical environment maps
  2. You can get fake refraction by using different environment map for the back-facing polygons of a gem.
  3. You can get very fake Fresnel term by attaching directional light to your camera and negating result in the shader (-primary)

simplest shader using spherical environment map:

Shader "EnvMap" { 
       
   Properties { 
      _EnvMap ("EnvMap", 2D) = "black" { TexGen SphereMap } 
   } 
    
   SubShader { 
      Pass { 
         Name "BASE" 
         BindChannels { 
            Bind "Vertex", vertex 
            Bind "normal", normal 
         } 
         SetTexture [_EnvMap] { 
            combine texture 
         } 
      } 
   } 

Fallback off 
}

Thanks ReJ

Unfortunately I am not familiar with shader programming.

I was not aware of the spherical environment maps, are they like cube-maps?

Now, the code you kindly provided is just to generate a reflection effect, correct?

How can I apply a second shader only to the back polygons?

Can you please explain the Fresnel term?

Thanks,

bakno - You need to do some homework before you ask someone to be your personal instructor.

10 Seconds on Google produces the following:

http://www.google.com/search?q=spherical+environment+maps&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

http://www.google.com/search?q=+Fresnel+term&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

You are right kenlem, and thanks for the links, they explain each subject easily.

ReJ, please excuse me. I did not want you to be my instructor. Maybe I was overwhelmed by to many unfamiliar information. But now that is not the case.

From the spherical map description I understand it is a static shader. The thing is that I need to rotate the gems and make them look as nice as they do now with the gem shader.

I think I need to start learning about shaders.

Thanks again,

I am also very interested in getting a shader like this working on the iPhone. The sample spherical map shader by ReJ is a great start, and I’m just wondering how to add transparency and rotation to it.

Thanks for all your help.

Andres - Please excuse the tone of my message. I think it came out much harsher than I would have liked.

I don’t know much shader either and now is a good time to learn.

I’ll try the shader ReJ posted tonight and then work on how to render the back facing polygons.

Not a problem kenlem. You were right.