Texture Transformations 
Author Message
 Texture Transformations

I am having trouble with Texture Transformations.  I can
scale, rotate, and simple scroll but I can't seem to get
them to work together.

In this Example I want the Texture to spin in a circle and
the Org to be the center of the texture.

I also want it to scale so it grows bigger and smaller but
still spins from the center.  all I can make it do is spin.

In OpenGL it was easy I just applied the rotation Matrix.
This is the code I am using now.  Can anyone Help?

Thanks for any help : )

Device.SetTextureStageState 0, D3DTSS_TEXCOORDINDEX,
D3DTSS_TCI_PASSTHRU

Device.SetTextureStageState 0,
D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3 Or
D3DTTFF_PROJECTED

D3DXQuaternionRotationAxis qRotation, Vector3(0.5, 0.5,
1), (.TcRotate * (GetTickCount * 0.00001))

D3DXMatrixAffineTransformation MatRotate, ((nScaleX +
nScaleY) / 2), Vector3(0.5, 0.5, 1), qRotation, Vector3
(0.5 * nTransX, 0.5 * nTransY, 1)



Tue, 16 Nov 2004 04:19:05 GMT  
 Texture Transformations


Fri, 19 Jun 1992 00:00:00 GMT  
 Texture Transformations

Please help

Quote:
>-----Original Message-----
>I am having trouble with Texture Transformations.  I can
>scale, rotate, and simple scroll but I can't seem to get
>them to work together.

>In this Example I want the Texture to spin in a circle
and
>the Org to be the center of the texture.

>I also want it to scale so it grows bigger and smaller
but
>still spins from the center.  all I can make it do is
spin.

>In OpenGL it was easy I just applied the rotation Matrix.
>This is the code I am using now.  Can anyone Help?

>Thanks for any help : )

>Device.SetTextureStageState 0, D3DTSS_TEXCOORDINDEX,
>D3DTSS_TCI_PASSTHRU

>Device.SetTextureStageState 0,
>D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3 Or
>D3DTTFF_PROJECTED

>D3DXQuaternionRotationAxis qRotation, Vector3(0.5, 0.5,
>1), (.TcRotate * (GetTickCount * 0.00001))

>D3DXMatrixAffineTransformation MatRotate, ((nScaleX +
>nScaleY) / 2), Vector3(0.5, 0.5, 1), qRotation, Vector3
>(0.5 * nTransX, 0.5 * nTransY, 1)

>.



Fri, 19 Nov 2004 12:06:23 GMT  
 Texture Transformations
Are you sure this is D3DTSS_TCI_PASSTHRU  ? I would say it just uses the
"built-in" texture coordinates...

Patrice



Quote:

> Please help

> >-----Original Message-----
> >I am having trouble with Texture Transformations.  I can
> >scale, rotate, and simple scroll but I can't seem to get
> >them to work together.

> >In this Example I want the Texture to spin in a circle
> and
> >the Org to be the center of the texture.

> >I also want it to scale so it grows bigger and smaller
> but
> >still spins from the center.  all I can make it do is
> spin.

> >In OpenGL it was easy I just applied the rotation Matrix.
> >This is the code I am using now.  Can anyone Help?

> >Thanks for any help : )

> >Device.SetTextureStageState 0, D3DTSS_TEXCOORDINDEX,
> >D3DTSS_TCI_PASSTHRU

> >Device.SetTextureStageState 0,
> >D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3 Or
> >D3DTTFF_PROJECTED

> >D3DXQuaternionRotationAxis qRotation, Vector3(0.5, 0.5,
> >1), (.TcRotate * (GetTickCount * 0.00001))

> >D3DXMatrixAffineTransformation MatRotate, ((nScaleX +
> >nScaleY) / 2), Vector3(0.5, 0.5, 1), qRotation, Vector3
> >(0.5 * nTransX, 0.5 * nTransY, 1)

> >.



Sun, 21 Nov 2004 20:29:58 GMT  
 Texture Transformations
What this does is take the existing coordinates and applies
a Matrix over time.  it is used to add effect to the
texture.  The orignial coordinates are used as the
starting point.  

The rotation works great.  I have a problem when I try to
scale the matrix.  I want the texture to remain in the
center but grow according to the scale.

How would I add this after the rotation?

Quote:
>-----Original Message-----
>Are you sure this is D3DTSS_TCI_PASSTHRU  ? I would say
it just uses the
>"built-in" texture coordinates...

>Patrice




>> Please help

>> >-----Original Message-----
>> >I am having trouble with Texture Transformations.  I
can
>> >scale, rotate, and simple scroll but I can't seem to
get
>> >them to work together.

>> >In this Example I want the Texture to spin in a circle
>> and
>> >the Org to be the center of the texture.

>> >I also want it to scale so it grows bigger and smaller
>> but
>> >still spins from the center.  all I can make it do is
>> spin.

>> >In OpenGL it was easy I just applied the rotation
Matrix.
>> >This is the code I am using now.  Can anyone Help?

>> >Thanks for any help : )

>> >Device.SetTextureStageState 0, D3DTSS_TEXCOORDINDEX,
>> >D3DTSS_TCI_PASSTHRU

>> >Device.SetTextureStageState 0,
>> >D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3 Or
>> >D3DTTFF_PROJECTED

>> >D3DXQuaternionRotationAxis qRotation, Vector3(0.5, 0.5,
>> >1), (.TcRotate * (GetTickCount * 0.00001))

>> >D3DXMatrixAffineTransformation MatRotate, ((nScaleX +
>> >nScaleY) / 2), Vector3(0.5, 0.5, 1), qRotation, Vector3
>> >(0.5 * nTransX, 0.5 * nTransY, 1)

>> >.

>.



Mon, 22 Nov 2004 00:53:35 GMT  
 Texture Transformations
I gave this a try. Rotation and scaling works with the following code :

  D3DXMatrixIdentity Tm

    D3DXMatrixScaling m, Sc, Sc, Sc
    D3DXMatrixMultiply Tm, Tm, m

    D3DXMatrixRotationZ m, Angle
    D3DXMatrixMultiply Tm, Tm, m

But for now it seems I'm unable to add a translation...

Patrice



What this does is take the existing coordinates and applies
a Matrix over time.  it is used to add effect to the
texture.  The orignial coordinates are used as the
starting point.

The rotation works great.  I have a problem when I try to
scale the matrix.  I want the texture to remain in the
center but grow according to the scale.

How would I add this after the rotation?



Mon, 22 Nov 2004 19:23:11 GMT  
 Texture Transformations
D3DXMatrixScaling matscale, x, y, z
D3DXMatrixRotationZ matrotate, Angle
D3DXMatrixtranslation mattrans, x, y, z

D3DXMatrixMultiply matworld, matscale, matrotate
D3DXMatrixMultiply matworld, matworld, mattrans

thats what i did in my program. worked fine :)

Quote:

> I gave this a try. Rotation and scaling works with the following code :

>   D3DXMatrixIdentity Tm

>     D3DXMatrixScaling m, Sc, Sc, Sc
>     D3DXMatrixMultiply Tm, Tm, m

>     D3DXMatrixRotationZ m, Angle
>     D3DXMatrixMultiply Tm, Tm, m

> But for now it seems I'm unable to add a translation...

> Patrice



> What this does is take the existing coordinates and applies
> a Matrix over time.  it is used to add effect to the
> texture.  The orignial coordinates are used as the
> starting point.

> The rotation works great.  I have a problem when I try to
> scale the matrix.  I want the texture to remain in the
> center but grow according to the scale.

> How would I add this after the rotation?



Mon, 22 Nov 2004 20:18:51 GMT  
 Texture Transformations
Since then, I found I was testing with D3DTTFF_COUNT2 which probably
explains the problem (uses a 3x3 instead of a 4x4 matrix)....

Patrice



Quote:
> D3DXMatrixScaling matscale, x, y, z
> D3DXMatrixRotationZ matrotate, Angle
> D3DXMatrixtranslation mattrans, x, y, z

> D3DXMatrixMultiply matworld, matscale, matrotate
> D3DXMatrixMultiply matworld, matworld, mattrans

> thats what i did in my program. worked fine :)

[cut]


Mon, 22 Nov 2004 21:01:28 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Transformations, Transformations and more Transformations

2. DFM for Access for data transformations

3. Outlook HCI handling and Message type transformation

4. Transformation Word -> SGML

5. XML-XSL Transformation

6. Run SQL Data Transformation Pkg

7. Using GDI+ transformations

8. GDI+ and transformations...again

9. XML transformation

10. Anologe to Digital Transformation

11. Applying a reflection transformation to the Wang Image Edit Control

12. VB - > DLL transformation tool

 

 
Powered by phpBB® Forum Software