I am currently taking a class on Panda 3d at a local college and we are 2 weeks in. I’m not a total noob with modeling/programming, but I am new to Panda 3d. I have done a lot of searching on this forum, and I have tried nearly everything that I could find, but I am still without a fix for something that should be pretty simple.
Our semester long assignment has us doing a space genre shmup. Our instructor has us placing a HUD outside of the player’s model to use for both aiming and as a reference point for vector math/movement. I’m trying to make my HUD a little prettier than the one he supplied by adding some transparency to it.
I have a good model for the HUD, but for the purposes of this post and to make everything easier to see, I am currently using a square plane that is red in color and alpha set to 0.3. The starfield is a skybox.
When I place the camera behind the player’s ship, the plane looks blue/gray and the starfield behind it is not visible:
When I rotate the camera around the ship so that the nearby planet model is behind the plane, it works as expected:
I continued to rotate the camera until it left the planet and as it touches starfield, it turns blue/gray again with any part over the planet looking as I would expect it to. I had a picture to show this, but the forum only allows me 3 uploads. As I continued to rotate around the model it suddenly works as expected over the starfield:
I have tried the following:
Model
Made a simple texture and opacity map to give it an alpha of 30%.
Removed texture and just made the diffuse color red with an alpha of 0.3.
The starfield’s size is 6000 on all sides. I have used a textured cube with
self.skybox.setTwoSided(True)
and have also used an inside-out cube with the texture just on the inside.
Programming
Changed the far clipping plane to beyond the starfield using
base.camLens.setFar(100000) # started at 5000 and increased the value from there
Used the following to set the transparency:
self.hud.setTransparency(TransparencyAttrib.MAlpha)
self.hud.setAlphaScale(0.3)
All of the above produces the same results. It works at some angles or over close objects (everything but the starfield unless I am nearly perpendicular to it), but not at all angles. Any help is appreciated…