Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7041425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:02:39+00:00 2026-05-28T02:02:39+00:00

Environment: WebGL, Chrome. I have the following behavior when using transparent png’s as textures

  • 0

Environment: WebGL, Chrome. I have the following behavior when using transparent png’s as textures for models:

  1. Image A – the tree hides the building behind it and I see the world box texture. It also hides itself (back branches are not visible)
  2. At the same time – Image B – works properly, the window is transparent and I see what’s behind

A: Tree over house
B: Window transparency

Both screenshots were made on same the scene at the same time from different camera positions. Textures are produced by the same algorithm.

I can’t understand what’s the difference between window and branches transparency. My main question is – how to fix the branches so as to not hide the objects behind them? Shader code is:

gl_FragColor = vec4(textureColor.rgb * vLightWeighting, textureColor.a);

I played with enable/disable blending and depth_test, sometimes getting the desired results, but not sure if it’s the proper way to do things.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:02:40+00:00Added an answer on May 28, 2026 at 2:02 am

    You’re running into depth buffer issues, it has nothing to do with your shader or blend modes.

    What’s happening is that the order that you render your transparent geometry in is affecting your ability to render behind it. This is because the depth buffer has no concept of transparent or non-transparent. As a result, even though they don’t visually contribute to the scene those transparent pixels write themselves into the depth buffer anyway, and after that any pixels that you draw behind them will be discard because they’re “not visible”. If you drew the geometry behind the transparent object first, though, it would show correctly because it gets written into the frame before the transparent depth is put in place to discard it.

    This is something that even large commercial game engines still struggle with to some degree, so don’t feel bad about it causing some confusion. 🙂

    There’s no “perfect solution” to this problem, but what it really boils down to is trying to structure your scene like so:

    1. Render any opaque geometry sorted by state (shader/texture/etc)
    2. Render any transparent geometry next. If possible sort these by depth, so that you draw the furthest one from the camera first.

    Simply by flagging the bits of geometry that are transparent and rendering them after everything else you’ll solve 90% of this problem, but the issue may still remain for overlapping transparent objects. That may not be an issue for you, depending on your scene, but if it’s still causing artifacts you’ll need to sort transparent objects by depth before you draw.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an OOP environment for WebGL so I can easily create all
Environment: Visual Studio 2008 SP1 I have the following line in my text file:
Environment: Rails 3.0.4 and Ruby 1.9.2 I have the following form: <%= form_tag( {:action
Environment: Team Foundation Server 2005 Visual Studio 2008 I have a reasonably large project
Environment is VS2008, .Net 3.5 The following C# code (note the specified encoding of
ENVIRONMENT: C# I have a table of equivalent values, like this: CHEVR = CHEVROLET
Environment: I have that User entity : @Entity public class User implements Serializable {
Environment: ASP.NET MVC3 C# Say I have some repository (semi-psuedo): public interface IRepository {
Environment: xcode 3.2.1, document-based core-data application. I have a document-based cocoa app which uses
Environment: SQL Server 2005 SP2 (9.0.3077) Transactional Publications (Production and Beta) I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.