rendering 2 sided

******
EDIT:Nevermind, I have it working now, I’m going to tidy the code and post the resolution incase someone else needs the answer later
******

Hi
I’m putting the boiler plate code below and have run into an issue with the sky box, specifically being unable to render the texture to the inside of the skybox which I then intend to reparent to the camera. At the moment I’m manually flying the camera into the skybox to check everything looks ok from the outside.

I thought I had it sorted when a post here-

[two sided normals)

…suggested changing the config file if you are using directX. Added the line in the code below to the config file but still no change.

I’ve been using the box model that comes with panda, and the sphere and star texture in the solar system tutorial.

If there anything else I’m maybe missing at all could someone point me in the correct direction please?

I’ve commented out the rest of the code but included it in case it’s useful to someone coming in from a search later.

Thanks.

from direct.showbase.ShowBase import ShowBase
from direct.gui.OnscreenText import OnscreenText
from direct.gui.DirectButton import DirectButton

class Game(ShowBase):
	def __init__(self):
		ShowBase.__init__(self)
		
		#set config vars
		base.setBackgroundColor(0,0,0)
		
		#move camera
		camera.setPos(0.0,0.0,0.0)
		camera.setHpr(2,0,0)
		
		#load sphere for skybox
		skybox = loader.loadModel("models/box.egg")
		#skybox = loader.loadModel("models/solar_sky_sphere.egg")
		skyBoxTexture = loader.loadTexture("maps/stars_1k_tex.jpg")
		skybox.setTexture(skyBoxTexture, 1)
		skybox.setTwoSided(True)
		skybox.setBin("background",0)
		skybox.setDepthWrite(False)
		#skybox.setCompass()
		skybox.setPos(0.0,4.0,0.0)
		skybox.setHpr(0,0,0)
		skybox.reparentTo(render)
		#skybox.reparentTo(camera)
		
		#load font
		#headerFont = loader.loadFont("GringoNights.ttf")
		#headerFont.setPixelsPerUnit(60)
		
		#display Text
		#textObject = OnscreenText(text = "We Love SkyBoxes!", pos = (0,0.7), scale = 0.25, fg = (1,1,1,1), font = headerFont)
		
		#load quit button
		#quitMap = loader.loadModel("quitButtonMaps.egg")
		#quitButton = DirectButton(geom = (quitMap.find("**/quitok"),quitMap.find("**/quitclick"),quitMap.find("**/quitroll"),quitMap.find("**/quitdisable"),), scale=0.33, borderWidth=(0.025,0.025), pos=(0.0,0,-0.75), frameColor=(0.5,0.25,0.25,1), command="quitCommand")
		
	#def quitCommand(self):
		#sys.exit()
		
game = Game()
game.run()
#turn on backfaces
egg-emulate-bface #t

Hi
I’ve made the code a bit neater and uploaded it with assets to -

jpcoyne.co.uk/panda3d/basic.zip

There are py files tut0001 to tut0005 as this was intended to show the evolution of some basic boiler plate code while I learn it. It isn’t finished yet but I figured if I’m uploading code I may as well just do the whole lot in case it’s of use to anyone.

tut0005.py add’s the skybox which was so problematic for me earlier.

I haven’t called setTwoSided on the skybox as I believe the change made in the config file has enabled this. If so I guess I may need to explicitly switch it OFF for regular models later to save on overheads.

The next phase is to add a plane as a terrain place holder, and spin the camera slowly for a nice atmospheric effect.

Let me know what you think or if this is any use to anyone.

Thanks.

u can make a model with inverted normals or as u mentioned call “setTwoSided” for the selected model, the third solution in my opinion is not good, this will greatly decrease the frame-rate of your application, it’s like rendering the scene twice, openGl works great on any platform and it’s the default choice for panda , there is no need for using directX

read this
panda3d.org/manual/index.php … imitations

still if you like the method of changing the config file you can do it on the run time without changing it for all other applications, just add this to the begin of your code

from panda3d.core import loadPrcFileData
loadPrcFileData("", "egg-emulate-bface #t")

this will do the same effect of adding the line to the config but it won’t change the file.

Hi
Thanks for the advice. I’ve altered the config file and will likely generate an inverted model for the skybox.

Seems to be using openGL now so I must have been mistaken earlier.