Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/gpu instancing/roads indirect #3203

Draft
wants to merge 108 commits into
base: dev
Choose a base branch
from
Draft

Conversation

popuz
Copy link
Collaborator

@popuz popuz commented Jan 24, 2025

What does this PR change?

...

How to test the changes?

  1. Launch the explorer
  2. ...

Our Code Review Standards

https://github.com/decentraland/unity-renderer/blob/master/docs/code-review-standards.md

@popuz popuz added the force-build Used to trigger a build on draft PR label Feb 17, 2025
@popuz popuz added force-build Used to trigger a build on draft PR and removed force-build Used to trigger a build on draft PR labels Feb 17, 2025
@popuz popuz added force-build Used to trigger a build on draft PR and removed force-build Used to trigger a build on draft PR labels Feb 17, 2025
@popuz popuz marked this pull request as ready for review February 17, 2025 21:35
@popuz popuz requested review from a team as code owners February 17, 2025 21:35
@popuz popuz added do not merge force-build Used to trigger a build on draft PR and removed force-build Used to trigger a build on draft PR labels Feb 17, 2025
@popuz popuz removed do not merge force-build Used to trigger a build on draft PR labels Feb 18, 2025
@popuz popuz marked this pull request as draft February 18, 2025 11:42
@popuz popuz added the force-build Used to trigger a build on draft PR label Feb 18, 2025
roadAssetsPrefabList.Add((await assetsProvisioner.ProvideMainAssetAsync(t, ct: ct)).Value);
{
var prefab = await assetsProvisioner.ProvideMainAssetAsync(t, ct: ct);
// prefab.Value.GetComponent<GPUInstancingPrefabData>().HideVisuals();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this commented out line for?

// uniform float4x4 modifierTransform;
// uniform float modifierRadius;
// uniform float modifierHeight;
// uniform float3 modifierAxis;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is modifierAxis not redundant? Multiply (0, 1, 0, 1) with modifierTransform to get capsule's "up" direction.

maxViewSize = max(max(vBoundsExtents.x * scale.x, vBoundsExtents.y * scale.y), vBoundsExtents.z * scale.z) / (dist * fCameraHalfAngle * 2);
}

uint4 EvaluateLODLevel(uint nLODCount, float4x4 mLODScreenSpaceSizes, float fShadowDistance, float fScreenSpaceSize, float fDistance)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a comment explaining what and how is packed inside output and mLODScreenSpaceSizes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, couldn't they be structs with meaningful field names?

#ifndef _DCL_CULLING_FUNCTIONS_
#define _DCL_CULLING_FUNCTIONS_

inline void CalculateBoundingBox(in float4x4 objectTransformMatrix, inout float4 BoundingBox[8], float4x4 matCamera_MVP, float3 vBoundsCenter, float3 vBoundsExtents)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the BoundingBox at the end of the argument list to make clearer that it's the output.

// Middle Point
float MaxDepth = 1 - hiZMap.SampleLevel(sampler_hiZMap, float2(((BoundingRect.z - BoundingRect.x) / 2.0) + BoundingRect.x + xOffset, ((BoundingRect.w - BoundingRect.y) / 2.0) + BoundingRect.y), LOD).r;
uint uintLOD = uint(LOD);
float2 scale = float2(max((uint(hiZTxtrSize.x) >> uintLOD), 1) / max(float(uint(hiZTxtrSize.z) >> uintLOD), 1), max((uint(hiZTxtrSize.y) >> uintLOD), 1) / max(float(uint(hiZTxtrSize.w) >> uintLOD), 1));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why float(uint()) instead of floor?

Mathf.Abs(a.m30 - b.m30) < EPSILON &&
Mathf.Abs(a.m31 - b.m31) < EPSILON &&
Mathf.Abs(a.m32 - b.m32) < EPSILON &&
Mathf.Abs(a.m33 - b.m33) < EPSILON;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using Mathf.Approximately instead.

var hash = 17;
hash = (hash * 23) + (int)(matrix.m03 / EPSILON);
hash = (hash * 23) + (int)(matrix.m13 / EPSILON);
hash = (hash * 23) + (int)(matrix.m23 / EPSILON);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, but also why only three components?

public static class QuaternionExtensions
{
public static Quaternion SelfOrIdentity(this Quaternion quaternion) =>
quaternion is { x: 0, y: 0, z: 0, w: 0 } ? Quaternion.identity : quaternion;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What? What is the use?

--output=InspectCodeResult.xml \
--verbosity=VERBOSE

echo "Проверка завершена. Результат также сохранён в InspectCodeResult.xml."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this? Does it have to be in Assets? Why is it in Russian?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are changes to submodules reviewed separately, or?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
force-build Used to trigger a build on draft PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants