Menu

#40 Clipping planes incorrect (was: Can't move light source)

feature request
closed-fixed
7
2000-06-25
2000-06-23
No

I'm sure you already knew that. Here's a case where I wanted to...

I set scene.fov = 0.001 to get a 2-D view. This works--except things higher than about range*2 are invisible because the light is below them. They become visible when the window is rotated. It'd be nice to be able to put the light way out by the camera, to illuminate everything from the top.

Code to show this effect (the Z-axis line will only go up to about 120, but if you rotate the view 90 degrees around the Y axis you can see it grow out to 300).

def text(x,y,z,t):
global labels
labels.append(sphere(pos=(x,y,z),radius=0.0001,label=str(t)))

def DrawLabels():
text(45,-5,0,'Off (msec)')
text(-10,50,0,'On')
text(-10,-10,0,'0 sec')
text(-10,-10,5,'time')
text(-10,-10,100,'100 s')
text(-10,-10,200,'200 s')
text(-10,-10,300,'3...s')

def InitVisual():
scene.width = 500
scene.height = 500
scene.autoscale = 0
scene.fov = 0.001
scene.center = (50,50,0)
scene.range = (60,60,60)
curve(pos=[(100,0,0),(0,0,0),(0,100,0)], color=color.white)
curve(pos=[(0,0,0),(0,0,300)], color=color.white)
DrawLabels()

Discussion

  • David Scherer

    David Scherer - 2000-06-23

    Good guess, but this problem doesn't actually have anything to do with the lights, which are infinitely far away.

    The problem is that in order to use hardware depth buffering, Visual needs to choose appropriate near and far clipping planes - essentially, the distance of the nearest and farthest objects from the camera. Rather than make a pass through the scene database just to calculate that, it tries to use the extent information calculated by autoscale. Unfortunately, when autoscale is off this doesn't work. A temporary workaround is to remove the lines 'scene.autoscale=0' and 'scene.range=(60,60,60)' and zoom manually with the mouse.

    This is a real bug - we should use the results of the autoscale extent calculation even when range has been set manually. I've run into this myself, and should have fixed it by now.

    It would also be nice to be able to move the lights, of course.

     
  • David Scherer

    David Scherer - 2000-06-23
    • priority: 5 --> 7
    • assigned_to: nobody --> dscherer
    • summary: Can't move light source --> Clipping planes incorrect (was: Can't move light source)
     
  • David Scherer

    David Scherer - 2000-06-25
    • status: open --> closed-fixed
     
  • David Scherer

    David Scherer - 2000-06-25

    Fixed in CVS. I think. Could use some more testing, e.g. with highly nonuniform graphs.

    The far clipping plane should always be adequately distant now. But we can still hit problems with the *near* plane in scenes with high dynamic range. Maybe Visual should use the Aleph engine's approach to choosing clipping planes (give the near plane priority)?

     
MongoDB Logo MongoDB