Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Custom SRP and Editor Support

Discussion in 'Graphics Experimental Previews' started by Andrew-Carvalho, Aug 7, 2018.

  1. Andrew-Carvalho

    Andrew-Carvalho

    Joined:
    Apr 22, 2013
    Posts:
    45
    I am working on a custom deferred renderer pipeline and have mostly wrapped my head around getting the very basics working. My graphics code skills are a bit rusty but I have just completed my first goal which is a single deferred pass followed by a final pass. While not impressive, I'm happy with the progress but have hit a stumbling block along the way.

    Before I continue with the pipeline (lighting is my next step) I want to fix the handful of errors I'm hitting in editor. I've got the scene view rendering as expected but am having issues with some gizmos and the preview cameras.

    I've gone digging through the existing pipelines to try and find anything related to special handling of these cases but haven't really found anything.

    Specifically, the camera gizmo and both give "Dimensions of color surface does not match dimensions of depth surface". I am currently using Shader.PropertyToID and "_TempCameraDepth" and "_TempCameraRT" to bind to my renderpasattachments which makes the scene view work and stops errors in the previews though they don't render either.

    Does anyone have any examples of a simple render pipeline (ideally deferred) working with the editor? I've attached some images of what I'm seeing.

    This is the camera gizmo, rendering the preview in the corner of the viewport and upside down. camera gizmo.PNG

    Here is a material with a broken preview, both to the left of the name as well as the preview pane at the bottom.
    inspector preview.PNG
     
  2. Andrew-Carvalho

    Andrew-Carvalho

    Joined:
    Apr 22, 2013
    Posts:
    45
    Update:
    I was blitting the depth for the scene camera but not the preview camera. Turning that on got the preview working, though it's currently looking a little funny due to the pipeline being wip. I attachd an image (the pipeline is currently just rendering out the world normals).

    preview.PNG

    The camera gizmo, however, is doing it's own thing and throwing the depth/colour dimension error.

    UPDATE:
    I've poked around a bit more and realized that the camera gizmo renders with a cameraType of Game, so it's running through my pipeline in full with no special cases for the scene or preview.

    I imagine this is where the issue is coming from; the camera gizmo may require a magic reference, much like the scene view's "_TempCameraRT" and "_TempCameraDepth" shader properties, but I don't really have a way to catch it, nor do I know what those properties are.

    If it's the case that there are no special properties that the gizmo uses, I'm at a loss as to why the Game view renders without issue and the camera gizmo preview seems to be very broken.

    UPDATE 2:
    So I realized my pipeline doesn't currently support render textures and that is why the preview is breaking. I realized this when I looked at the camera in the debugger and noticed it's use of a dynamically created render texture. Throwing a RenderTexture on the main camera, my game view also breaks with the same error. Hopefully adding support for this fixed the camera giamo once and for all and I can focus on the more minor editor issues (like supporting the different scene view rendering modes).

    UPDATE 3:
    So I went back to look at why render textures were breaking and when I bound my surfaces to the camera and depth attachments, I would store them for the camera target attachment but not for the depth, hence the mismatch.

    That was on me, missing something pretty simple. I no longer have errors but the camera gizmo also isn't rendering anything. This is also true for a render texture I attach to my camera (it doesn't update as I move objects around anymore). It's better than being broken but clearly it is still upset about something? I attached it below along with the game view I expected to see in the preview.

    preview2.PNG

    At this point with no more errors being thrown, I'm not sure what could be the issue. Any ideas?
     
    Last edited: Aug 14, 2018
  3. namanam

    namanam

    Joined:
    Jul 27, 2013
    Posts:
    8