Skip to content

Commit

Permalink
Merge from 'develop' into 'main' for CLOiSim-4.7.2 (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunseok-yang authored Aug 7, 2024
2 parents 04d9aca + eb49522 commit e262a55
Show file tree
Hide file tree
Showing 43 changed files with 1,095 additions and 1,055 deletions.
46 changes: 0 additions & 46 deletions Assets/Resources/Materials/Segmentation.mat

This file was deleted.

8 changes: 0 additions & 8 deletions Assets/Resources/Materials/Segmentation.mat.meta

This file was deleted.

10 changes: 5 additions & 5 deletions Assets/Resources/RenderPipelines/SegmentationRenderer.asset
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b3d386ba5cd94485973aee1479b272e, type: 3}
m_Name: RenderObjects
m_Name: SegmentationRenderObjects
m_EditorClassIdentifier:
m_Active: 1
settings:
passTag: RenderObjects
Event: 550
passTag: SegmentationRenderObjects
Event: 300
filterSettings:
RenderQueueType: 0
LayerMask:
Expand All @@ -26,9 +26,9 @@ MonoBehaviour:
overrideMaterialPassIndex: 0
overrideShader: {fileID: 4800000, guid: 419a697b1455619dea4cc9d729b3d0c8, type: 3}
overrideShaderPassIndex: 0
overrideMode: 1
overrideMode: 2
overrideDepthState: 0
depthCompareFunction: 2
depthCompareFunction: 0
enableWrite: 0
stencilSettings:
overrideStencilState: 0
Expand Down
7 changes: 4 additions & 3 deletions Assets/Resources/Shader/Depth.shader
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Shader "Sensor/Depth"
{
Properties
{
_ReverseData ("reverse depth data", Int) = 0
_FlipX ("horizontal flip", Int) = 1
[Toggle] _ReverseData ("reverse depth data", int) = 0
[Toggle] _FlipX ("horizontal flip", int) = 1
}

SubShader
Expand Down Expand Up @@ -33,9 +33,10 @@ Shader "Sensor/Depth"
int _ReverseData;
int _FlipX;

#pragma multi_compile_instancing
#pragma vertex vert
#pragma fragment frag
#pragma target 4.0
#pragma target 5.0
#include "UnityCG.cginc"

uniform sampler2D _CameraDepthTexture;
Expand Down
45 changes: 21 additions & 24 deletions Assets/Resources/Shader/DepthBufferScaling.compute
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,26 @@ int _UnitSize;
[numthreads(THREADS, GROUPS, 1)]
void CSScaleDepthBuffer(uint3 id : SV_DispatchThreadID)
{
const uint bufIndex = id.y *_Width + id.x;
const float data = _Input.Load(bufIndex);
const float rangedData = data * _DepthMax;
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;
}
uint finalData = 0;

if (_UnitSize == 4)
{
finalData = asuint(rangedData);
}
else 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 scaledData = rangedData / _DepthMax * MAX_RANGE_8BITS;//((rangedData > max_scaled_range)? max_scaled_range : rangedData) * _DepthScale;
finalData = asuint((uint)scaledData) & 0xFF;
}
_Output[bufIndex] = finalData;
}
Loading

0 comments on commit e262a55

Please sign in to comment.