Code Monkey home page Code Monkey logo

Comments (3)

cadop avatar cadop commented on July 19, 2024

I can take a look at this over the next few weeks (really busy now, and it's a bit of work).

There is a method to add a mesh to the bvh, and if you know ahead of time which parts of your mesh will be modified, you can use the meshid to add and ignore certain meshes.

But I think there is another method in embree we can use for dynamic, but it will take some effort to port it. I remember it will also make rays a bit slower because of how it handles a changing bvh , so I need to add more flags or a new method etc

from dhart.

mariuszhermansdorfer avatar mariuszhermansdorfer commented on July 19, 2024

Appreciate it!

I searched a bit and here are my initial findings:

  1. There is an official tutorial including source code showing how to work with dynamic scenes
  2. The key here is to update the vertex buffer using the rtcUpdateGeometryBuffer method
    https://github.com/embree/embree/blob/489b746c0d5010e0da10345e9dc96768bec9a037/tutorials/dynamic_scene/dynamic_scene_device.cpp#L268
  3. Additionally, it might be a good idea to set the build quality to RTC_BUILD_QUALITY_REFIT
    https://github.com/embree/embree/blob/489b746c0d5010e0da10345e9dc96768bec9a037/tutorials/dynamic_scene/dynamic_scene_device.cpp#L121-L122
  4. Currently the c# interface disposes of buffers after use and for the above methods to work they would have to be stored somewhere.

Somewhat related to this feature request, I had to identify the primitive Id of the hit mesh (essentially its face index) and added these changes to the dev branch:
ed722e0

Let me know if they should go somewhere else.

from dhart.

cadop avatar cadop commented on July 19, 2024

You are really moving along!

Yes the dynamic scene is what I was mentioning, but there is a bit more to it for dhart. Since you are getting into the weeds and moving faster than I can comment on, some considerations to keep in mind for what will need to happen...

  • We need to consider speed. updating bvh can have some implications here. This means we will need to have a flag to use it or not
  • Once we have a flag, there are multiple places the API needs to keep track of what it is using
  • We need error handling for when users don't provide valid inputs/changes
  • The python API has to get updated for any change that happens to the C interface (part of my delay on pulling dev was that I need to do this)
  • There is a 'double precision' flag for the raytracer. the issue about it being called embreebvh has continued, but the backend can switch between nanort for double precision and embree. The functions are templated to support this, so the more we change about the bvh, the harder this becomes
  • We need unit tests for everything, including in C api, especiallly for things like keeping hold of references and cleaning them

None of this is saying we can't do it, just some things I hope you can keep in mind when modifying so it is easier/faster for me to go through the PR

Thanks for working on all these features!

from dhart.

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.