Coder Social home page Coder Social logo

Comments (4)

jaxry avatar jaxry commented on May 21, 2024

Is there a way to adjust the polygon offset factor of the material

I can't think of a way. Three's polygonOffset uses glPolygonOffset which transposes depth values of the rasterized image. RayTracingRenderer doesn't use a depth buffer at all, since ray tracing traverses a BVH instead. Do you have some ideas how we could prevent z-fighting in other ways?

from ray-tracing-renderer.

ManishJu avatar ManishJu commented on May 21, 2024

Sorting of objects from back to front is already done with threejs by default.

But the the nvidia guy gave multiple options:
https://devtalk.nvidia.com/default/topic/913414/optix/how-can-optix-solve-the-problem-of-z-fighting-/

  1. Increase BVH precision,
  2. Offset the ray origin a little from the primitive surface (not good for transparent objects)
  3. Unique primitive IDS, but a lot complicated when using instancing, which has now started heavily being used in webgl rendering .

What do you think ?

from ray-tracing-renderer.

jaxry avatar jaxry commented on May 21, 2024

Wonderful resource, thanks for finding this. Correct me if I'm mistaken, but this forum post addresses how to avoid self-intersection with the same triangle? What you're describing involves z-fighting between two triangles that are close together? I can see how 1. would fix that, but what about 2. and 3.?

  1. The BVH precision is using the max built-in texture storage of 32-bit float. I'm not sure how easy it would be to increase this.
  2. I think we're doing this already! We offset the ray origin, from the surface, by a fixed small amount of 0.0005. It avoids the self-intersection problem described in the post.
    https://github.com/hoverinc/ray-tracing-renderer/blob/master/src/renderer/glsl/chunks/sampleShadowCatcher.glsl#L117
  3. This solution is interesting and sounds like something we could explore. We'd need to allocate extra memory in the BVH for primitive IDs, but that's doable. But would it offer an advantage over ray origin offsetting?

from ray-tracing-renderer.

ManishJu avatar ManishJu commented on May 21, 2024
  1. Yes you cannot go beyond 32 bit float precision in WebGL2 :(
  2. Oh that's great, but we are having self intersection problems with thin planes, currently managing with tricks.
  3. Yes when geometry is quite thin and almost overlapping, this should be really useful :)

from ray-tracing-renderer.

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.