Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.0.0-pre.44] - 2023-02-13

### Added

* Optimize OnPerformCulling by computing the CullingSplits from a main thread Burst job.
* EntitiesGraphicsSystem.GetMesh and EntitiesGraphicsSystem.GetMaterial are now public.
* Warning in-editor when using Entities.Graphics and URP that Forward+ rendering path should be used.

### Changed

* Removed async readback from deformations and replaced with fixed number of frames.
* The built-in properties for URP has been changed so that they have a slider for most values between 0-1. Relevant properties have also been changed from using a float4 for color in the inspector to use a color property instead.
* `PushBlendWeightSystem.cs`, `PushSkinMatrixSystem.cs`, `MeshRendererBaking.cs` script files have been updated to the latest idiomatic `foreach()`.
* Changed skin matrix / blend shape weight access in CopyBlendShapeWeightsToGPUJob and CopySkinMatricesToGPUJob to readonly.
* Improved `SkinnedMeshRenderer` baking performance
* Updated com.unity.render-pipelines.core dependency from 14.0.4 to 14.0.6

### Removed

 * Removed RemapMaterialMeshIndexJob. Both array indices and runtime IDs are now directly supported for MaterialMeshInfo.

### Fixed

* Occlusion browser not being updated properly in play mode.
* Only call UpdateAllBatches if there are entities graphics chunks
* Fixed a bug with Baked Lights inside subscenes, where the bakingOutput of such Lights was not updated correctly.
* Fixed global ambient probe when multiple cameras are present with HDRP
* Light baking will cause the MeshRenderers to bake, thus automatically updating the light map in the entities scene. This previously required forcing the reimport of the entity scene.
* 'GraphicsDeviceType.OpenGLES2' is obsolete: 'OpenGL ES 2.0 is no longer supported in Unity 2023.1'
  • Loading branch information
Unity Technologies committed Feb 13, 2023
1 parent 4741c2a commit 2457bc3
Show file tree
Hide file tree
Showing 37 changed files with 653 additions and 419 deletions.
40 changes: 34 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,37 @@ uid: changelog
---
# Changelog

## [1.0.0-pre.44] - 2023-02-13

### Added

* Optimize OnPerformCulling by computing the CullingSplits from a main thread Burst job.
* EntitiesGraphicsSystem.GetMesh and EntitiesGraphicsSystem.GetMaterial are now public.
* Warning in-editor when using Entities.Graphics and URP that Forward+ rendering path should be used.

### Changed

* Removed async readback from deformations and replaced with fixed number of frames.
* The built-in properties for URP has been changed so that they have a slider for most values between 0-1. Relevant properties have also been changed from using a float4 for color in the inspector to use a color property instead.
* `PushBlendWeightSystem.cs`, `PushSkinMatrixSystem.cs`, `MeshRendererBaking.cs` script files have been updated to the latest idiomatic `foreach()`.
* Changed skin matrix / blend shape weight access in CopyBlendShapeWeightsToGPUJob and CopySkinMatricesToGPUJob to readonly.
* Improved `SkinnedMeshRenderer` baking performance
* Updated com.unity.render-pipelines.core dependency from 14.0.4 to 14.0.6

### Removed

* Removed RemapMaterialMeshIndexJob. Both array indices and runtime IDs are now directly supported for MaterialMeshInfo.

### Fixed

* Occlusion browser not being updated properly in play mode.
* Only call UpdateAllBatches if there are entities graphics chunks
* Fixed a bug with Baked Lights inside subscenes, where the bakingOutput of such Lights was not updated correctly.
* Fixed global ambient probe when multiple cameras are present with HDRP
* Light baking will cause the MeshRenderers to bake, thus automatically updating the light map in the entities scene. This previously required forcing the reimport of the entity scene.
* 'GraphicsDeviceType.OpenGLES2' is obsolete: 'OpenGL ES 2.0 is no longer supported in Unity 2023.1'


## [1.0.0-pre.15] - 2022-11-16

### Added
Expand All @@ -22,19 +53,16 @@ uid: changelog
* Blend shapes not working on certain GPUs.
* Improved error behavior when null Meshes or Materials are used with Entities.

### Security

## [1.0.0-exp.14] - 2022-10-19


### Changed

* Updated documentation for mesh deformations.
* Removed async readback from deformations and replaced with fixed number of frames.


### Fixed

* Fixed a bug in the BatchingBenchmark sample scene where it would only spawn entities the first time it was dynamically loaded.
* Fixed a bug in the BatchingBenchmark sample scene where it would only spawn entites the first time it was dynamically loaded.
* Fixed an issue where Entities Graphics would cause issues with the device being able to idle.


Expand All @@ -59,7 +87,6 @@ uid: changelog
* DeformationsInPresentation and SkinnedMeshRendererConversion are now sealed.
* RegisterMaterialMeshSystem is now internal instead of public.


### Removed

* PushMeshDataSystem, PushSkinMatrixSystem, PushBlendWeightSystem, InstantiateDeformationSystem, BlendShapeDeformationSystem and SkinningDeformationSystem are no longer part of the public API. Use DeformationsInPresentation instead.
Expand All @@ -71,6 +98,7 @@ uid: changelog
* Improved multi threaded load balancing of the Entities Graphics frustum culling Burst job
* Guard against overflow of static readonly int k_MaxSize for the deformation buffers.


## [0.14.0] - 2021-09-17

### Added
Expand Down
4 changes: 2 additions & 2 deletions Documentation~/material-overrides-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ You can create your own custom Shader Graph properties, and expose them to DOTS
For the DOTS IComponentData struct, use the `MaterialProperty` Attribute, passing in the **Reference** and type for the Shader Graph property. For example, the IComponentData for the color (float4) property in the above step would be:

```
[MaterialProperty("_Color", MaterialPropertyFormat.Float4)]
[MaterialProperty("_Color")]
public struct MyOwnColor : IComponentData
{
public float4 Value;
}
```

Ensure that the *Reference* name in Shader Graph and the string name in MaterialProperty attribute match exactly. The type declared in the MaterialPropertyFormat should also be compatible with both the Shader Graph and the struct data layout. If the binary size doesn't match, you will see an error message in the console window.
Ensure that the **Reference** name in Shader Graph and the string name in MaterialProperty attribute match exactly.

### Burst C# system

Expand Down
8 changes: 4 additions & 4 deletions Documentation~/runtime-entity-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ To render an entity, Entities Graphics requires that the entity contains a speci
## RenderMeshUtility - AddComponents

This API takes an entity and adds the components Entities Graphics requires based on the given mesh and material, and a `RenderMeshDescription`, which is a struct that describes additional rendering settings. There are two versions of the API:

- One version accepts a `RenderMesh`. For information on the structure of a `RenderMesh`, see [RenderMesh](#rendermesh). Entities Graphics only uses this version during the GameObject conversion process; using this version at runtime doesn't produce rendering entities.
- A second version accepts a `RenderMeshArray`. For information on the structure of a `RenderMeshArray`, see [RenderMeshArray](#rendermesharray). Use this version of `AddComponents` at runtime.

Expand All @@ -26,8 +27,8 @@ A `RenderMeshArray` contains a list of meshes and materials that a collection of

The `MaterialMeshInfo` is a Burst-compatible plain data component that you can use to efficiently select or change an entity's mesh and material. This component supports two methods of selecting or changing an entity's mesh or material:

* Referring to array indices inside a `RenderMeshArray` shared component on the same entity.
* Referring directly to mesh and material IDs that you registered with the Entities Graphics beforehand.
- Referring to array indices inside a `RenderMeshArray` shared component on the same entity.
- Referring directly to mesh and material IDs that you registered with the Entities Graphics beforehand.

### Usage instructions

Expand Down Expand Up @@ -95,7 +96,7 @@ public class AddComponentsExample : MonoBehaviour
receiveShadows: false);

// Create an array of mesh and material required for runtime rendering.
var renderMeshArray = new RenderMeshArray(new List<Material> { Material }, new List<Mesh> { Mesh });
var renderMeshArray = new RenderMeshArray(new Material[] { Material }, new Mesh[] { Mesh });

// Create empty base entity
var prototype = entityManager.CreateEntity();
Expand Down Expand Up @@ -129,4 +130,3 @@ public class AddComponentsExample : MonoBehaviour
}
}
```

4 changes: 2 additions & 2 deletions Documentation~/sample-projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ When you clone the Project's repository, make sure to use git or a git client. T

The Entities Graphics sample projects can be found at:

- **HDRP**: [HybridHDRPSamples](https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/HybridHDRPSamples)
- **URP**: [HybridURPSamples](https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/HybridURPSamples)
- **HDRP**: [HDRPSamples](https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/GraphicsSamples/HDRPSamples)
- **URP**: [URPSamples](https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/GraphicsSamples/URPSamples)

Project folder structure:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,53 +35,69 @@ protected override void OnCreate()
);
}

[WithAll(typeof(SharedMeshTracker))]
partial struct ConstructHashMapJob : IJobEntity
{
public NativeParallelMultiHashMap<Entity, int>.ParallelWriter DeformedEntityToComputeIndexParallel;

private void Execute(in BlendWeightBufferIndex index, in DeformedEntity deformedEntity)
{
// Skip if we have an invalid index.
if (index.Value == BlendWeightBufferIndex.Null)
return;

DeformedEntityToComputeIndexParallel.Add(deformedEntity.Value, index.Value);
}
}

partial struct CopyBlendShapeWeightsToGPUJob : IJobEntity
{
[NativeDisableContainerSafetyRestriction] public NativeArray<float> BlendShapeWeightsBuffer;
[ReadOnly] public NativeParallelMultiHashMap<Entity, int> DeformedEntityToComputeIndex;

private void Execute(in DynamicBuffer<BlendShapeWeight> weights, in Entity entity)
{
// Not all deformed entities in the world will have a renderer attached to them.
if (!DeformedEntityToComputeIndex.ContainsKey(entity))
return;

var length = weights.Length * UnsafeUtility.SizeOf<float>();
var indices = DeformedEntityToComputeIndex.GetValuesForKey(entity);

foreach (var index in indices)
{
unsafe
{
UnsafeUtility.MemCpy(
(float*)BlendShapeWeightsBuffer.GetUnsafePtr() + index,
weights.GetUnsafeReadOnlyPtr(),
length
);
}
}
}
}

protected override void OnUpdate()
{
if (m_PushMeshDataSystem.BlendShapeWeightCount == 0)
return;

k_Marker.Begin();

var deformedEntityToComputeIndex = new NativeMultiHashMap<Entity, int>(m_BlendShapedEntityQuery.CalculateEntityCount(), Allocator.TempJob);
var deformedEntityToComputeIndex = new NativeParallelMultiHashMap<Entity, int>(m_BlendShapedEntityQuery.CalculateEntityCount(), Allocator.TempJob);
var deformedEntityToComputeIndexParallel = deformedEntityToComputeIndex.AsParallelWriter();
Dependency = Entities
.WithName("ConstructHashMap")
.WithAll<SharedMeshTracker>()
.ForEach((in BlendWeightBufferIndex index, in DeformedEntity deformedEntity) =>
{
// Skip if we have an invalid index.
if (index.Value == BlendWeightBufferIndex.Null)
return;

deformedEntityToComputeIndexParallel.Add(deformedEntity.Value, index.Value);
}).ScheduleParallel(Dependency);
Dependency = new ConstructHashMapJob
{
DeformedEntityToComputeIndexParallel = deformedEntityToComputeIndexParallel
}.ScheduleParallel(Dependency);

var blendShapeWeightsBuffer = m_PushMeshDataSystem.BlendShapeBufferManager.LockBlendWeightBufferForWrite(m_PushMeshDataSystem.BlendShapeWeightCount);
Dependency = Entities
.WithName("CopyBlendShapeWeightsToGPU")
.WithNativeDisableContainerSafetyRestriction(blendShapeWeightsBuffer)
.WithReadOnly(deformedEntityToComputeIndex)
.ForEach((ref DynamicBuffer<BlendShapeWeight> weights, in Entity entity) =>
{
// Not all deformed entities in the world will have a renderer attached to them.
if (!deformedEntityToComputeIndex.ContainsKey(entity))
return;

var length = weights.Length * UnsafeUtility.SizeOf<float>();
var indices = deformedEntityToComputeIndex.GetValuesForKey(entity);

foreach (var index in indices)
{
unsafe
{
UnsafeUtility.MemCpy(
(float*)blendShapeWeightsBuffer.GetUnsafePtr() + index,
weights.GetUnsafePtr(),
length
);
}
}
}).ScheduleParallel(Dependency);
Dependency = new CopyBlendShapeWeightsToGPUJob
{
BlendShapeWeightsBuffer = blendShapeWeightsBuffer,
DeformedEntityToComputeIndex = deformedEntityToComputeIndex
}.ScheduleParallel(Dependency);

Dependency = deformedEntityToComputeIndex.Dispose(Dependency);

Expand Down
Loading

0 comments on commit 2457bc3

Please sign in to comment.