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

reproducing results #16

Open
XiaokangWei opened this issue Apr 25, 2024 · 6 comments
Open

reproducing results #16

XiaokangWei opened this issue Apr 25, 2024 · 6 comments

Comments

@XiaokangWei
Copy link

Hi, Good job! and thanks for your release your code.

But when i reproduce these scene step by step, the decompose result is not enough good like paper. For example,

lego:
00000_brdf

armadillo:
00000_brdf

And I also want to ask how to set the occlusion threshold on different scenes.

I'm very apperiate it If you can reply!

best,
regards

@lzhnb
Copy link
Owner

lzhnb commented May 28, 2024

Albedo looks fine but occlusion looks dirty and ambiguous.
The occlusion threshold can be set --occlusion 0.25 when you conduct baking.py.

@lzhnb lzhnb closed this as completed May 28, 2024
@lzhnb lzhnb reopened this May 28, 2024
@fzy28
Copy link

fzy28 commented Jun 1, 2024

Same here.

00000_brdf
00002_brdf

The albedo and roughness have some results though I think it is still wrong if you compute the psnr on albedo which is only around 20.

I follow this training process:

python train.py
-m outputs/lego/
-s lego
--iterations 30000
--eval

python baking.py
-m outputs/lego/
--checkpoint outputs/lego/chkpnt30000.pth
--bound 1.5
--occlu_res 128
--occlusion 0.25

python train.py
-m outputs/lego/
-s lego/
--start_checkpoint outputs/lego/chkpnt30000.pth
--iterations 35000
--eval
--gamma
--indirect

@lzhnb
Copy link
Owner

lzhnb commented Jun 4, 2024

Well, the occlusion is so strange (dirty), and I've checked the code.
I think that you can set the sample_rays here as 1 and check the occlusion (This may be a mistake when I release the code):

sample_rays: int = 256,

Since I am recovering ambient occlusion from spherical harmonics, this already includes hemisphere pre-convolution, so there is no need to perform importance sampling.

for (uint32_t i = 0u; i < num_samples; ++i) {
float2 Xi = Hammersley(i, num_samples);
float3 sample_dir = importanceSampleGGX(Xi, L, roughness, eps);
// const float phi = 2.0f * M_PIf * (Xi.x + eps);
// // const float cosTheta = 1.0 - Xi.y; // uniform
// const float cosTheta = sqrt(1.0 - Xi.y); // cos
// const float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
// // from spherical coordinates to cartesian coordinates - halfway vector
// float3 H = make_float3(cosf(phi) * sinTheta, sinf(phi) * sinTheta, cosTheta);
// H = normalize(H);
// float3 sample_dir = normalize(tangent * H.x + bitangent * H.y + L * H.z);
// const uint32_t offset = i * 3;
// curr_sample_dir[offset + 0] = sample_dir.x;
// curr_sample_dir[offset + 1] = sample_dir.y;
// curr_sample_dir[offset + 2] = sample_dir.z;
const float x = sample_dir.x, y = sample_dir.y, z = sample_dir.z;
// conduct SH reconstruction
for (uint32_t c = 0u; c < channels; ++c) {
float accum = 0.0f;
const float *coeffs = curr_coeffs + c * d2; // [d2]
accum += 0.28209479177387814f * coeffs[0];
if (sh_degree <= 1) {
continue;
}
accum += -0.4886025119029199f * y * coeffs[1];
accum += 0.4886025119029199f * z * coeffs[2];
accum += -0.4886025119029199f * x * coeffs[3];
if (sh_degree <= 2) {
continue;
}
const float xy = x * y, yz = y * z, xz = x * z, xx = x * x, yy = y * y, zz = z * z;
accum += 1.0925484305920792f * xy * coeffs[4];
accum += -1.0925484305920792f * yz * coeffs[5];
accum += 0.31539156525252005 * (2.0 * zz - xx - yy) * coeffs[6];
accum += -1.0925484305920792f * xz * coeffs[7];
accum += 0.5462742152960396f * (xx - yy) * coeffs[8];
if (sh_degree <= 3) {
continue;
}
accum += -0.5900435899266435f * y * (3.0f * xx - yy) * coeffs[9];
accum += 2.890611442640554f * xy * z * coeffs[10];
accum += -0.4570457994644658f * y * (4.0f * zz - xx - yy) * coeffs[11];
accum += 0.3731763325901154f * z * (2.0f * zz - 3.0f * xx - 3.0f * yy) * coeffs[12];
accum += -0.4570457994644658f * x * (4.0f * zz - xx - yy) * coeffs[13];
accum += 1.4453057213202769f * z * (xx - yy) * coeffs[14];
accum += -0.5900435899266435f * x * (xx - 3.0f * yy) * coeffs[15];
curr_output[c] += clamp(accum, 0.0f, 1.0f);
}
}

@fzy28
Copy link

fzy28 commented Jun 4, 2024

Well, the occlusion is so strange (dirty), and I've checked the code. I think that you can set the sample_rays here as 1 and check the occlusion (This may be a mistake when I release the code):

sample_rays: int = 256,

Since I am recovering ambient occlusion from spherical harmonics, this already includes hemisphere pre-convolution, so there is no need to perform importance sampling.

for (uint32_t i = 0u; i < num_samples; ++i) {
float2 Xi = Hammersley(i, num_samples);
float3 sample_dir = importanceSampleGGX(Xi, L, roughness, eps);
// const float phi = 2.0f * M_PIf * (Xi.x + eps);
// // const float cosTheta = 1.0 - Xi.y; // uniform
// const float cosTheta = sqrt(1.0 - Xi.y); // cos
// const float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
// // from spherical coordinates to cartesian coordinates - halfway vector
// float3 H = make_float3(cosf(phi) * sinTheta, sinf(phi) * sinTheta, cosTheta);
// H = normalize(H);
// float3 sample_dir = normalize(tangent * H.x + bitangent * H.y + L * H.z);
// const uint32_t offset = i * 3;
// curr_sample_dir[offset + 0] = sample_dir.x;
// curr_sample_dir[offset + 1] = sample_dir.y;
// curr_sample_dir[offset + 2] = sample_dir.z;
const float x = sample_dir.x, y = sample_dir.y, z = sample_dir.z;
// conduct SH reconstruction
for (uint32_t c = 0u; c < channels; ++c) {
float accum = 0.0f;
const float *coeffs = curr_coeffs + c * d2; // [d2]
accum += 0.28209479177387814f * coeffs[0];
if (sh_degree <= 1) {
continue;
}
accum += -0.4886025119029199f * y * coeffs[1];
accum += 0.4886025119029199f * z * coeffs[2];
accum += -0.4886025119029199f * x * coeffs[3];
if (sh_degree <= 2) {
continue;
}
const float xy = x * y, yz = y * z, xz = x * z, xx = x * x, yy = y * y, zz = z * z;
accum += 1.0925484305920792f * xy * coeffs[4];
accum += -1.0925484305920792f * yz * coeffs[5];
accum += 0.31539156525252005 * (2.0 * zz - xx - yy) * coeffs[6];
accum += -1.0925484305920792f * xz * coeffs[7];
accum += 0.5462742152960396f * (xx - yy) * coeffs[8];
if (sh_degree <= 3) {
continue;
}
accum += -0.5900435899266435f * y * (3.0f * xx - yy) * coeffs[9];
accum += 2.890611442640554f * xy * z * coeffs[10];
accum += -0.4570457994644658f * y * (4.0f * zz - xx - yy) * coeffs[11];
accum += 0.3731763325901154f * z * (2.0f * zz - 3.0f * xx - 3.0f * yy) * coeffs[12];
accum += -0.4570457994644658f * x * (4.0f * zz - xx - yy) * coeffs[13];
accum += 1.4453057213202769f * z * (xx - yy) * coeffs[14];
accum += -0.5900435899266435f * x * (xx - 3.0f * yy) * coeffs[15];
curr_output[c] += clamp(accum, 0.0f, 1.0f);
}
}

Hi, thanks for you reply. I wonder what do you mean "occlusion", I think this output is roughness map?

Could you be more specific about how to visualize the occlusion? Thanks!

@lzhnb
Copy link
Owner

lzhnb commented Jun 4, 2024

You can directly save the occlusion as an image.

GS-IR/render.py

Line 170 in e8d979e

occlusion=occlusion,

@sucy171106
Copy link

sucy171106 commented Aug 1, 2024

Well, the occlusion is so strange (dirty), and I've checked the code. I think that you can set the sample_rays here as 1 and check the occlusion (This may be a mistake when I release the code):

sample_rays: int = 256,

Since I am recovering ambient occlusion from spherical harmonics, this already includes hemisphere pre-convolution, so there is no need to perform importance sampling.

for (uint32_t i = 0u; i < num_samples; ++i) {
float2 Xi = Hammersley(i, num_samples);
float3 sample_dir = importanceSampleGGX(Xi, L, roughness, eps);
// const float phi = 2.0f * M_PIf * (Xi.x + eps);
// // const float cosTheta = 1.0 - Xi.y; // uniform
// const float cosTheta = sqrt(1.0 - Xi.y); // cos
// const float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
// // from spherical coordinates to cartesian coordinates - halfway vector
// float3 H = make_float3(cosf(phi) * sinTheta, sinf(phi) * sinTheta, cosTheta);
// H = normalize(H);
// float3 sample_dir = normalize(tangent * H.x + bitangent * H.y + L * H.z);
// const uint32_t offset = i * 3;
// curr_sample_dir[offset + 0] = sample_dir.x;
// curr_sample_dir[offset + 1] = sample_dir.y;
// curr_sample_dir[offset + 2] = sample_dir.z;
const float x = sample_dir.x, y = sample_dir.y, z = sample_dir.z;
// conduct SH reconstruction
for (uint32_t c = 0u; c < channels; ++c) {
float accum = 0.0f;
const float *coeffs = curr_coeffs + c * d2; // [d2]
accum += 0.28209479177387814f * coeffs[0];
if (sh_degree <= 1) {
continue;
}
accum += -0.4886025119029199f * y * coeffs[1];
accum += 0.4886025119029199f * z * coeffs[2];
accum += -0.4886025119029199f * x * coeffs[3];
if (sh_degree <= 2) {
continue;
}
const float xy = x * y, yz = y * z, xz = x * z, xx = x * x, yy = y * y, zz = z * z;
accum += 1.0925484305920792f * xy * coeffs[4];
accum += -1.0925484305920792f * yz * coeffs[5];
accum += 0.31539156525252005 * (2.0 * zz - xx - yy) * coeffs[6];
accum += -1.0925484305920792f * xz * coeffs[7];
accum += 0.5462742152960396f * (xx - yy) * coeffs[8];
if (sh_degree <= 3) {
continue;
}
accum += -0.5900435899266435f * y * (3.0f * xx - yy) * coeffs[9];
accum += 2.890611442640554f * xy * z * coeffs[10];
accum += -0.4570457994644658f * y * (4.0f * zz - xx - yy) * coeffs[11];
accum += 0.3731763325901154f * z * (2.0f * zz - 3.0f * xx - 3.0f * yy) * coeffs[12];
accum += -0.4570457994644658f * x * (4.0f * zz - xx - yy) * coeffs[13];
accum += 1.4453057213202769f * z * (xx - yy) * coeffs[14];
accum += -0.5900435899266435f * x * (xx - 3.0f * yy) * coeffs[15];
curr_output[c] += clamp(accum, 0.0f, 1.0f);
}
}

image
1722534111731

你好,我更改了sample_rays int = 1然后重新跑了一下,渲染出来的图片,很奇怪,请问这样子正常吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants