Only show the model, everything else is transparent, what should I do

Just as the title says, only the model is displayed, which means that the entire canvas only displays the model. Other things such as sky box and default background will not appear on the screen. Only the model, please help me,thank you!

Does the camera have the correct revert layers on it to render? If you are still having trouble can you please post a link to the project please?

camera.addComponent("camera", {
    clearColor: new pc.Color(0.4, 0.45, 0.5,0) // set alpha 0

this code can make it,I am checking if this will cause other problems,thank you for your time!

Hmm… I can’t replicate the issue in a simple example here:


Can you please provide a reproducible of your problem?

:smile:Maybe my problem is not well described,First of all, I need to get rid of the sky box and just don’t use it, and then I need to remove the default background,I used to use this code to make the default background not display:clearColor: new pc.Color(0.4, 0.45, 0.5,0) // set alpha 0 ,but it cause other problems in my project,then I use this code :clearColorBuffer: false,,It totally solved my problem.As in this example, there is no sky box, no background, only model.I can embed it into my web page, so that there is no obvious boundary between it and other HTML elements, which is what my product manager wants

Sounds like you want the canvas to be transparent so you can see the HTML elements behind the PlayCanvas app? Using that and a clear color with no alpha, should give the result you want.

Wow,I didn’t know this parameter,it is so nice.but I don’t know how to set this property in code

I think it’s an option on the graphics when it is created:

var options = {
    graphicsDeviceOptions: {alpha: true}
var app = new pc.Application(canvas, options);
1 Like

can i use the cammera code?

I’m not sure what you mean @chris2009ni?