x


reflection for iphone

i am applying a cubemap, reflection is not affected for object(cars..).

please help, how to follow the procedure .

by

more ▼

asked Feb 24 '10 at 09:32 AM

Rajasekhar gravatar image

Rajasekhar
2 4 5 5

Reflaction is a truly new thing to me. I suspect you meant 'Reflection' rather than 'Refraction'. Although I guess you could call the combination 'Reflaction'.

Feb 24 '10 at 09:55 AM Motionreactor

Edited it to reflection for the sake of my sanity

Jul 26 '10 at 12:45 PM Mike 3
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Hi,

Try this Shader for reflection ,but in iphone i think we cant get real time reflection, u can use this shader get the reflection image from Max or Maya.

Shader "iPhone/lightmap/reflective"
{
    Properties
    {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _LightMap ("Lightmap (RGB)", 2D) = "white" { LightmapMode }
        _Reflect ("Reflection", 2D) = "black" { TexGen SphereMap }
    }

    SubShader
    {
        Pass
        {
            Name "BASE" 

            BindChannels {
                Bind "Vertex", vertex
                Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
                Bind "texcoord", texcoord1 // main uses 1st uv
            }
            SetTexture [_LightMap] {
                combine texture
            }
            SetTexture [_MainTex] {
                combine texture * previous
            }
        }

        /* This pass uses vertex information to control Reflection
        Pass
        {
            Name "REFLECT"
            ZWrite Off
            Blend SrcAlpha OneMinusSrcAlpha
            ColorMaterial AmbientAndDiffuse
            Lighting Off

            BindChannels {
                Bind "Vertex", vertex
                Bind "normal", normal
            }

            SetTexture [_Reflect] {
                combine texture, primary
            }
        }*/

        // Use this pass, if you want to fetch alpha from main texture instead
        Pass
        {
            Name "REFLECT"
            ZWrite Off
            Blend SrcAlpha OneMinusSrcAlpha

            BindChannels {
                Bind "Vertex", vertex
                Bind "normal", normal
                Bind "texcoord", texcoord0 // main uses 1st uv
            }

            SetTexture [_MainTex] {
                combine texture
            }
            SetTexture [_Reflect] {
                combine texture, previous
            }
        }

    }
}
more ▼

answered Apr 19 '10 at 05:53 AM

yourserb gravatar image

yourserb
3 2 2 6

(comments are locked)
10|3000 characters needed characters left

How is possibile to change the shader to works with Beast lightmapper?

more ▼

answered Mar 14 '12 at 12:22 PM

donzen gravatar image

donzen
1 1 1 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2000
x139
x4

asked: Feb 24 '10 at 09:32 AM

Seen: 2840 times

Last Updated: Mar 14 '12 at 12:22 PM