Skip to content

Commit

Permalink
CLOiSim-3.1.0
Browse files Browse the repository at this point in the history
[Major Changes]
- Upgrade Unity editor version: 2021.3.17f1 (LTS)
- Device: Modify destination format for AsyncGpuReadback in DepthCamera/Camera 

[Minor Changes]
- Device.Sensor: Separate LaserData.DepthCamBuffer into DepthData.CamBuffer
- Device.Sensor: Set dithering true for camera sensor in Lidar/Camera/DepthCamera 
- UI: Modify properties for RuntimeGizmo 
- UI: Modify multiplying handle length in RuntimeGizmo
- General: Modify parameter in UniversalRenderPipelineGlobalSettings

[Bug fix]
- Device: Modify Camera(Depth) sensor device to fix wrong depth information with L16
- Device: Modify LiftControl::DoLifting() to prevent shaking object during lifting
- UI: Prevent bouncing from floor during tranforming target
  • Loading branch information
hyunseok-yang authored Jan 26, 2023
1 parent b2b72f9 commit fc12b17
Show file tree
Hide file tree
Showing 23 changed files with 633 additions and 503 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ MonoBehaviour:
lightLayerName6: Light Layer 6
lightLayerName7: Light Layer 7
m_StripDebugVariants: 1
m_StripUnusedPostProcessingVariants: 0
m_StripUnusedPostProcessingVariants: 1
m_StripUnusedVariants: 1
supportRuntimeDebugDisplay: 0
62 changes: 36 additions & 26 deletions Assets/Resources/Shader/DepthBufferScaling.compute
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
// Each #kernel tells which function to compile; you can have many kernels
#pragma kernel CSDepthBufferScaling
#pragma kernel CSScaleDepthBuffer

#define MaxValue16Bits 65535.0f;
#define THREADS 8
#define GROUPS 4
#define THREADS 32
#define GROUPS 32

RWByteAddressBuffer _Buffer;
#define MAX_RANGE_16BITS 65535.0
#define MAX_RANGE_8BITS 255.0

StructuredBuffer<float> _Input;
RWStructuredBuffer<uint> _Output;

float _inverseMaxValue16Bits = 1 / MaxValue16Bits;
float _DepthMin;
float _DepthMax;
float _DepthScale;

uint getDepthDataIn16BitsScaled(uint depthData)
{
float depthDataRatio = (float)depthData * _inverseMaxValue16Bits;

uint scaledDepthData = (uint)(depthDataRatio * _DepthMax * _DepthScale);
uint finalData = ((scaledDepthData & 0xff) << 8) | (scaledDepthData >> 8);
return finalData;
}
uint _Width;
int _UnitSize;

[numthreads(THREADS, GROUPS, 1)]
void CSDepthBufferScaling(uint3 id : SV_DispatchThreadID)
void CSScaleDepthBuffer(uint3 id : SV_DispatchThreadID)
{
uint index = id.x + id.y;
uint data = _Buffer.Load(index);

uint part1 = getDepthDataIn16BitsScaled(data & 0xffff);
uint part2 = getDepthDataIn16BitsScaled(data >> 16);

uint finalData = (part2 << 16) | (part1 & 0xffff);
_Buffer.Store(index, finalData);
const uint bufIndex = id.y *_Width + id.x;
const float data = _Input.Load(bufIndex);
const float rangedData = data * _DepthMax;

if (_UnitSize == 4)
{
_Output[bufIndex] = asuint(rangedData);
}
else
{
uint finalData;
if (_UnitSize == 2)
{
const float max_scaled_range = MAX_RANGE_16BITS / _DepthScale;
const float scaledData = ((rangedData > max_scaled_range)? max_scaled_range : rangedData) * _DepthScale;
finalData = asuint((uint)scaledData) & 0xFFFF;
}
else // 1
{
// const float max_scaled_range = MAX_RANGE_8BITS;
const float scaledData = rangedData / _DepthMax * MAX_RANGE_8BITS;//((rangedData > max_scaled_range)? max_scaled_range : rangedData) * _DepthScale;
finalData = asuint((uint)scaledData) & 0xFF;
}
_Output[bufIndex] = finalData;
}
}
3 changes: 1 addition & 2 deletions Assets/Resources/Shader/DepthBufferScaling.compute.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fc12b17

Please sign in to comment.