With the deep changes to the Batching code I was hopping that now we get able to use the Normal and Tangents to send extra per-vertex floats to the shaders.
However it seems that the current batching is still multiplying them by the normal matrix.
Its there any new shader or material flag to disable that transform?
That will allow using custom materials with per-vertex settings.
Currently only 3 floats can be used (uv2.xy and Tangent.w)
I also tried filling uv3 and uv4 on the UI mesh, but it seems those streams are discarded. Its that by design or a bug?
There is not currently, if we implement this it would either be a flag on the canvas renderer or a flag on the whole canvas. Which would be preferable for you and why?
This is currently by design. To start with we just wanted to get the framework working. Adding in the extra channels makes the whole mesh generated for the Canvas take more memory (we have to add the channels for the whole batch). We will in the future most likely allow you to specify which channels get used, but this will be for a future release.
It should be a flag on the CanvasRenderer for specific submeshes as it could happen that some of the materials used on the Canvas may need to adjust the normals for lighting.
Ideally it should be a flag set on the shader or the material.
Similar to the #pragma glsl_no_auto_normalization in the shader to avoid normalizing the normals, or the DisableBatching SubShader Tag.
When the CanvasRenderer gets that material it could read the flag and use it.
It can even use the existing “Lighting off” setting on the material. As its my understanding that its discarded when the material is not a fixed function. And in the case its a fixed function, then Lighting off/on should as well disable/enable the normals/tangents processing.
Most UI shaders don’t need normals for lightings (Specially the unlit ones ), so that’s a flag that can be enabled by default to avoid all that processing when not needed.
Good point! Having the Normal and Tangent vectors available should be enough for most cases.
Do you think this change will make it for 5.2 or will it be pushed to a future version?
Allowing using the normals/tangent to store extra per-vertex info will certainly open the doors for lot of cool effects and material modifications for the UI!
That’s understandable!
I thought I was going to be just changing the “if” that modifies the normals to be based on the fixed-function Lighting setting of the material and not based on whatever the material requires normals or not. But its never that easy, right!?! haha. And I’m sure the new batching code optimization makes it even more complex!
I hope this feature be considered for the release after 5.2.
We haven’t been able to move into the new UI several of our projects as we are using a custom Signed Distance Field that requires extra per-vertex parameters for having extra effects like gradients in the outline, a better bevel, more control in the UV of normalmaps, outline and glow textures, etc.