GithubHelp home page GithubHelp logo

BVH acceleration about nerv_pathtracer HOT 5 CLOSED

cewein avatar cewein commented on July 27, 2024
BVH acceleration

from nerv_pathtracer.

Comments (5)

Cewein avatar Cewein commented on July 27, 2024

so maybe it's the code behind the BVH who's bad, i will try to look into the PBRT Book code base and import as a third party there bvh to see if i work. and also look into radeon rays

from nerv_pathtracer.

Cewein avatar Cewein commented on July 27, 2024

So, looking at the code of PBRT didn't help, I will look into 3 potential sources :

  • RTOW BVH tutorial
  • Radeon Ray BVH
  • Tinsel CUDA BVH

We have to keep in mind with the GLSL BVH traversal it cannot be don't with recursive functions.

from nerv_pathtracer.

Cewein avatar Cewein commented on July 27, 2024

this will mark the point of merge for the bvh because i'm loosing to much time on the bvh, i want to focus more on the light transport part.

I will do a recap of what the bvh do and not do as of now :

  • bvh is creating a tree that work for the up to the leaf node but after the triangle detection is bugged

it might come from two thing, the triangle in the bvh are poorly setup so the leaf boxs contains the wrong tris or it's my traversal in the code who's wrong.

bvh will have more support in the future but taking a break on it as of know

from nerv_pathtracer.

Cewein avatar Cewein commented on July 27, 2024

the bug is found !

bug

As you can see in the picture above the triangle are outside the leaf rather being in it.
The triangles in the nodes are wrong, so the bug come from here.

from nerv_pathtracer.

Cewein avatar Cewein commented on July 27, 2024

alright after some dumping of the BVH and the Triangles data, i've come up with a small python script to debug the whole thing :

# This import registers the 3D projection, but is otherwise unused.
from mpl_toolkits.mplot3d import Axes3D  # noqa: F401 unused import
from mpl_toolkits.mplot3d.art3d import Poly3DCollection

import numpy as np
import matplotlib.pyplot as plt
import pandas

#open the data files
bvh = np.array(pandas.read_csv("bvh.csv"))
tris = np.array(pandas.read_csv("tris.csv"))

#selection a triangle to watch
nTri = 122

#get the triangle and the bvh leaf
index = np.where(triangle[:,0] == nTri)
indexBVH = np.where(bvh[:,9] == nTri)

#data alignement
tri = tris[index,:][0][0]
leaf = bvh[indexBVH,:][0][0]

#ploting
fig = plt.figure()
ax = Axes3D(fig)

#plot the triangle
x = [tri[1],tri[5],tri[9]]
y = [tri[2],tri[6],tri[10]]
z = [tri[3],tri[7],tri[11]]
verts = [list(zip(x,y,z))]
ax.add_collection3d(Poly3DCollection(verts))

#plot the bvh node
xs = [leaf[1],leaf[5]]
ys = [leaf[2],leaf[6]]
zs = [leaf[3],leaf[7]]
ax.scatter(xs, ys, zs, marker=m, color='red')

#show everything
plt.show()

this show us as it should the wrong leaf and the wrong tris
image

here the data files if you want to experiment yourself
dump.zip

from nerv_pathtracer.

Related Issues (15)

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.