Can't seem to get correct uv attribute from vertex shader and pass to fragment when using MaterialPluginBase

The output of the shader should be a gradient when using UV but is currently black.

When I manually edit the vUV value to be vec2(1.0, 0.0); for example, that works, but using the uv attribute does not work.

I’ve tested this on multiple models but cant seem to make it work.

Any help is appreciated.

I know how to make it work but not really sure why.

Just add an albedoTexture to enable the define UV1.

Though the mesh have vertices data on uv channel before I add the texture, but declare “attribute vec2 uv;” by hand not work.

Because you don’t set any texture on your material, the uv data are not automatically passed to the shader. You should implement a getAttributes method to your plugin to add the “uv” attribute to the list:

1 Like