How to make Background transparent

Sorry for unclear topic name.

I want to do somethings like the following picture.

The problem is that I don’t know how to make background transparent to see through the previous scene background and

show some model ( like the book in the picture ) which can rotate etc …

I know that I can use nifty to set Screen as transparent one , but the model will be draw behind the Screen too.

So , what should I do ??

Sorry for my English and Thank you in advance :slight_smile:

In this case the libraly background image is rendered first, then the 3d model, and then the HUD. You’ll need 3 viewports. Look at Also, take a look at this topic

1 Like

thank you

but what if the background is not image, but it is the real previous scene?

Or should I take a screenshort from the previous scene and set it at background image for the new scene one ?

No you move the book to the new viewport that glauco suggested.

@glaucomardano. If I do what you tell, the viewport’s background that show 3d model still not transparent to see through to the background image, so what should I do?

thank you very much:)

@normen thanks, I just saw your post :stuck_out_tongue: but same question

separate viewports. not one other viewport where you do the same as in the first ^^

Sorry I don’t understand

suppose this is the code , assume that the library backgrond are attach to the main Camera’s viewport ( that come from Simple Application )


Camera hudCamera = app.getCamera().clone();

Camera 3DModelCamera = app.getCamera().clone();

Camera HudCamera .setViewPort(0, 1, 0, 1);

Camera 3DModelCamera .setViewPort(X1,X2 , Y1, Y2);

this.HudViewPort = renderManager.createMainView(“HudView”, HudCamera);

this.HudViewPort .setClearFlags(true, true, true);

this.HudViewPort .addProcessor(niftyDisplay); //for init Hud and suppose this line attach hud to the screen

this.3DModelCamera = renderManager.createPostView(“ModelView”, 3DModelCamera);

this.3DModelCamera.setClearFlags(true, true, true);



the background of 3D Model is Black.

So, what do you mean " separate viewports"

Thanks for quick reply :slight_smile:

a) if you clear the buffers (clear flags) then it surely will be black, yeah

b) Why you create a post view? Create a main view.

Wow thank you very much. I can do what I want now. Anyway could you explain what Stencil and depth is, or do you have any resources relate to this ?

Thanks Again :slight_smile: Theres a manual in the SDK containing lots of info for 3d beginners.