I’m working on an application that uses Cycles to do pretty renders for my realtime scenes.
Based on code snooping and the standalone application, I’ve got the basics working, like geometry and I believe shaders as well.
Now I’m having some issues using UVs on the geometry. On the image below (1), the small window is Cycles, the larger viewport is a realtime visualization of the scene. As it is clear, the UV mapping is not working. I know it is the UV map because if I change the texture to a block color of some sort, the Cycles rendered image changes accordingly (for example, if the cube uses a full red texture, it becomes red in both the realtime and the Cycles viewport, which leads me to assume that all the UVs are being set to zero).
I created a shader graph with Blender that does what I want (2):
And I translated that into code (3):
This seems to be correct, as far as I can understand the API.
So the problem is probably related to the geometry itself, but that also seems to be correct (4).
I create an extra attribute in the mesh, of type ATTR_STD_UV, with name “UVMap”, and I fill it with for every triangle in the geometry.
(sorry about the big image, you’ll have to open in new tab to be able to read it, can only upload one image per post)
I’m a bit out of ideas, so if anybody has any idea on what I’m doing wrong, or even just a suggestion on how to look for the issue, I’d appreciate it!