CreatePreviewEventArgs model lacking UVs in SR12

working here with 8.12.24282.7001 on windows, and for an unknown reason, I am getting no UVs on any geometry when I use a ChangeQueue with the CreatePreviewEventArgs passed to CreatePreview, as I have been doing for a long time

the ChangeQueue implementation is the same one used elsewhere in my renderer, it loops over mapping channels or falls back to Mesh.TextureCoordinates and I am getting nothing from either

I have not seen this before, and am not seeing it in 7.37.24107.15001, so it seems like a recent change in v8, and I am wondering if anyone can shed some light on it

1 Like

@nathanletwory - is this anything you can help with?

As far as I can tell mapping channels have been coming through also in SR12, SRC13 and still internal 8.14.

I set RhinoCycles.VerboseLogging to true, add a pbr material, change its color and check RhinoCyclesShowLog.

I get

11/5/2024 7:27:20AM :: 00:00:00.0073852 |> 	ChangeDatabase ApplyMeshChanges, deleted 0
11/5/2024 7:27:20AM :: 00:00:00.0000005 |> 		ChangeDatabase ApplyMeshChanges added 7
11/5/2024 7:27:20AM :: 00:00:00.0094469 |> 	HandleMeshData: 2308 .. 2500
11/5/2024 7:27:20AM :: 00:00:00.0102605 |> 		HandleMeshData: mapping 0 TextureMapping: (unnamed) (-1) R0=(1,0,0,0), R1=(0,1,0,0), R2=(0,0,1,0), R3=(0,0,0,1)
11/5/2024 7:27:20AM :: 00:00:00.0067162 |> 	HandleMeshData: 1 .. 2
11/5/2024 7:27:20AM :: 00:00:00.0000171 |> 		HandleMeshData: mapping 0 TextureMapping: (unnamed) (-1) R0=(1,0,0,0), R1=(0,1,0,0), R2=(0,0,1,0), R3=(0,0,0,1)
11/5/2024 7:27:20AM :: 00:00:00.0000243 |> 	HandleMeshData: 811 .. 1000
11/5/2024 7:27:20AM :: 00:00:00.0000159 |> 		HandleMeshData: mapping 0 TextureMapping: (unnamed) (-1) R0=(1,0,0,0), R1=(0,1,0,0), R2=(0,0,1,0), R3=(0,0,0,1)
11/5/2024 7:27:20AM :: 00:00:00.0004679 |> 	HandleMeshData: 417 .. 500
11/5/2024 7:27:20AM :: 00:00:00.0000120 |> 		HandleMeshData: mapping 0 TextureMapping: (unnamed) (-1) R0=(1,0,0,0), R1=(0,1,0,0), R2=(0,0,1,0), R3=(0,0,0,1)
11/5/2024 7:27:20AM :: 00:00:00.0001258 |> 	HandleMeshData: 2803 .. 4000
11/5/2024 7:27:20AM :: 00:00:00.0000346 |> 		HandleMeshData: mapping 0 TextureMapping: (unnamed) (-1) R0=(1,0,0,0), R1=(0,1,0,0), R2=(0,0,1,0), R3=(0,0,0,1)
11/5/2024 7:27:20AM :: 00:00:00.0002170 |> 	HandleMeshData: 2214 .. 3516
11/5/2024 7:27:20AM :: 00:00:00.0000310 |> 		HandleMeshData: mapping 0 TextureMapping: (unnamed) (-1) R0=(1,0,0,0), R1=(0,1,0,0), R2=(0,0,1,0), R3=(0,0,0,1)
11/5/2024 7:27:20AM :: 00:00:00.0061164 |> 	HandleMeshData: 758 .. 1000
11/5/2024 7:27:20AM :: 00:00:00.0000173 |> 		HandleMeshData: mapping 0 TextureMapping: (unnamed) (-1) R0=(1,0,0,0), R1=(0,1,0,0), R2=(0,0,1,0), R3=(0,0,0,1)

Adding a breakpoint I see I get UVs after creating those based on the mapping (surface mapping).

@jdhill is this still a problem for you?

yes, I am on 8.13.24289.13001 here, I get mapping channels for the objects, but mesh.GetCachedTextureCoordinates(id) returns null, and when I try to fall back to mesh.TextureCoordinates the count is 0

in my code, however, I do not ever create any UVs, I just retrieve what is there, and your mention of “creating those” seems to imply you do something like this

is that what you mean?

(and would this be something considered safe/recommended to be doing all the time, in a changequeue?)

I don’t use SetCachedTextureCoordinates, but rather SetTextureCoordinates in RhinoCycles:

After that I access the TextureCoordinates like this:

What you are seeing could very well be result of work @Jussi_Aaltonen is doing, but he’s currently unavailable to further look into it.

The way I use in RhinoCycles is safe in the ChangeQueue, and I suppose also recommended (:

thanks, so in essence you use the mesh.TextureCoordinates as a scratch area, going one by one through the mappings

I have basically treated those as deprecated since forever, only using them if nothing else is available, and though in a changequeue I guess what we do doesn’t affect anything outside, I’d like to hear @andy’s opinion on using those vs. using SetCachedTextureCoordinates, since it is likely I’ll want to use the same code outside of a changequeue at some point, and will not want to disturb whatever someone has put in m_T for whatever reason (e.g. I see from time to time, people posting about issues with finding other coords than “expected” in an exporter or such), and SetCachedTextureCoordinates seems possibly a better choice for that reason

Hi @jdhill
I recommend using SetCachedTextureCoordinates and GetCachedTextureCoordinates. Your code snippet looks correct.

One thing to keep in mind: you should read the UVs from the returned coords object before you call SetCachedTextureCoordinates again on the mesh.