Unity-Technologies / com.unity.perception

Perception toolkit for sim2real training and validation in Unity
Other
906 stars 175 forks source link

Support for 2022.2? #531

Closed enickel00 closed 1 year ago

enickel00 commented 1 year ago

First off, a big thanks to all the developers working on this project. This has been a big aid to quickly training new vision models and has given us the ability to experiment quickly with different CNN designs.

I've been using the perception package successfully with Unity 2021.3 for some time now. However, I'd like to switch to 2022.2 because this release has a denoiser built in for the pathtracing renderer. When I make a new HDRP project in 2022.2 and import the perception package I get the following error in the console:

Library\PackageCache\com.unity.perception@0.11.2-preview.2\Runtime\GroundTruth\RenderPasses\CrossPipelinePasses\GroundTruthCrossPipelinePass.cs(55,19): error CS0246: The type or namespace name 'RendererListDesc' could not be found (are you missing a using directive or an assembly reference?)

When I look up that code I see that RendererListDesc is being used, but Unity is having an issue finding it. Perhaps the package which this belongs to has changed, and I need a new 'import' statement at the top of the code? Not exactly sure, and I'm not a programmer by background so sorry if this is a stupid request, but does anyone have a suggestion to fix this error?

using System;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;

namespace UnityEngine.Perception.GroundTruth
{
    abstract class GroundTruthCrossPipelinePass : IGroundTruthGenerator
    {
        public Camera targetCamera;

        bool m_IsActivated;

        protected GroundTruthCrossPipelinePass(Camera targetCamera)
        {
            this.targetCamera = targetCamera;
        }

The next section starts with line 55 which was referenced in the error message:

 protected RendererListDesc CreateRendererListDesc(
            Camera camera,
            CullingResults cullingResult,
            string overrideMaterialPassName,
            int overrideMaterialPassIndex,
            Material overrideMaterial,
            LayerMask layerMask)
        {
            var shaderPasses = new[]
            {
                new ShaderTagId("Forward"), // HD Lit shader
                new ShaderTagId("ForwardOnly"), // HD Unlit shader
                new ShaderTagId("SRPDefaultUnlit"), // Cross SRP Unlit shader
                new ShaderTagId("UniversalForward"), // URP Forward
                new ShaderTagId("LightweightForward"), // LWRP Forward
                new ShaderTagId(overrideMaterialPassName), // The override material shader
            };

            var stateBlock = new RenderStateBlock(0)
            {
                depthState = new DepthState(true, CompareFunction.LessEqual),
            };

            var result = new RendererListDesc(shaderPasses, cullingResult, camera)
            {
                rendererConfiguration = PerObjectData.None,
                renderQueueRange = new RenderQueueRange { lowerBound = 0, upperBound = 5000 },
                sortingCriteria = SortingCriteria.CommonOpaque,
                excludeObjectMotionVectors = false,
                overrideMaterial = overrideMaterial,
                overrideMaterialPassIndex = overrideMaterialPassIndex,
                stateBlock = stateBlock,
                layerMask = layerMask,
            };
            return result;
        }

Alternatively, is there a branch of this perception package code which has been tested on 2022.2?

Thanks in advance,

aryan-mann commented 1 year ago

Hey @enickel00, we just released 🎉 Perception 1.0 🎉, a major update to the toolset! Support for Unity 2022 is included in the release along with other features 2022 enables such as ray tracing!