Is it possible to access multiple UV maps beyond uv1?

Hi there!,
I’m working on a project that requires the use of lightmaps generated from unreal engine and exported to glb. Taking some inspiration from https://github.com/ue4plugins/GLTFWebViewer I’ve got my own version of that working quite nicely however it depends on uvs sets above uv1 which doesn’t seem to be supported and as a result there are a number of broken materials. I did a local hackfix to make the shader generate the code to access the additional uvs sets which seems to work.

My question is, is there an official way to either

  1. get access to the uv2,uv3 uv4 etc
  2. enhance the original shader to get access to them so i can fix it without needing to modify playcanvas itself?

Thanks for your time

Ηι @Adriaaaaan and welcome,

You may be able to create a custom vertex format to support additional UV channels. I think there was discussion about this before.

@mvaligursky may be able to help here.

I don’t believe standard material has a way to use more than 2 uv channels at the moment.
Custom shaders should be ok to use it though.

I assume you’re after the standard shader path? Perhaps create an engine issue … there’s a bigger refactoring of the standard shader taking place for the node graph implementation, perhaps this can be done during that work as well.

1 Like

By custom shader I’m guessing you mean totally replacing the shader in its entirety? Since its a large glb with a lot of materials that probably isn’t viable since i presume there will be differences between each one.

I’ll add an issue on the engine, any ideas on how long the refactoring might take? I can probably patch it in again (I’m already having to do that for an unrelated breaking bug)

Yes I meant totally replacing shader, which is a good way for some things, but not for PBR rendering.

Refactor will take a while, and this might not be part of the initial work on it. If you have some generic code, perhaps share that so we can investigate some easier path?

its a PBR shader yes. In my monkey patch I just upped the max number and went through copying all of the uv init code to do the others. Frustratingly a lot of the basics are already there

2 Likes

Sorry for reviving an old topic, but it looks like I couldn’t find any. We recently got a need in more UV channels support. Before I jump into inventing a wheel, I wanted to check if there was any change in this.

@Adriaaaaan is monkey-patching and copying UV init code still the way for you?

There was some work on it done a while back, but I’m not 100% of the state. The ticket is still opened so it might not be fully done. Follow up some links from there: Add support for additional UV channels · Issue #3975 · playcanvas/engine · GitHub

You might remember this that could be useful here: Custom attributes on material's shader definitions. · Issue #3485 · playcanvas/engine · GitHub

1 Like