I would like to change the material/shader that my world space UIDocument is using to be displayed in the scene.
In Frame debugger I see it is using “Internal-UIRDefaultWorld” shader.
How can I display UIDocument quad with different material/shader.
I would like to change the material/shader that my world space UIDocument is using to be displayed in the scene.
In Frame debugger I see it is using “Internal-UIRDefaultWorld” shader.
How can I display UIDocument quad with different material/shader.
As of 6000.3.0a5 you can create UITK shaders using shader graph. I presume they work fine with world-space rendering, as nothing mentions otherwise.
As I understand they are talking about shaders for UI Toolkit controls.
When doing world space UI toolkit unity renders UIDocument to texture and than displays this texture on rectangular mesh in world space. I would like to use my own material/shader when displaying this texture on this mesh.
I’m not sure it does, it wouldn’t be zoomable like it is if it was an RT. Afaik border resolution scales to any zoom factor, because it’s a mesh rendering normally. You can see the meshes in RenderDoc.
You could use a uss filter at the root of your elements, which effectively passes them through an RT.
You might be right, previously we had to render to texture and now it is a single mesh with texture atlas.
Thank you for your answers, and I’m starting to think that my idea might be not worth the trouble.
This is correct. When the render mode is set to world-space, the mesh is rendered directly with the other scene objects, unless, of course, you use a filter for a subtree of visual elements.
But is there a possibility to swap Internal-UIRDefaultWorld to some other shader ?
Yes, as @vertxxyz mentioned, as of 6000.3.0a5, you can assign the material style with a custom shader. See this thread for more details.
I want to give it a try, I upgraded unity to 6.3.
But right now I have got a problem, what kind of shader Is used for UI toolkit filters ?
Can it be created with Shader Graph like shaders for VisualElements materials ?
I’m back to this topic right now.
I have created custom filter that is working.
Shader has this flags:
SubShader
{
Tags { "RenderType"="Opaque" }
Blend One OneMinusSrcAlpha
ZWrite Off
ZTest Always
Cull Off
Pass
{
As you can see ZTest is set to Always.
The problem is that this shader is probably only used when drawn to the RenderTexture and later this texture is drawn to the screen by Internal-UIRDefaultWorld shader. And this shader got ZTest LessEqual.
For now it is a handwritten shader. In the future we will add a ShaderGraph target.
Yes it is correct to use Always since it is only used for a post-processing step. The result will be drawn as a quad in the final RT with a non-filter shader (e.g. default UITK shader)