# [JAVA3D-INTEREST] create texture for complex geometry

4 replies [Last post]
Anonymous

Mike Pilone

Amir,

You can think of texture coordinates as just a percentage into the image,
from 0 to 1 (0% to 100%). For each vertex, you will need some equation to
map the 3D coordinates to 2D coordinates in the image, then calculate the
percentage into the image of the resulting 2D coordinate. Each of your
vertices will need a texture coordinate. You should not have to create a
special image, most of the time the texture coordinates will allow
Java3D/OpenGL to properly warp the image to fit.

If your shape always sits on the same plane, you can simply create a ratio
in from the plane (2D) to the image (2D) if you can calculate the min and
max points in the shape.

Hope that helps,
-mike

-----Original Message-----
From: Amir Bukhari [mailto:ufz6@rz.uni-karlsruhe.de]
Sent: Wednesday, August 25, 2004 6:16 PM
To: Java 3D interest
Subject: [JAVA3D-INTEREST] create texture for complex geometry

Hallo,

in the application I work, we need to create a shape from a geometry
coordinates, the shape
is created dynamical at run time, there is no way to know how it look
before. the geometry is
created from a number of rectangle. at the end I should map an image to this
shape via texture.
note that I want to map only the portion of the image which fall in the
shape. the image could
be seen as a parent window to the shape, see the picture bellow.

if I have a geometry (a,b,c,d,e,f) like:

image w
|-----------------
| a/------/f |
| / / |
| / / |
| /b /e | image h
| | | |
| | | |
| c------d |
|----------------|

how many texture coordinates I want to map the portion of the image
which fall in this geometry (a,b,c,d,e,f)?
or what is the best way to create the texture?.

-Amir

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net

Amir Bukhari

> If your shape always sits on the same plane, you can simply create a ratio
> in from the plane (2D) to the image (2D) if you can calculate the min and
> max points in the shape.
>

That what I have done. In my hand is the Image size and the rectangles,
which define the geometry does not exceeded the image size. thus I have
create the ratio from image width and height.
before I done that I have a problem by unstanding texture coordinates,
therefore always I created a wrong texture coordinates.

Thanks,

-Amir

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net

Amir Bukhari

Hallo,

in the application I work, we need to create a shape from a geometry coordinates, the shape
is created dynamical at run time, there is no way to know how it look before. the geometry is
created from a number of rectangle. at the end I should map an image to this shape via texture.
note that I want to map only the portion of the image which fall in the shape. the image could
be seen as a parent window to the shape, see the picture bellow.

if I have a geometry (a,b,c,d,e,f) like:

image w
|-----------------
| a/------/f |
| / / |
| / / |
| /b /e | image h
| | | |
| | | |
| c------d |
|----------------|

how many texture coordinates I want to map the portion of the image
which fall in this geometry (a,b,c,d,e,f)?
or what is the best way to create the texture?.

-Amir

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net

Amir Bukhari

may be you have receive a corrupted picture, but by the way I have solve
this problem.

On Thu, 2004-08-26 at 00:15, Amir Bukhari wrote:
> Hallo,
>
> in the application I work, we need to create a shape from a geometry coordinates, the shape
> is created dynamical at run time, there is no way to know how it look before. the geometry is
> created from a number of rectangle. at the end I should map an image to this shape via texture.
> note that I want to map only the portion of the image which fall in the shape. the image could
> be seen as a parent window to the shape, see the picture bellow.
>
>
> if I have a geometry (a,b,c,d,e,f) like:
>
> image w
> |-----------------
> | a/------/f |
> | / / |
> | / / |
> | /b /e | image h
> | | | |
> | | | |
> | c------d |
> |----------------|
>
> how many texture coordinates I want to map the portion of the image
> which fall in this geometry (a,b,c,d,e,f)?
> or what is the best way to create the texture?.
>