Skip to content

Commit

Permalink
Resolved compilation issue present in CUDA 11.8 version
Browse files Browse the repository at this point in the history
  • Loading branch information
yuchengzhong committed Jul 4, 2023
1 parent 71acbf5 commit 324eae2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 578 deletions.
10 changes: 5 additions & 5 deletions core/radiancePredict.cu
Expand Up @@ -332,7 +332,7 @@ __device__ float3 RadiancePredict(curandState* seed, bool active, float3 pos, fl
{
CurrentOffsetPos = pos + LightDir * CurrentOffsetInfo.Offset;
}
X_Val[i] = log(1.0 + alpha * MipDensityDynamic(int(CurrentOffsetInfo.Layer), CurrentOffsetPos) / 64.0f);
X_Val[i] = log(1.0f + alpha * MipDensityDynamic(int(CurrentOffsetInfo.Layer), CurrentOffsetPos) / 64.0f);

float3 MsDir;
if (CurrentOffsetInfo.localindex == 0)
Expand All @@ -343,13 +343,13 @@ __device__ float3 RadiancePredict(curandState* seed, bool active, float3 pos, fl
else
{
MsDir = normalize(CurrentOffsetPos - pos);
float Radius = float(1 << int(CurrentOffsetInfo.Layer)) / 256.0;
float Radius = float(1 << int(CurrentOffsetInfo.Layer)) / 256.0f;
float Angle = atan(0.5f * Radius / CurrentOffsetInfo.Offset);
float cos = dot(XMain, MsDir);
float cos2 = dot(LXMain, MsDir);
float u = cos * 0.5 + 0.5;
float u2 = cos2 * 0.5 + 0.5;
float v = Angle / (3.1415926535 * 60.0 / 180.0);
float u = cos * 0.5f + 0.5f;
float u2 = cos2 * 0.5f + 0.5f;
float v = Angle / (3.1415926535f * 60.0f / 180.0f);
float HG0 = tex2D<float>(_HGLut, u, v);
float HG1 = tex2D<float>(_HGLut, u2, v);
X_Val_Hg[i] = log(HG0 * HG1 + 1.0f);
Expand Down
2 changes: 1 addition & 1 deletion core/render.cuh
Expand Up @@ -191,7 +191,7 @@ __device__ float4 CalculateRadiance(float3 ori, float3 dir, float3 lightDir, flo
float3 rayDirection = dir;
float3 current_scatter_rate = { 1,1,1 };

float path_phase = 1.0;
//float path_phase = 1.0;
for (int scatter_num = 0; scatter_num < multiScatter; scatter_num++)
{
float3 nextPos, nextDir;
Expand Down
123 changes: 1 addition & 122 deletions core/sample_method.hpp
Expand Up @@ -6,26 +6,6 @@
#include <algorithm>

using namespace std;
struct DataSample
{
float Density[160];
float Tr[160];
float HG[160];
float Radiance = 0.0;
float g = 0.0;
float scatter = 1.0;
};
struct Offset_Layer
{
float Offset = 0.0;
float Layer = 0.0;
int type = 0;
int localindex = 0;
Offset_Layer(float noff, float nl, int type_ = 0, int localindex_ = 0)
{
Offset = noff; Layer = nl; type = type_; localindex = localindex_;
}
};
struct ReadDataList
{
string Path;
Expand Down Expand Up @@ -87,105 +67,4 @@ struct ReadDataList
RPointPerLoop = PointPerLoop;
RDatasetName = DataSetName;
}
};
struct SampleMethod
{
/*128+32=160*/
static void GetSamples23(std::vector<Offset_Layer>& samples)
{
const float MsOffsetScale = 0.6;// 0.65;
samples.clear();
//sp0
for (int i = 0; i < 8; i++)
{
float currentMip = 0.0;
float offset = 1.0 / 256.0;//1.0
offset *= MsOffsetScale;
samples.push_back(Offset_Layer(offset, currentMip, 5, i));
}
////////////////////////////////
//sp1
for (int i = 0; i < 8; i++)
{
float currentMip = 1.0;
float offset = 2.5 / 256.0;//2.5
offset *= MsOffsetScale;
samples.push_back(Offset_Layer(offset, currentMip, 5, 8));
}
////////////////////////////////
//sp2
for (int i = 0; i < 16; i++)
{
float currentMip = 2.0;//radius 2
float offset = 5.5 / 256.0;//5.5
offset *= MsOffsetScale;
samples.push_back(Offset_Layer(offset, currentMip, 5, 8));
}
////////////////////////////////
//sp3
for (int i = 0; i < 16; i++)
{
float currentMip = 3.0;//radius 4
float offset = 11.5 / 256.0;//收缩
offset *= MsOffsetScale;
samples.push_back(Offset_Layer(offset, currentMip, 5, 8));
}
////////////////////////////////
//sp4
for (int i = 0; i < 16; i++)
{
float currentMip = 4.0;//radius 8
float offset = 23.5 / 256.0;//收缩
offset *= MsOffsetScale;
samples.push_back(Offset_Layer(offset, currentMip, 5, 8));
}
////////////////////////////////
//sp5
for (int i = 0; i < 32; i++)
{
float currentMip = 5.0;//radius 16
float offset = 47.5 / 256.0;//收缩
offset *= MsOffsetScale;
samples.push_back(Offset_Layer(offset, currentMip, 5, 8));
}
////////////////////////////////
//sp6
for (int i = 0; i < 32; i++)
{
float currentMip = 6.0;//radius 32
float offset = 95.5 / 256.0;//收缩
offset *= MsOffsetScale;
samples.push_back(Offset_Layer(offset, currentMip, 5, 8));
}
//////////////////////////////////////////
//direct
for (int i = 0; i < 8; i++)
{
float currentMip = 0.0;
float offset = i + 1;//1,2,3,4,5,6,7,8
offset /= 256.0;
samples.push_back(Offset_Layer(offset, currentMip, 1, 8));
}//8
for (int i = 0; i < 8; i++)
{
float currentMip = 1.0;
float offset = 8.5 + 1 + 2.0 * i;//9.5,11.5,13.5,15.5 ,17.5,19.5,21.5,23.5
offset /= 256.0;
samples.push_back(Offset_Layer(offset, currentMip, 1, 8));
}//16
for (int i = 0; i < 8; i++)
{
float currentMip = 2.0;
float offset = 26.5 + 4.0 * i;//26.5,30.5,34.5,38.5 , 42.5,46.5,50.5,54.5
offset /= 256.0;
samples.push_back(Offset_Layer(offset, currentMip, 1, 8));
}//24
for (int i = 0; i < 8; i++)
{
float currentMip = 3.0;
float offset = 60.5 + 8.0 * i;//60.5,68.5,76.5,84.5, 92.5,100.5,108.5,116.5
offset /= 256.0;
samples.push_back(Offset_Layer(offset, currentMip, 1, 8));
}//32
}
};
};

0 comments on commit 324eae2

Please sign in to comment.