Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: why are my objects translucent?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Intern Contributor
    Join Date
    Nov 2010

    why are my objects translucent?


    I have this shader and it is turning all of my objects translucent. From the code it looks to me like the color's alpha value will always be 1, but it is not. If I explicitly set 'colorVarying.w' to 1.0 at the end, then the objects appear opaque. Can anyone see how my alpha would be anything but 1 from this code?


    Code glsl:
    in vec4  position;
    in vec3  normal;
    in lowp vec4  color;
    out lowp vec4 colorVarying;
    uniform mat4 modelViewProjectionMatrix;
    uniform mat3 normalMatrix;
    void main()
        vec3 eyeNormal = normalize(normalMatrix * normal);
        vec3 lightPosition = vec3(0.0, 0.5, 1.0);
        float nDotVP = min(1.0,max(0.0, dot(eyeNormal, normalize(lightPosition))));
        colorVarying = color * nDotVP;                       // both of these produce
        colorVarying = vec4(0.5, 0.5, 0.5, 1.0) * nDotVP;    // translucent objects
        gl_Position = modelViewProjectionMatrix * position;
    Last edited by Dark Photon; 01-08-2013 at 06:03 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts