[x3d-public] xxxTextureMapping "C1T3"

GPU Group gpugroup at gmail.com
Fri May 6 06:04:13 PDT 2022

My experience implementing Material.xxxTextureMapping
Material.diffuseTextureMapping "C1T3"
TextureTransform.mapping "3"
TextureCoordinate "1"

I started with my usual confusion and followed with a few re-writes before
I settled on 'combos': the texcoords the vertex shader now sends the frag
shader is a combination of any of the shape's texturetransforms with any of
the shape's texturecoordinates.
In gltf valances look like this:
texture m:1 texcoord   many textures can refer to the same texcoord, each
texture refers to one texcoord
texture 1:(0,1) textrans - a texture may have one texture transform. A
texture transform belongs to one texture (its duplicated for each texture
that needs it)
When converting to x3d I decouple the texture transform and for fun compare
to already existing texture transforms in the shape to reduce duplicates.
Then for the texture I assign "C0" or "C1" up to "C3" for the
.xxxTextureMapping string, and if the Texture has textureTransform I append
"T0" uo to "T9"  to the mapping string.
During shape rendering, I detect if the xxxTextureMapping string has that
pattern and if so split it to get the separate texcoord "0" to "3" .mapping
string and the "0" to "9" textrans mapping string. I look up in a
icombo[10][2] array if I already have that combination, and if not add it,
and then assign the icombo index to the texture for sending to the frag
shader, and send the icombo array to the vertex shader to make the combos
and send in order of icombo array to the frag shader as transformed
I don't know how common it is for an artist and authoring tools to have
gotten creative with both texcoords and textrans for a given texture. The
above technique thunks to the as-written spec when no Cn or Tn detected.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220506/416d870e/attachment.html>

More information about the x3d-public mailing list