Transparent canvas background CC3.3.1 on the web?

Hello. I am trying to make my web application’s canvas to be transparent as well as the camera’s clear color, but without success. I want to show a 3D object on top of a web site. I can fix the canvas object with css. But I cannot get the camera’s clear color to be transparent.

I know this is possible in WebGL so I think there must be a way to achive this. Does anyone have an idea how to do this? I would be very happy for any help.

Thanks
/Peter

Try setting alpha value of the camera’s background color to 0 in Editor and in script add
cc.macro.ENABLE_TRANSPARENT_CANVAS = true.

1 Like

Thank you very much for the help! I finally got it to work! I did try to change that variable earlier as well. But I did it from inside one of my components. When I changed it in the application.js file (inside the built directory it worked). So I guess it needs to be set before the scene loads.

Now I also found a setting for this, which does the same thing.
Again, thank you very much!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.