shinjiogaki / bvh Goto Github PK
View Code? Open in Web Editor NEWBVH STAR in Japanese
BVH STAR in Japanese
以下の資料の P53 にある「C++は違う型のunionが許されない」という記載について、元ソースを見た限り「union で代入したメンバとは違うメンバから値を読み取った場合、値の保証ができない」と言っているだけなので、動作自体はする(資料の書き方でもコンパイルは通る)と思いますが、いかがでしょう?
https://github.com/shinjiogaki/bvh/blob/4250ba1/CEDEC2019.pdf
Hello,
I have randomly underexpanded bboxes if i use
bvh_binary.cpp: 73 std::for_each(std::execution::par, leaves.begin(), leaves.end(), [&](glm::uvec3 &leaf)
these two screenshots from two different launches of the same build
however if i change the execution policy to sequential (std::execution::seq) everything is ok, the problem mainly manifests itself on low-poly inputs. Resulting tree is valid in both cases as i can see, the problem only in bbox calculation. I ran this on 112 threads workstation.
Also my code for test intersection if any, counts hits and outputs as brightness. Could the problem be on my side ?
inline int TEST_intersect_bvh_ray(int ndIdx, const TEST :: LBVH& acc, const triangle* tris, const vec3 ro, const vec3 rd)
{
const auto * nd = &acc.Nodes[ndIdx];
int nbHits = 0;
float tnear, tfar;
if (intersect(aabb(&nd->Box.Min.x, &nd->Box.Max.x), ro, rd, tnear, tfar) == false)
return 0;
if ((nd->L & (1))) // is leaf ?
{
vec3 uvw;
float tmax = _FLT_MAX;
if (intersect_triangle_ray(tris[(nd->L - 1) / 2], ro, rd, uvw, tmax))
nbHits++;
}
else
{
nbHits += TEST_intersect_bvh_ray(nd->L / 2, acc, tris, ro, rd);
}
if ((nd->R & (1))) // is leaf ?
{
vec3 uvw;
float tmax = _FLT_MAX;
if (intersect_triangle_ray(tris[(nd->R - 1) / 2], ro, rd, uvw, tmax))
nbHits++;
}
else
{
nbHits += TEST_intersect_bvh_ray(nd->R / 2, acc, tris, ro, rd);
}
return nbHits;
}
bvh_binary.cpp
line 104
// leaf/node index
const auto index = is_leaf ? leaves[current].x * 2 + 1 : current * 2;
I don't understand this line.
Is the "*2" a left over from the 2d version?
Why not just something like that?
// leaf/node index
const auto index = is_leaf ? current +1 : current ;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.