3D Skybox

Has anyone ever tried creating a 3d skybox, similar to how the Source Engine does it?

havent seen anyone. but set up a seperate scene graph, add a camera, render to texture… i dont see anything that would be a problem.

should be a straight forward process. go ahead, try, succeed :slight_smile: and if you have any questions feel free to ask for help.

Ok, I’m trying to set the display region sorting but it does not seem to help. When setting my new display region to a higher sort value than the base.cam.getDisplayRegion(1), which seems to be the one used by the render node, it does get displayed above it, but it is not visible when setting it to a lower sort value.

# Sky Camera
		#
		self.skyBoxDR = base.win.makeDisplayRegion()
		cam=base.makeCamera(base.win)
		
		self.skyBoxCamera = NodePath(cam)
		self.skyBoxCamera.node().setLens(base.camLens)

		self.skyBox3dNode = NodePath('skybox Root')
		self.skyBoxCamera.reparentTo(self.skyBox3dNode)
		
		self.skyBoxDR.setCamera(self.skyBoxCamera)
		
# these don't make any difference, when True or False
		#base.win.getDisplayRegion(1).setClearColorActive(False)
		#base.win.getDisplayRegion(1).setClearColor(Vec4(0,0,0,1))#Vec4(0.5,0.75,1,1)
		#base.win.getDisplayRegion(1).setClearDepthActive(True)
		
		
		self.skyBoxDR.setSort(5)
		base.win.getDisplayRegion(1).setSort(10)
		base.win.getDisplayRegion(2).setSort(25)

Any ideas?

10 is also the sort value that is assigned to render2d, which is also set to clear the depth buffer. So it might be a good idea to use values that are all before 10, or to readjust the sort value of render2d’s as well. Note that you may use negative sort values if you like.

You might consider using base.win.getActiveDisplayRegion(0) for the first display region, rather than getDisplayRegion(1). In fact, you can use base.win.getActiveDisplayRegions() to return a list of all DisplayRegions, in order by sort value.

David

Got it working.

Needed to use:

cam=Camera('HUD Camera')

Instead of:

cam=base.makeCamera(base.win)

Then I just set the new display region’s sort value to -5.

Thanks David.