<div dir="ltr"><br><div>Some examples for TextureTransform:</div><div><br></div><div><a href="http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/#Chapter18TextureMapping">http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/#Chapter18TextureMapping</a><br></div><div><br></div><div><a href="http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/TextureTransform/index.html">http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/TextureTransform/index.html</a><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 8, 2018 at 8:42 AM Andreas Plesch <<a href="mailto:andreasplesch@gmail.com">andreasplesch@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Mirroring a texture works by scaling S by -1, eg. a texturetransform<br>
with a '-1 1' scale field. This requires repeatS='true' since S<br>
coordinates would be cut off, clamped at 0 otherwise.<br>
To allow repeatS='false' the S coordinates have to be also shifted to<br>
become positive. Since translation is applied _before_ scaling a<br>
translation of '-1 0' is needed. This is unintuitive but clear from<br>
the spec.<br>
Another way would be to have a center of scaling in the middle. This<br>
is accomplished by a '-0.5 -0.5' center field if the matrix<br>
multiplication formula in the spec. is applied literally which is what<br>
x3dom does.<br>
This center value is very hard to understand since the spec. explains<br>
the center point as the point about which scaling and rotation should<br>
be performed. The strange value is probably a result of the inverted<br>
ordering of transformation.<br>
There is a spec. note:<br>
NOTEĀ  This transformation order is the reverse of the Transform node<br>
transformation order since the texture coordinates, not the texture,<br>
are being transformed (i.e., the texture coordinate system).<br>
I do not quite understand the reasoning here. I understand that<br>
scaling by a factor of 2 results in a smaller image since then the<br>
image margin at uv=1,1 is now at the position where uv=0.5,0.5 was. I<br>
also understand that shifting u by plus 0.1 results in the image<br>
shifted to the left since the margin at u=1 is now where u=0.9 was.<br>
But I cannot find an argument why the _ordering_ should be reversed.<br>
Is it an opengl convention somehow ?<br>
The only way I can make sense of the center field is by mentally<br>
applying it as a translation before the scaling/rotation and then<br>
unapplying it afterwards, as the formula demands, not actually as the<br>
center of scaling/rotation. This explains why the center value has to<br>
be inverted from what it is expected (by me).<br>
It gets harder if you want to apply both a scale and a rotation. Since<br>
the rotation is applied before the scale, the scale will then deform<br>
the texture typically then into a sheared shape which is not what is<br>
typically wanted as an outcome.<br>
<br>
Any insights or references very welcome,<br>
<br>
-Andreas<br>
-- <br>
Andreas Plesch<br>
Waltham, MA 02453<br>
<br>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Nicholas F. Polys, Ph.D.<br><br>Director of Visual Computing <br>Virginia Tech Research Computing <br><br>Affiliate Professor<br>Virginia Tech Department of Computer Science<br></div>