Camera artefacts using ECS/HDRP

So, I’m new to ECS/HDRP. I’m just getting into it, following some of the more popular tutorials online. I seem to have run into a strange artefacting problem whilst trying to render a few hundred simple planes. The project is a new scene made in the sample HDRP project available in unity (v2019.3.0a5). Below is the script I’m using to create entities from my GameObjects, which are located during the Awake() method of my MonoBehavior script.

    public class Bootstrap : MonoBehaviour
    {
        private Object[] _gameObjects;

        private EntityManager _entityManager;

        private void Awake()
        {
            // Assets\Resources\Environment\Temp\
            string path = @"Environment\Prefabs\Ground\";

            _gameObjects = Resources.LoadAll(path, typeof(GameObject));
        }

        private void Start()
        {
            _entityManager = World.Active.EntityManager;


            NativeArray<Entity> entities = new NativeArray<Entity>(_gameObjects.Length, Allocator.Temp);
            var entityArchetype = _entityManager.CreateArchetype(
                typeof(RenderMesh),
                typeof(Translation),
                typeof(LocalToWorld)
            );

            _entityManager.CreateEntity(entityArchetype, entities);

            for (int i = 0; i < _gameObjects.Length; i++)
            {
                  var entity = entities[i];
                var g = _gameObjects[i] as GameObject;

                var mesh = g.GetComponent<MeshFilter>().sharedMesh;
                var material = g.GetComponent<MeshRenderer>().sharedMaterial;

                _entityManager.SetSharedComponentData(entity, new RenderMesh
                {
                    mesh = mesh,
                    material = material
                });

            }

            entities.Dispose();
        }
    }

Upon running the game, using the Scene view, everything is normal. I can move around the scene without any problems (normal_viewport.png). When I switch to the camera view, however, everything shows up as black. I have a simple monobehavior script attached that allows me to move my camera around my scene (taken from the HDRP sample scene). The second I move my camera, I’m getting strange artefacting (including the blackness of the objects when I first switch to the Game view, camera_artefacts.png). I assume I’m doing something really wrong, I just don’t know what it is. Any help would be greatly appreciated! If I need to supply any more information please feel free to let me know!


As usual, after exhausting all plausible options, it turns out that the solution is quite simple (although possibly a bug?). I created a new HDRP/Lit material and assigned it to the “material” attribute of the entity and that did the trick. I’ll add, however, that the new material matches exactly the material that was on the original prefab (as far as the material settings are concerned). I’ll leave this up in case anybody comes across the same problem.

That’s an HDRP issue. A designer I work with ran into it a couple weeks back while he was still working in GameObject space. Haven’t found a consistent way to reproduce yet for a bug report, though I believe it has something to do with the transparency settings.

Thanks for the reply. I can add that the material was generated on unity-import on an obj imported from 3dsmax. It is quite strange because the new material (that fixed the problem) had identical settings.