Closed pmolodo closed 5 years ago
I fixed all the issues regarding uv translation and setting up the wrapping/mirror parameter.
There was some work already regarding wrapping and mirroring, but it looked for the wrapping and mirroring parameters on the file node, not the place 2d node, so I had to update that code. Also, the default value for wrapping should be Clamp, not Black. Besides this, setting up the wrapping/mirroring only in the material converter is not enough, as HdSt relies on the scene delegate setting up texture resources and IDs, so we have to take wrapping/mirroring into account when calculating the texture id and when returning the resource. UV translation is good, and it matches how usdMaya exports/imports uv values. I just had to change the origin of the created glf image to match the viewport one.
Note, there was a bit of confusion regarding this issue. @elrond79 was testing by exporting shader definitions via our shader exporter and previewing them in usdview, while I was using MtoH in the viewport. That messed up my debugging a bit, and reading the wrap/mirror parameters from the place2d texture node is totally redundant, so I restored using the file node.
Specifically, the V-direction seems to be flipped. I think pixar made some recent USD changes related to UV v-direction, we probably need to update to accommodate.
Reproduction scene attached...
Also note that UV wrapping settings are not translated... while I think we could do this, with the current wrap settings on their file reader preview node, we may also want to wait until Pixar implements their proposed Translate2D node...
cube_texture.ma.zip