[x3d-public] texture transform ordering

Nicholas Polys npolys at vt.edu
Wed Aug 8 12:37:33 PDT 2018


Some examples for TextureTransform:

http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/#Chapter18TextureMapping

http://www.web3d.org/x3d/content/examples/ConformanceNist/Appearance/TextureTransform/index.html


On Wed, Aug 8, 2018 at 8:42 AM Andreas Plesch <andreasplesch at gmail.com>
wrote:

> Mirroring a texture works by scaling S by -1, eg. a texturetransform
> with a '-1 1' scale field. This requires repeatS='true' since S
> coordinates would be cut off, clamped at 0 otherwise.
> To allow repeatS='false' the S coordinates have to be also shifted to
> become positive. Since translation is applied _before_ scaling a
> translation of '-1 0' is needed. This is unintuitive but clear from
> the spec.
> Another way would be to have a center of scaling in the middle. This
> is accomplished by a '-0.5 -0.5' center field if the matrix
> multiplication formula in the spec. is applied literally which is what
> x3dom does.
> This center value is very hard to understand since the spec. explains
> the center point as the point about which scaling and rotation should
> be performed. The strange value is probably a result of the inverted
> ordering of transformation.
> There is a spec. note:
> NOTE  This transformation order is the reverse of the Transform node
> transformation order since the texture coordinates, not the texture,
> are being transformed (i.e., the texture coordinate system).
> I do not quite understand the reasoning here. I understand that
> scaling by a factor of 2 results in a smaller image since then the
> image margin at uv=1,1 is now at the position where uv=0.5,0.5 was. I
> also understand that shifting u by plus 0.1 results in the image
> shifted to the left since the margin at u=1 is now where u=0.9 was.
> But I cannot find an argument why the _ordering_ should be reversed.
> Is it an opengl convention somehow ?
> The only way I can make sense of the center field is by mentally
> applying it as a translation before the scaling/rotation and then
> unapplying it afterwards, as the formula demands, not actually as the
> center of scaling/rotation. This explains why the center value has to
> be inverted from what it is expected (by me).
> It gets harder if you want to apply both a scale and a rotation. Since
> the rotation is applied before the scale, the scale will then deform
> the texture typically then into a sheared shape which is not what is
> typically wanted as an outcome.
>
> Any insights or references very welcome,
>
> -Andreas
> --
> Andreas Plesch
> Waltham, MA 02453
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>


-- 
Nicholas F. Polys, Ph.D.

Director of Visual Computing
Virginia Tech Research Computing

Affiliate Professor
Virginia Tech Department of Computer Science
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20180808/19cefda4/attachment.html>


More information about the x3d-public mailing list