Draw order of aspect2d problem[solved]

Hello my good patient people, my problem this time is about egg texture cards reparented to aspect2d.

After a lot of time I finally got pixel perfect images, but the problem is which one of these images should stay behind the main character, which was reparented to render, but instead it stays on top of the 3d character, hiding completely it. I need it to stay below everything, to act as a background(but I need it to maintain the pixel perfect aspect)

This is for a character creation screen, if you´re wondering why. Thanks for any help concerning this particular problem!

By default, all things in render2d (and therefore aspect2d) are drawn on top of all things in render. If you want a background card to be drawn behind some things in render, you have three choices:

(1) Re-order the DisplayRegions so that all things in render2d appear below all things in render. This means that your GUI, if you are using one, will also appear behind your 3-D objects, so you can’t have a heads-up display if you do this.

(2) Create a third DisplayRegion for drawing stuff behind render. This allows you to keep render2d for your GUI and heads-up display.

(3) Simply parent your card to the camera, within the 3-D scene, and scale and place it correctly so that it precisely fills the scene. The use binning to put it behind everything, like you were doing a skybox. You’ll have to do the calculation to figure out how precisely big it should be to make it pixel-accurate, but this is not difficult.

David

I reparented the card to the camera, strangely I got a black card, but parenting it to aspect2d restores the image. I´m having problems with this, can you give an example? Also which of the ways above you think is better?

Probably the black card is due to lighting. You can disable lighting on your card with:

card.setLightOff()

None of the options is “better”. It depends on which way is easiest for you to manage.

David

Thanks! I managed to use the binning option and getting rid of the dark in the card using what you said. Thanks a lot!

I will not create another display region as I would need to get the render camera display and use .setClearColorActive(False) if I would want to see the custom display behind the default render display. And I would probably need this clearcolor to be active after.

3º option code:

		self.mmenuWin = loader.loadModel(data.MYDIR+'/../graphics/2d/menus/mmenu')
		self.mmenuWin.reparentTo(base.cam)
		self.mmenuWin.setPos( -0.5, 3.7, -0.7 )
		self.mmenuWin.setLightOff() 
		self.mmenuWin.setDepthTest(False)
		self.mmenuWin.setDepthWrite(False)
		self.mmenuWin.setBin('background', -1000)