WorldViz User Forum Texture Coordinates in a Cube Map
 Register FAQ Search Today's Posts Mark Forums Read

#1
05-09-2013, 10:08 AM
 mshukun Member Join Date: Jan 2013 Posts: 32
Texture Coordinates in a Cube Map

I am trying to ascertain texture coordinates for each created vertex in a cube map (i.e. a 360 degree panorama). I have tested "getTexCoord" in the cube map, resulting in all vertices' texture coordinates to be [0.0, 0.0, 0.0]. I thought texture coordinates of the vertex [0,0,0] to be [0.5,0.5, ?] (I don't know 'r' in this case). Is the "getTexCoor" function not meant for cube maps as well? If so, is there way to get texture coordinates or array index number for each vertex of cube face?

I truly appreciate any help that you might be able to provide. Thanks so much in advance.

Code:
```import viz

viz.go()

sky.texture(env)

viz.startLayer(viz.POINTS)
viz.vertexColor(viz.GREEN)
viz.pointSize(15)

viz.vertex(0,0,0)
viz.vertex(-4.2, -16.5, 98.2)
viz.vertex(-13.8, 3.6, 99.0)
points = viz.endLayer()

print points.getTexCoord(0)
print points.getTexCoord(1)
print points.getTexCoord(2)

import vizcam
vizcam.PanoramaNavigate()```
#2
05-09-2013, 04:00 PM
 farshizzo WorldViz Team Member Join Date: Mar 2003 Posts: 2,849
Can you explain what you are trying to accomplish? The getTexCoord() function will return the texture coordinates you assigned to the vertex. Your code is not specifying any texture coordinates, so getTexCoord() will return [0,0,0].

Texture coordinates for cube maps are generally specified as a 3 component normalized direction vector from the center of the cube.
#3
05-10-2013, 12:31 PM
 mshukun Member Join Date: Jan 2013 Posts: 32
Thank you very much for your reply. I would like to draw all vertices onto each cube face image and then save them as new image files (in order to record and display where a user throws a ball in a 360 degree interactive environment). By analogy, in Google maps one can create place marks and store it as an image file. In my case, I am trying to perform the same essential function in a cube map (since place marks are added using HMD, users freely look around and add place marks onto 360 panorama images). All place marks x, y and z coordinates are then stored in database to populate all place marks and save them as a new image file for each face for later analysis -- at least that is my goal of what I would like to accomplish.

I would like to apply 2D texture coordinates (s and t) instead of 3D so I was thinking bottom left [0,0], bottom right [1,0], top left [0,1] and top right [1,1] for each face image should serve my needs, and I thought this would be the default texture coordinate system for a cube map, but it appears I was incorrect. Therefore, how do I set 2D texture coordinates for a cube map? I suspect the answer will require considering axis direction (e.g. Positive X : -Z(s), -Y(t), Positive Z: +X(s), -Y(t) and so on).

I believe finding the texture coordinate is the best method to achieve my purpose, but if you have any suggestion or guidance, it would be greatly appreciated.

Thank you again.

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post mshukun Vizard 2 03-14-2013 06:17 AM whj Vizard 1 09-25-2012 03:15 PM yth Vizard 0 06-02-2012 03:40 AM sleiN13 Vizard 5 06-24-2011 12:48 AM whj Vizard 0 04-23-2010 12:23 PM

All times are GMT -7. The time now is 03:34 AM.