x


"Queue"="Transparent" not working (on iOS).

I have this simple shader here...

Shader "MyShaders/Overlay" {  Properties {  _Color ("Main Color", Color) = (1,1,1,1)  _MainTex ("Texture", 2D) = "white" {}  }
Category {
    Tags {"Queue"="Overlay" "RenderType"="Transparent"}
    ZWrite Off
    Alphatest Greater 0
    Blend SrcAlpha OneMinusSrcAlpha 
    SubShader {
       Material {
         Diffuse [_Color]
         Ambient [_Color]
       }
       Pass {
         Cull Back
         ColorMaterial AmbientAndDiffuse
         Lighting Off
            SetTexture [_MainTex] {
                Combine texture * primary, texture * primary
            }
            SetTexture [_MainTex] {
                constantColor [_Color]
                Combine previous * constant, previous * constant
            }  
       }
    } 
}

}

...wich doesn't work as supposed to do.
I need it to render above everything in the scene, (and it should do it, since "Queue" is set up to "Overlay"), but I've the feeling that it's completely ignoring the "Queue" tag. No matter how I change it, it always renders like its queue is "Transparent". Other objects in the scene are all rendered in Geometry and Transparent queue, and their depth sorting is perfect. This is the only one not working.

Any suggestions? Did I write something wrong? Thanks!

more ▼

asked Aug 28 '11 at 04:36 PM

DanjelRicci gravatar image

DanjelRicci
380 17 20 31

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

1 answer: sort voted first

Use

ZTest Always

See also this http://answers.unity3d.com/questions/50131/simple-shader-question.html

The "Queue" specifies the order of the rendering (but the rendering may still be skipped by the zbuffer test). Changing the render-queue is needed for performance tuning and making sure that transparent objects are rendered last (since they should never be overdrawn by an opaque object).

more ▼

answered Aug 28 '11 at 06:06 PM

Mortennobel gravatar image

Mortennobel
1.8k 10 15 34

Fantastic, it's working exactly as I want. Thank you very much, and thanks also for the explanation. :)

Aug 29 '11 at 11:03 PM DanjelRicci
(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:

x1999
x1953
x1650
x33
x31

asked: Aug 28 '11 at 04:36 PM

Seen: 1123 times

Last Updated: Aug 29 '11 at 11:04 PM