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 8192931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:18:16+00:00 2026-06-07T04:18:16+00:00

I am using Three.js to render the world to a WebGLRenderTarget. My world does

  • 0

I am using Three.js to render the world to a WebGLRenderTarget. My world does not full the whole screen and thus, has transparent background. The purpose is to provide alpha-channel aware image effects.

  1. I render the world to a WebGLRenderTarget buffer

  2. I try to post-process this by reading from the buffer and writing to the real screen

My post-processing function depends on the alpha channel. However, looks like that somehow Three.JS post-processing shader fails to read the alpha channel correctly – it is all 1.0 no matter what values I try to put in to WebGLRenderTarget.

The simple way to demostrate the problem.

I create a render target:

        var rtParameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat};

        for(var i=0; i<this.bufferCount; i++) {
            this.buffers[i] = new THREE.WebGLRenderTarget(this.width, this.height, rtParameters);
        }

I clear the buffer setting alpha to 0.3::

        function clear(buf) {
            // For debugging purposes we set clear color alpha
            renderer.setClearColor(new THREE.Color(0xff00ff), 0.3);
            renderer.clearTarget(buf, true, true, true);
        }

        // Clean up both buffers for the start
        clear(buffers[0]);

And then I use this buffer as a read buffer and render to the screen in my post-processing fragment shader function (ThreeJS post-processing examples):

            "void main() {",

                    // texture is the buffer I rendered before
                    "vec4 sample = texture2D( texture, vUv);",

                    // Everything goes to white (1.0) when trying to visualize the
                    // alpha channel of previously rendered WebGLTarget.
                    // It should get value 0.3 - slight gray
                    "gl_FragColor = vec4(sample.a, sample.a, sample.a, 1.0);",
            "}"

Other color values are read correctly. If I use vec4(sample.r, sample.g, sample.b, 1.0) it directly copies as expected.

  • Is there a problem of clearing the alpha channel for WebGLRenderTarget?

  • Is there a problem of reading alpha values as having WebGLRenderTarget as texture for 2D image post-processing in GLSL shader?

  • 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-06-07T04:18:18+00:00Added an answer on June 7, 2026 at 4:18 am

    Here is a fiddle that implements what I believe you are trying to achieve.

    http://jsfiddle.net/6vK6W/3/

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

Sidebar

Related Questions

I'm using Java3D to render a three-dimensional scene. I would like to overlay a
I want to render a splash screen on the iPhone whilst using an Open
I want to render a video with the world map as background and geographical
I need to render quite alot (tens of thousands) images off-screen using OpenGL. I
I'm using symfony 1.4.3 Is there some way to render a sfWidgetFormChoice as an
We are using a third part library to render 3d. In this library there
I am using three tables and I am trying to calculate discounted price by
I have the following animation set up using Three.js: http://frontier.lincoln.ac.uk/3d/development/Stage2/characters/man2.html Please ignore the ropey
I'm attempting to expose a single API call using three different authentication mechanisms: django's
For a couple of years, I've been using the three-tier architecture (Presentation, Logic and

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.