#1
|
|||
|
|||
Cube Map Coordinates
Might anyone know what coordinate system is applied in the cube map? The code below was kindly provided to me using this forum, but I need to know the actual coordinate system used in the cube map in order to perform further downstream processes. For instance, if a spherical coordinate system is used in the cube map, how can I find radius of the sphere? On the other hand, if a cube coordinate system is used, how can I ascertain the height, width and depth of the cube map? (Thanks in advance for any assistance you can provide in this regard, which is greatly appreciated.)
Code:
import viz import vizmat import vizshape viz.go() env = viz.addEnvironmentMap('Farm2A.jpg') sky = viz.addCustomNode('skydome.dlc') sky.texture(env) viz.link( viz.Mouse , viz.addTexQuad(viz.SCREEN,texture=viz.add('crosshair.png')) ) viz.mouse.setVisible(viz.OFF) def placeMarker(): line = viz.MainWindow.screenToWorld(viz.mouse.getPosition()) pos = vizmat.MoveAlongVector(line.begin,line.dir,40) shape = vizshape.addCircle() shape.color(viz.GREEN) shape.billboard() shape.setPosition(pos) print shape.getPosition() #place a marker when the left mouse is pressed vizact.onmousedown(viz.MOUSEBUTTON_RIGHT,placeMarker) import vizcam vizcam.PanoramaNavigate() http://screencast.com/t/hSkab1MNKk |
#2
|
|||
|
|||
Do you want the dimensions of the box that the textures are applied to?
|
#3
|
|||
|
|||
Thank you very much for your kind reply.
Please disregard my question, as I subsequently figured out that the coordinate system used in the cube map involves neither cube nor spherical coordinates, but instead something more like the quadrilateralized spherical cube or continuous cube map coordinates. I have been trying to convert given world coordinates (for user-created place marks in the cube map) to flat images of six faces in order to save user-created place marks in image format using PIL. However, I have been having difficulties converting the Y value to a flat image, and I now assume that I need to find 2D texture coordinates (S and T) of each place mark instead of world coordinates. I truly appreciate if you could provide me ways to achieve the task above, i.e. "finding 2D texture coordinates (S and T) of each place mark instead of world coordinates". Thank you again so much! I truly appreciate your help. |
#4
|
|||
|
|||
Perhaps you can add a cube that is sized to match where the marks are placed. Then you can get which face of the cube and position of the cube using viz.pick. You could then perform some calculations to normalize the pick location to match texture coordinates. In the following example the cube is not visible because the viewpoint is inside it and back faces are not rendered by default:
Code:
import viz import vizshape import vizact viz.go() env = viz.addEnvironmentMap('sky.jpg') sky = viz.addCustomNode('skydome.dlc') sky.texture(env) vizshape.addGrid() cube = vizshape.addCube(size=80,splitFaces=True) def getPickInfo(): info = viz.pick(info=True) print 'name',info.name print 'point',info.point vizact.onmousedown(viz.MOUSEBUTTON_LEFT,getPickInfo) |
#5
|
|||
|
|||
Thank you for your help! I have tested provided code and was able to generate place markers on flat cube images!! I was trying to figure out how to do it for a month so it was a huge help!!
Thank you so much!! |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Texture Coordinates in a Cube Map | mshukun | Vizard | 2 | 05-10-2013 01:31 PM |
360 panorama image cube using as darts target and record the xy coordinates | mshukun | Vizard | 2 | 03-14-2013 07:17 AM |
How do coordinates in IS900 thransform into coordinates in vizard's world | jacky | Vizard | 1 | 08-11-2011 11:44 AM |
viz.vertex coordinates | lilio | Vizard | 6 | 05-16-2009 05:36 PM |
Inertia Cube | bstankie | Vizard | 1 | 03-24-2003 12:00 PM |