Custom uv settings for each instance

Hello guys,

I am creating a model out of multiple wooden beams. The beams are just instances of my main beam wherefore they share the same material. To make them look more natural I would like to give them some randomness due to different uv scales and offsets. Am I able to do that?


It seems that the answer to your question could be found here: Different texture per mesh instance using instance buffers?


Thank you labris!

That is definitely I was looking for. I am not sure why I didn’t find this post on my own.

Any idea why PBRCustomMaterial leads to errors?

The customization are added into the shader code. PBR shader code has different variable namings. uvUpdated is not declared in PBR shader. You can check pbr shader code here:

pbr vertex shader

pbr fragment shader

I am not expert on pbr and pbr shader code. But a quick test that shows different texture:

But for albedoTexture, I don’t find appropriate customization hook point where you can change uvOffset before albedoTexture:

1 Like

There’s no hook point before reading from the albedo texture that would let you change the uvOffset used for the lookup in the texture.

What you can do is creating a node material and using a bit of code to inject a custom attribute in it:

1 Like

I was able to use custom uv coordinates due to the node material, but unfortunately I cannot make it pbr.

You missed to connect a reflection block to the PBR block. Also, you should use the lighting output instead of the diffuse one, as you only use an environment light:

1 Like