How to change the render queue?

Hello guys, I was making a screen UV distortion shader and noticed particles were not been displayed through it correctly. The render queue of that shader graph is 3000, I guess that was the point, however, I don’t know where to assign that number in the shader graph. Can anyone help?

There are several things to break down in this question.

First thing, Shader Graph does not give any explicit control over the Render Queue, only implicit based on the rendering mode drop down: Opaque (uses queue 2000, aka Geometry) and Transparent (uses queue 3000). Ideally opaque objects using a non 1.0 alpha threshold should be using the AlphaTest queue (2450), but that doesn’t appear to be the case. (That’s a potentially significant performance issue for mobile.)

You can however override the queue on the material directly if needed.

But that doesn’t address the real issue you’re having of particles not showing up when using the scene color node to do diffraction. Unfortunately this is by design. Both the LWRP and HDRP make a copy of the scene after the opaque render queues have finished that gets fed into shaders that want to access the scene color. This means any thing rendered as part of the transparent queues won’t be visible, and it’s not really advisable that you move your particle effects into the opaque queue as it can cause rendering order issues.

From a quality perspective, this is an obvious step back compared to the Grab Pass based diffraction used in the built in rendering paths. However this is being done this way because it’s significantly more efficient.

Thanks for your insights @bgolus

Regarding the copy order, doesn’t it mean lots of overlay shader/ image effects are not going to work anymore? That could be a huge impact, I wish they could fix it somehow:(

Shader Graph does not support making shaders for image effects or UI at the moment. However most unlit shaders work perfectly fine with the LWRP and HDRP. Image effects however are all completely broken since they’ve changed how those work for the SRPs. The “OnRenderImage” function most old image effects use simply never gets called when using an SRP. The Overlay queue was completely removed early on, but may have been added back in, I’m not entirely sure.

In case someone needs this, Shader Graph now has a new checkbox on the HDRP master node, it provides two extra output channels called “Distortion” and “DistortionBlur”. Distortion is literally a distortion effect so you can make use of it with a mask texture and scene color, works as expected. Distortion blur is an HDRP bloom-ish effect, it’s a vector1 from 0 to 1, so maybe you can use it on UI blur or refraction stuff. There’s another value named “sorting priority” and basically it just adds the number to the shader queue, neat!

(Hi Unity guys, thank you for bringing these. Perhaps making that priority as output would be more useful?)

Hello zhuchun,

Could you please post a picture showing how you use the Distortion in the shader graph? I can’t make it work, I am trying to do a refractive object, but I can’t figure out how to use it.

Regards,
Carlos

Here you go, but I’m not sure if this setting is specified to HDRP

Hello zhuchun,

I appreciate your help very much! But I was asking about what is connected to the Emission node in order to make it work? I have tried all kind of inputs there but nothing distorts

Regards,
Carlos

For example, if you’re going to make a shock wave, then you can connect a node named “Scene Color” to emission output, and distortion output would be conneccted to your noise texture, like a cloud or twirled annulus, etc. I hope this snapshot makes it clear.

Thank you so much! That helped a lot, this is great!. I appreciate your help very much.

Regards,
Carlos

How??

This is near the bottom of any material using a URP Shader Graph shader.
5548732--571231--upload_2020-3-3_22-21-42.png

If you’re using HDRP this doesn’t exist and you can’t really modify the queue. But you can adjust the priority and other settings related to the order it gets rendered.

Nah, I don´t use graph shader, i thought there was a way to do it from Inspector Window top right button → Debug, but everytime I go back to normal the change is lost. I know how to change the shader code manually, just wondering if there was a built-in way from editor. Thank you anyway for your fast response.

This is the Shader Graph subforum, so questions asked will be presumed to be related to such.

If you’re using built in shaders, Unity chose not to expose the render queue to the inspector and instead set it to fixed queues based on the render mode. The queue is still being changed, just overridden by their custom inspector as soon as you swap back.

Hi there, I know I’m a bit late although I was having the same problem. But I managed to find a solution for it. If you want to change the renderqueue of the shader in the shader script, you need to choose either Transparent or Geometry (or others) and add a +x behind it. (x being whatever extra number you’d like). For example: Tags { “Queue” = “Transparent+2000”}

I hope this is helpful.

Is there a way to modify the render queue in a Shader graph (not using URP nor HDRP) ?? Thanks!

the material of a shader graph seems to expose a render queue property

8349093--1098555--upload_2022-8-9_18-19-2.png

Am I blind?

8879376--1213008--Screenshot 2023-03-15 at 21.45.10.png

[EDIT:] I updated Unity from 2022.1.19 to 2022.2.11 and now the Advanced Options appear. Weird.

Maybe a little late but for future user you can show all inspector properties by change the inspector to debug view. then you will have access to app properties.

Can you guys change the render queue on the debug inspector? If I change it it just goes back to its previous value :confused:

Update: Issue being tracked here Unity Issue Tracker - "Custom Render Queue" field cannot be set above "2000" when changing it in the Inspector window using Debug mode

Also, it would be great to be able to set the default render queue for a shader on shader graph. If a shader is always supposed to be used on a specific render queue (in my case, 2501 to be rendered right after the skybox), having to set that on the material every time is likely to be forgotten and cause issues.