How can I set the color of the thin instance while using this custom material to set the tile?
Also, how can I get this working when the texture is used for both diffuse and opacity?
For the color part, I got it to green. https://www.babylonjs-playground.com/#KWVY94#7
There is a square character in line 52
I shouldve been more specific. I need to be able to color thin instances using the color attribute of the thin instance.
I think I need a different way of setting the uv offset, but my shaders skills are a bit lacking.
You can simply multiply baseColor by vColor:
Thanks Evgeni. Is there a way to get that custom material to work when the texture is also set to the opacity texture?
Do I need add similar code to Fragment_Custom_Alpha?
This one is a little more involved because there’s no simple way to inject some code just after the alpha texture has been sampled.
You can use a feature that allows to tamper with the shader source code just before it is sent to the GPU to replace the alpha sampling code by your own (lines 51-64):
You can also write your own shader with
ShaderMaterial but it’s even more involved.
You could also write a node material in the NME, using for eg uv2 to hold tileOffset.
Man, you are a wizard. Thanks!