Texture transforms

Hi to all,

I’m trying to use the transform entry in a file to manipulate a texture. This is the format I’m using:

<Texture> Texture_81.0.0 { 
 /c/Panda3D-1.7.2/image_file.jpg
 <Scalar> uv-name { VP_81.0.0 }
 <Transform> { 
 <Translate> { 0.10000000149 0.10000000149 }  
 <Rotate> { 2.0 }  
 <Scale> { 1.0 2.0 } 
 } 
 }

And then, I reference the above texture like this:

<Polygon>
{
...
<TRef> { Texture_81.0.0 }
...
}

But nothing happens, when I view the file, the texture is just blank:


When it should look like this:


Those transform values I am writing to the file are as a result of manipulating the texture within the app like this:

activ_nod.setTexOffset(...)
activ_nod.setTexRotate(...)
activ_nod.setTexScale(...)

As for the values of the UVs before the transforms in the app, i use these, four at a time [to make a quad]:

10
11
01
00

So why does the file version look different from the procedural version? If anymore information is needed, please do ask.

Hmm, does it work correctly without the element? Keep in mind that the order of transforms matters, so try changing the order of the different components in the element. I believe scale should be applied first, and translation last.

Removing the entry has no effect and neither does changing the order of entries; writing it like this:

<Scale>
<Translate>
<Rotate>

Causes no effect and the model still looks the same. If it helps, I’ve uploaded a small file, consisting of 2 cubes that has this same issue. It’s an actor file, and to view both cubes at a distance of each other:

cube= Actor("108_p3d_83.0.0.egg")
cube.reparentTo(render)
j2="Joint_83.0.1"
ddd=cube.controlJoint(None,"modelRoot",j2)
ddd.setPos(50,0,0)

[Because they are superimposed on each other].
108_p3d_83.0.0.egg (9.11 KB)

The texture transforms have nothing to do with the issue. You’re using named UVs, and they haven’t been bound to the texture stage. It should look like this:

<Texture> Texture_83.0.0 {
  /c/Panda3D-1.7.2/the_image.jpg
  <Scalar> uv-name { VP_83.0.0 }
}

If it can’t find the UVs, there’s nothing to transform. :slight_smile:

Thanks, but even that seems to have no effect. :frowning: Doing this:

 <Texture> Texture_83.0.1 { 
 /c/Panda3D-1.7.2/the_image.jpg
 <Scalar> uv-name { VP_83.0.1 } 
 <Transform> { 
 <Scale> { 2.0 2.0 }  
 <Rotate> { 4.0 }  
 <Translate> { 0.10000000149 0.10000000149 } 
 } 
 }

Doesn’t do anything:


Does it show the texture for you? Anyways, if this persists, I suppose for now I’ll just stick to the procedural version. (The only reason I resorted to writing files was to make it easier to manipulate animations, and to avoid an apparent conflict in motion between changing a model’s Hpr (especially the heading) while concurrently changing a camera’s Hpr ( especially the heading too) .)

No, it didn’t show the texture for me, because the polygons in question don’t have a referencing the texture. Once I added that, it showed up a texture.

Okay, it’s all good though since the procedural version works just as well. At least I’m continuing to learn and implement panda’s different cool features! :smiley: