WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Texture Coordinates in a Cube Map (https://forum.worldviz.com/showthread.php?t=4577)

mshukun 05-09-2013 10:08 AM

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()

env = viz.addEnvironmentMap('gpo_L.jpg')
sky = viz.addCustomNode('skydome.dlc')
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()


farshizzo 05-09-2013 04:00 PM

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.

mshukun 05-10-2013 12:31 PM

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.


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

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC