Git Product home page Git Product logo

bvh's People

Contributors

shinjiogaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bvh's Issues

union の使い方について

以下の資料の P53 にある「C++は違う型のunionが許されない」という記載について、元ソースを見た限り「union で代入したメンバとは違うメンバから値を読み取った場合、値の保証ができない」と言っているだけなので、動作自体はする(資料の書き方でもコンパイルは通る)と思いますが、いかがでしょう?

https://github.com/shinjiogaki/bvh/blob/4250ba1/CEDEC2019.pdf

possible datarace on concurrent bbox expand

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
image
image

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;
	}

const auto index = is_leaf ? leaves[current].x * 2 + 1 : current * 2;

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 ;

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.