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

  • Home
  • SEARCH
  • 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 3443610
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:48:44+00:00 2026-05-18T08:48:44+00:00

I’m creating a simple 3D engine using the HTML5 canvas object. It is working

  • 0

I’m creating a simple 3D engine using the HTML5 canvas object. It is working well but I’d like to implement red/blue anaglyph processing, so that one could really see 3D using red/blue glasses. At the moment I have the 3D object rendered twice, the second time from a camera position just next to the first camera position.

The problem I’m facing is how to combine the two objects rendered to have the correct color for an anaglyph. Now I’m using globalAlpha=0.5 and rendering the first in red and the second in blue. This is however not completely working, as pixels only affected by the red object should stay red, but they are becoming the color between black and red as my background color is black.

When taking a look at a 3D anaglyph creating application, I noticed that red and blue pixel together are calculated as following:

 255  0  0
 0    0  255
------------- +
 255  0  255

The HTML5 canvas is however calculating all pixels using alpha, so if the background color is black a red pixel becomes dark-red while it should stay red. Basically I need the pixels of the red object only affect the red component of each pixel, and the pixels of the blue object affect only the blue component of each pixel.

I could be working on a per-pixel basis but would this be possible and not performance-breaking? I’m rendering 20 frames a second so I guess it would not be of any practical use. Any suggestions would be appreciated.

I hope this image clarifies the whole:

Example

  • 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-18T08:48:45+00:00Added an answer on May 18, 2026 at 8:48 am

    There is a globalCompositeOperation property of the canvas context that you can change to affect this behavior. Specifically, setting it to ‘lighter’ will add the colours of any drawing operations to the source image. This will also respect the alpha value. If it is a complex scene, you may have to draw the scene twice, each to a hidden canvas, then copy them each into the visible canvas with the composite operation set to ‘lighter’.

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

Sidebar

Related Questions

No related questions found

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.