From: Bruce S. <bas...@un...> - 2004-03-15 18:08:21
|
It would indeed be incredibly useful to have a point source of light, for many reasons, including illustrating the phases of the Moon. But the current lighting model in Visual is very basic, limited to sources at infinity. It will require much work to get more sophisticated lighting. Jonathan Brandmeyer is hoping to work on this soon, after he finishes a very major project to use Boost to connect between Visual and Python. Here's a routine which, after a mouse click, changes your point of view to be looking at the cyan sphere from near the yellow sphere. The key notion is that the center of the scene is under the control of the program, but the camera direction and distance are normally under the control of the user (using right and left mouse-button drags). You can disable user control (userzoom = 0 and/or userspin = 0). Note that scene.fov ("field of view") is an angle in radians such that the tangent of half that angle is the magnitude of the range divided by the distance from camera to center. from visual import * from __future__ import division scene.range = 3.5 s1 = sphere(radius=0.5, color=color.yellow) s2 = sphere(pos=(3,0,0), radius=0.4, color=color.cyan) scene.mouse.getclick() # wait for mouse click scene.center = s2.pos # about which user rotates with right mouse button scene.forward = (1,0,0) # pointing from camera toward center # And adjust distance from center to camera: scene.fov = 2*atan(mag(scene.range)/(mag(s2.pos-s1.pos)-s1.radius)) # Now you are near the yellow sphere, looking toward the cyan sphere. Bruce Sherwood Lew Riley wrote: > Hi Folks, > > I have two feature requests (unless I've overlooked things that > already exist). > > 1) It would be incredibly useful to have a point source of light (with > 1/r^2 intensity dependence) in addition to the "off-stage" lighting. > > 2) I would find it helpful to be able to set the camera position > directly in addition to the indirect influences of display.forward and > display.center. > > I am working on animations of the Ptolemaic and Copernican models of > the inner planets. I would like to show the phases of the inner > planets. Feature 1 would allow me to use the Sun to illuminate the > planets without needing to place the Sun off-camera. Feature 2 would > provide me an easy way to place the camera on the Earth. > > Feature 2 would also be helpful to anyone illustrating reference > frames. That is, one could easily place the observer in various frames > of reference to show how observations differ. > > Finally, would someone please explain how display.mouse.camera is > calculated from display.forward and display.center (and what else)? > > Thank you for maintaining an incredibly useful tool. > > Cheers, > > Lew |