Hi Neil

I would say no, not from that info, ST simply map to the texture 0 to 1 no
matter the size of the texture in pixels etc.  

you could  get the state set of the geode the texture is being to and get
the texture /image size in pixels but this would still not have enough
information as what is the real-world size of the texture, you only have
pixel size, what does one pixel represent ? 1cm, 1m 10m, 100m etc

Multigen Creature actually has a solution for you, all textures applied in
Creator to a model have an *.ATTR file created ( myTexture.jpg.attr )  that
contains a field to set the textures real world size among other useful
information. I'm not sure if OSG reads these, most programs ignored this
field but used the others like filters to apply to mipmap etc .

 In my old GIS product SiteBuilder3D we made a lot of use of this real world
size to map textures to extruded shape files etc to ensure building sides,
bricks, walls, windows mapped to correct actually size. But this relied on
the real-world size being set correctly in the Attr file

If you don't know the Real-world size that the texture covers, what each
pixel represent then you cannot really achieve what you're after, 

____________________________________________________________________________
__
Gordon Tomlinson 

[email protected]
IM: [email protected]
www.vis-sim.com www.gordontomlinson.com 
____________________________________________________________________________
__

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Thursday, January 29, 2009 9:29 AM
To: [email protected]
Subject: [osg-users] How to deduce the implied size of texture from
coordinate mappings....

Hi All,

I've had a look through the mail archives, and I don't think this has been
asked before, so I was hoping someone might be able give some guidence to me
on a question I'm bashing my head with at the moment. Its not strictly an
osg question - though I am using osg to try and solve it.

Question
======

I have a general triangle in 3D space, known coordinates, with known S,T
texture coordinates. Knowing only this information, is it possible to
calculate the size of the texture?


Background
========

The background to this problem is that I have an object with texture
coordinates, that has applied a texture. I now wish to apply a new texture
to this object where I know the size that this texture is mean't to
represent in the 3D space. Thus I believe  I need to scale the texture
coordinates on the object such that the size of the new texture is correctly
represented relative to the object.

[Brief asside - I suspect that there might be a way to do this other than
altering all the texture coordinates, perhaps a scale measure on a texture
object but I haven't delved deep enough into osg::Texture2D to know.]

In order to scale the texture coordinates I need to know the size that the
original texture represented relative to the object/universe it was in. 

Each geometry could have its own texture, therefore I'm at the geometry
level, and I have the triangle with the largest variation in the S,T domain.

I can transform this triangle to a cordinate system that is co-planar with
the triangle, where one edge forms the first of a pair of orthogonal basis
vectors in the triangle plane (e1,e2), and hence I can represent my triangle
in this space. 

The S,T domain is coplanar for my requirements, and with a shift of origin,
(0,0) in the S,T domain maps to (0,0) in the e1,e2 domain. 

So I get to a point where I have the two sets of orthogonal axis in the same
triangle plane, where a rotation of the e1,e2 axis would align them to the
U,V axis. 
However, my next step is not clear.

Can any one assist please. I may be barking up the wrong tree here, and if
so, please accept my apologee.

Thanks  for any help

Neil Hughes.


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to