I’ve been using Dynamic CubeMap to create a truncated fisheye: https://discourse.panda3d.org/viewtopic.php?t=1264&highlight=fisheye
Occasionally, after various upgrades, I’d have to use one of the following:
and careful use of
To prevent one camera of the Cubemap ‘sticking’.
In the latest 1.6.0 and 1.6.1 I can’t fix the sticking regardless of settings in Config.prc. Also the small sphere in the distance shouldn’t be visible, almost like occlusion has stopped working…
The last version this worked for was 1.5.4
Any API changes I should be aware of post 1.6?
This might make it a bit clearer:
This should just look like a dome corrected RoamingRalph. As you can see, one of the camera views is repeated, and the objects show their textures regardless of occlusion…?
Hmm, that’s very strange indeed. That “occlusion” problem looks like the depth buffer is not working in your offscreen buffers for some reason. And the wrong camera appearing on the left is very odd indeed.
These might be issues with your graphics driver, but I’d believe that only if it happened with true offscreen buffers instead of parasite buffers. Some things to try:
(a) Does it happen with “load-display tinydisplay” instead of pandagl? This is a pure software renderer, so it should avoid any issues with your graphics driver.
(b) If you are on Windows, does it happen with pandadx9 or pandadx8?
© When it is not working, what kind of offscreen buffers do you get? Are they parasite buffers or true buffers? Use “nli.getBuffer(0).getType()”. Also, for that matter, how about “nli.getBuffer(0).getFbProperties()”?
Thanks for the response.
I tried ‘tinydisplay’, and got
pete@CheeseBurger:~/Projects/RomaDomeRalph$ python RomaDomeRalph.py
DirectStart: Starting the game.
Known pipe types:
(all display modules loaded.)
:ShowBase(warning): Unable to open 'onscreen' window.
Traceback (most recent call last):
File "RomaDomeRalph.py", line 11, in <module>
File "/usr/share/panda3d/direct/directbase/DirectStart.py", line 4, in <module>
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 229, in __init__
self.openDefaultWindow(startDirect = False, props=props)
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 726, in openDefaultWindow
raise StandardError, 'Could not open window.'
StandardError: Could not open window.
I think I confused the issue. Whilst I used the linked thread for inspiration, and some clarification (with yourself) I didn’t use that code or technique. Ultimately I used this:
#Author: Pete Carss
# Make the camera into a fisheye camera
from direct.task import Task
from pandac.PandaModules import *
from direct.showbase.DirectObject import *
import random, sys, os, math
# Figure out what directory this program is in.
fisheyeLens = OrthographicLens()
#base.cam.node().setPos(0, 0, 0)
screens = NodePath('dark_room')
sphere = loader.loadModel(MYDIR+'/projectionISOHemi')
cubeCam = NodePath('cubeCam')
buffer = base.win.makeCubeMap('env', 1024, cubeCam)
sphere.setPos(0.0, 1.0, 0.25)
sphere.setTexHpr(TextureStage.getDefault(), 0.0, 155.0, 0.0)
So I’m using the simple Dynamic Cubemap, mapped onto a sphere, with an orthographic lens looking at the result…
OK, but the code snippet you post doesn’t seem correct. You end up with nothing under render, and the cubeCam is in the same scene with the sphere which is showing the results of cubeCam?
Don’t you mean to put cubeCam under base.camera, and your base.cam under screens?
In any case, let’s take a look at your buffer.getType() and buffer.getFbProperties(). Since you are using an actual cube map texture instead of the six-texture solution in the linked post, it becomes more likely that there is a driver issue involved here (graphics drivers seem to be especially likely to have bugs with respect to cube maps).
OK - under XP, Panda3D 1.5.4, nVidia driver 182.08 - a working state I get:
depth_bits=24 color_bits=32 alpha_bits=8 back_buffers=1 force_hardware=1
on ubuntu Jaunty amd_64, Panda3d 1.6.1, nvidia driver 180.44
I added ‘prefer-parasite-buffer 1’ to the Config.prc but that did nothing. I also downgraded the drivers to 173.14.16 and that did nothing either…
I use this class by importing it into the app I want to dome correct, then change any reparentTo() statement to reparentTo(fisheye.screens) - works a treat when it works…
Hmm, I’m surprised that “prefer-parasite-buffer 1” had no effect. Are you sure that you edited the right config.prc file? Try printing cpMgr and ConfigVariableBool(‘prefer-parasite-buffer’) to prove that the variable was correctly set.
This is what I got. It looks like
0 explicit pages:
2 implicit pages:
prefer-parasite-buffer 1 (from /etc/Config.prc)
prefer-parasite-buffer 0 (default value)
Set this true to make GraphicsOutput::make_texture_buffer() try to create a ParasiteBuffer before it tries to create an offscreen buffer (assuming it could not create a direct render buffer for some reason). This may reduce your graphics card memory requirements by sharing memory with the framebuffer, but it can cause problems if the user subsequently resizes the window smaller than the buffer.
This got me fiddling. I started reducing the size of my cubeMap, first 512, then 256 - now, with ‘prefer-parasite-buffer 1’ it works. With ‘prefer-parasite-buffer 0’ it doesn’t.
The significance of this: The machine with XP has 1024MB Video RAM, the Jaunty machine has 256MB. So the problem probably is, as you say, driver related. At least I have a workaround. The maximum number seems to tally with the available video RAM…
Thanks again for your input.
Ah, actually, the limit there is your window size. A parasite buffer does not consume additional texture memory, but must be no larger than your main window, so perhaps your window is smaller than 512 x 512?
that was it! I can run at 1400x1050 fullscreen with a texture size of 1024.
Tough to debug that one, as I always switched to windowed (800x600) for debugging…