Giter VIP home page Giter VIP logo

Comments (6)

lzhnb avatar lzhnb commented on August 22, 2024

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

from gs-ir.

fzy28 avatar fzy28 commented on August 22, 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

from gs-ir.

lzhnb avatar lzhnb commented on August 22, 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);
}
}

from gs-ir.

fzy28 avatar fzy28 commented on August 22, 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!

from gs-ir.

lzhnb avatar lzhnb commented on August 22, 2024

You can directly save the occlusion as an image.

GS-IR/render.py

Line 170 in e8d979e

occlusion=occlusion,

from gs-ir.

sucy171106 avatar sucy171106 commented on August 22, 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然后重新跑了一下,渲染出来的图片,很奇怪,请问这样子正常吗

from gs-ir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.