Will we be supporting Vector 4 in UV0 or UV1 for mesh input?

I noticed according to the documentation in the link below, UV0/UV1 both support only Vector2. Our meshes have additional values in UV0 using a Vector4. Is this something that we plan on supporting? Should we consider moving the data to UserAttribute?

https://docs.unity3d.com/Packages/com.unity.polyspatial.visionos@0.4/manual/ShaderGraph.html

This is a platform limitation, unfortunately; RealityKit only supports Vector2 for UV0, and its MaterialX nodes to retrieve the texture coordinates only support Vector2 and Vector3. So, it might be possible to use Vector3s for UV1 (I don’t think we’ve actually tested it), but Vector4s are not supported.

“UserAttribute” is supported as a custom interpolator, but it doesn’t allow accessing arbitrary vertex attributes. RealityKit’s vertex attributes are basically limited to the ones in their documentation (plus an undocumented UV1 channel).

Thanks for the prompt reply,

This means we cannot write values to the “UserAttribute”?

We do build our meshes into assets. If we don’t need the color, would it be ok to then write the mesh’s UV0 into Color, and mesh’s UV1 split between the new UV0/UV1.

Color should work?

It means that you can use UserAttribute within a shader graph as an interpolator (to pass data from the vertex stage to the fragment stage), but that doesn’t provide a way to add UserAttribute values to meshes that you can read in the shader graph.

Yes, this should work, although we transfer the colors as 32 bit values (Color32), so you may have issues with precision or range.

Got it. Is the precision for UV0/UV1 float?

It is, yes (single precision floats).

Another issue I’m seeing is that I don’t seeing UV1.xy Data on simlulator. It works in editor where I see UV1.xy, however, UV0.xy is what shows up when I run this on simulator.

This shader is with shader graph.

Ah, yes. That started happening because of a change in visionOS from version 3 to 4, but we have a fix for it that will come out in the next release.

2 Likes