I am running a iOS project using the isgl3d framework for showing pod files.

I have a stylish car with 0.5 alpha windows, that I wish to render on a camera background, seeking some augmented reality goodness.

The alpha on the windows looks okay, but when I add the object, I notice that it renders the entire object transparently, where the windows are. Including interior of the car.

Like so (in example, keyboard can be seen through the dashboard, seats and so on. should be solid)

bad car is bad

The car interior is a seperate object with alpha 1.0.

I would rather not show a "ghost car" in my project, but I haven't found a way around this.

Have anyone encountered the same issue, and eventually reached a solution ?

  • \$\begingroup\$ Try turning off the alpha write mask when you render the car. \$\endgroup\$ – Gray Apr 18 '12 at 14:18

(No experience with 3D programming on iOS, but this should work on regular OpenGL devices.)

I can think of 2 options that might fix this.

Try separating the model in 2 parts, first render the opaque part and then render the transparent part.

Another option might be to disable alpha writing when rendering the object. What I think is happening is that when the window is rendered the alpha value is simply written to the color buffer. When then rendering the color buffer over the camera image the windows are alpha blended with the image behind it, causing ghost cars.


SOLVED: Thanks to Demi. Here is the final code:

// Render opaque objects
        [_scene render:renderer opaque:true];

        // First planar shadow pass (if needed)
        [self renderPlanarShadows:renderer];

        // Render transparent objects
        glColorMask(1, 1, 1, 0);
        if (_zSortingEnabled) {
            [_scene renderZSortedAlphaObjects:renderer viewMatrix:&viewMatrix];

        } else {
            [_scene render:renderer opaque:true];
        glColorMask(1, 1, 1, 1);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.