gizmos icon indicating copy to clipboard operation
gizmos copied to clipboard

Rendering issues with Universal Render Pipeline

Open RunninglVlan opened this issue 6 years ago • 22 comments

This is not related to your package specifically, but maybe you know some info on how to fix it. Recently I added RenderPipelineManager.endCameraRendering to this package for rendering with Unity's Rendering Pipelines, but using this delegate Gizmos are incorrectly rendered in Game view. Here is a comment in Unity post and a question with details. Noone has made any comments yet =(

RunninglVlan avatar May 10 '19 09:05 RunninglVlan

New comments added in post and question. Got it to work when using default values for LWRP asset

RunninglVlan avatar May 10 '19 13:05 RunninglVlan

I'm not using LWRP, but I saw people on the forum stating the same issue and that it might be a bug.

https://forum.unity.com/threads/gl-lines-and-gl-functionality-with-lwrp.618985/

popcron avatar May 10 '19 16:05 popcron

Also to note, GL is deprecated in SRP

popcron avatar May 10 '19 16:05 popcron

Also to note, GL is deprecated in SRP

Where did you find that? I did a quick search and found no information about it.

RunninglVlan avatar May 13 '19 06:05 RunninglVlan

I misread the original post, they're deprecating the rendering callbacks, not GL entirely. At https://forum.unity.com/threads/gl-lines-and-gl-functionality-with-lwrp.618985/#post-4191136

popcron avatar May 14 '19 04:05 popcron

Yes, here's more info about it: https://forum.unity.com/threads/feedback-wanted-scriptable-render-pipelines.470095/page-8#post-3408481

RunninglVlan avatar May 14 '19 06:05 RunninglVlan

After checking with SRP 7.1.1, it works. In order to get this package from the pacman, the editor needs to updated to 2019.3.x

popcron avatar Sep 25 '19 20:09 popcron

Tested Unity v2019.3.0b5 with Universal Render Pipeline v7.1.2. Unfortunately it still doesn't work correctly. image This is how it renders in Game view if either HDR is set to true, Anti Aliasing (MSAA) is set to anything but Disabled or Renderer Feature is added to Renderer, currently there's only one - Render Objects (Experimental).

RunninglVlan avatar Oct 03 '19 15:10 RunninglVlan

That can likely be resolved by changing the shader to something that respects depth because I'm pretty sure this was always a thing.

The more important part is that GL works with 7.x

popcron avatar Oct 03 '19 18:10 popcron

You mean you recognize this as a bug in Render Pipeline and have some ideas on how it could be fixed? Maybe you could then contact them somehow =) Through some bug tracker, forums, emails, I don't know... We'd be happy if this would be fixed.

RunninglVlan avatar Oct 03 '19 18:10 RunninglVlan

I don't think the z ordering issue is a bug with unity, its more likely that the shader simply ignores depth. I can't test any time soon but try setting the material to a default diffuse or anything that is known to respect z order.

popcron avatar Oct 03 '19 21:10 popcron

But why it ignores it only in Game view and only with those specific setting values? I tested different materials, not one of them fixes the issue in Game view. Some of them brought rendering issue to Scene view. =D

RunninglVlan avatar Oct 04 '19 08:10 RunninglVlan

Makes sense, are you able to tell if it's an issue inherent to GL?

popcron avatar Oct 04 '19 17:10 popcron

I don't think it's related to GL, the problem appears only using RenderPipelineManager.endCameraRendering. Without it everything renders OK as I described in question

RunninglVlan avatar Oct 04 '19 17:10 RunninglVlan

Can GL still render if that callback is replaced when using SRP? If it does then submit it as a PR and I'll merge it.

popcron avatar Oct 05 '19 01:10 popcron

Sorry, didn't quite understand you. What do you mean by "that callback is replaced when using SRP"? If GraphicsSettings.renderPipelineAsset is empty and Camera.onPostRender is used, everything works fine.

RunninglVlan avatar Oct 07 '19 08:10 RunninglVlan

Hmmm, its rendering on top because of the endCameraRendering which is equivalent to onPostRender. Does beginCameraRendering work? I can't really test any of this because I have school work to do, all I can do is speculate.

popcron avatar Oct 09 '19 17:10 popcron

It's OK to speculate, I guess you have more experience in the subject matter. But no, beginCameraRendering doesn't help. Maybe this way it renders before everything else.

RunninglVlan avatar Oct 11 '19 08:10 RunninglVlan

Latest status: Gizmos render correctly in Game view with following settings in UniversalRenderPipelineAsset:

  • In Quality: Disable HDR and Anti Aliasing (MSAA)
  • In ForwardRendererData asset: Remove Renderer Features

and in Camera:

  • In Rendering: Disable Post Processing

Tried changing Material on which SetPass is called, as I thought maybe default shader Hidden/Internal-Colored is not compatible with URP, but to no avail.

RunninglVlan avatar Oct 29 '19 12:10 RunninglVlan

I asked about the issue in Unity forums, and Unity developer said that we need to implement our own ScriptableRenderPass. I understood how to create one, but then also the thing that I don't have a clue about CommandBuffers and such, i.e., I don't know how to implement feature pass. ScriptableRendererFeature can be created using Create/Rendering/Universal Render Pipeline/Renderer Feature. Unity has an example pass. Do you know anything about CommandBuffers? =)

RunninglVlan avatar Nov 04 '19 14:11 RunninglVlan

I believe you have to create a new command buffer at the event and then pass it to the context to execute. Lastly you have to release the buffer (equivalent to dispose). Catlike has a page on custom srp with an example of command buffers.

Also that's quite a very specific set of requirements to make it work correctly eh.

popcron avatar Nov 05 '19 13:11 popcron

Problem is the depth/stencil buffer target is not preserved somehow when AfterCameraRender is called producing everything executed at that stage to render on top. It should be fixed/improved so a simple Graphics.DrawMesh called in AffterCameraRender works as usual. That will be super useful and will make migration easier. Problem with Scriptable Features is that they require additional boiler plate and client-dependant setup which is a very bad design approach to solve a problem IMO. For many use cases, we just need to make direct draw calls after everything is rendered as before regardless of the pipeline!

Oddly enough, the result changes if Opaque Texture is enabled or disabled in LWRP asset settings.

kronnect avatar Nov 10 '19 09:11 kronnect