OptiX | End goal | GPU library

 by   jkevin1 C++ Version: Current License: No License

kandi X-RAY | OptiX Summary

kandi X-RAY | OptiX Summary

OptiX is a C++ library typically used in Hardware, GPU applications. OptiX has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

Creating a real time path-tracer using NVIDIA OptiX. Rendering 1024x768 with no geometry is about 800fps on my computer i5 4670k @ 4.2GHz 16gb 1866MHz ram GTX 770 2GB. Recording of real-time path tracer: Comparison of the blur effect to reduce noise: ![blur] Tracing/comparison.png). Sphere scene: Here is a high res rendering of the sphere scene. Example teapot scene without reflections. There are A LOT of rays: --For the sample 512x512 image above (frame1.png) with 6 samples per pixel ----512x512 = 262,144 pixels ----1,572,864 samples, each with 1-5 calls to rtTrace() ----Best case: 1,572,864 calls to rtTrace() if every ray hit a light or missed (no diffuse reflections) ----Worst case: 7,864,320 calls to rtTrace() if every ray hit a diffuse surface (1st call + 4 maximum ray depth) ----Each ray may be tested with up to 9 ray-sphere intersections, not counting the lighting equations --Previous tests had the advantage of only spawning new radiance rays if it was a reflective/refractive surface, and only spawning 1 shadow ray.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              OptiX has a low active ecosystem.
              It has 7 star(s) with 2 fork(s). There are 4 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 0 open issues and 1 have been closed. On average issues are closed in 282 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of OptiX is current.

            kandi-Quality Quality

              OptiX has no bugs reported.

            kandi-Security Security

              OptiX has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              OptiX does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              OptiX releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of OptiX
            Get all kandi verified functions for this library.

            OptiX Key Features

            No Key Features are available at this moment for OptiX.

            OptiX Examples and Code Snippets

            No Code Snippets are available at this moment for OptiX.

            Community Discussions

            QUESTION

            Computing the surface normal at hit point in OptiX 7
            Asked 2021-May-22 at 10:03

            I'm studying the OptixTriangle example of OptiX 7.3. However, the meaning of the parameters of optixTrace are not clear:

            ...

            ANSWER

            Answered 2021-May-19 at 08:33
            1. In OptixTriangle the variables p0, p1 and p2 carry the color calculated by the closest hit program back to the ray generation program. OptiX calls the concept ray payload. It's a mechanism to attach up to 8 values to a ray and pass them along the program pipeline where each program being called can read and write the payload values. More on this is in the OptiX Programming Guide.

            2. In case of a triangle primitive being hit (as in OptixTriangle) you have to obtain the triangle coordinates from the acceleration structure and apply some vector algebra on them to calculate the normal of one of the vertices. The normal at the hit point is the same as for any triangle vertex: they all share the same plane. To get hit point coordinates anyway the OptiX API provides the barycentric coordinates of the intersection via primitive attributes to the hit programs.

            To translate this into code you won't get around a deeper understanding of OptiX 7. A good point to start is How to Get Started with OptiX 7 as it actually walks you step by step through the OptixTriangle example. To follow-up visit the GitHub repo Siggraph 2019/2020 OptiX 7/7.3 Course Tutorial Code. Walking through the examples makes a steep learning curve. The 5th example therein shows normal calculation.

            Source https://stackoverflow.com/questions/67560561

            QUESTION

            Is Hardware Accelerated Min/Max Ray Casting Available with Cuda/Optix?
            Asked 2021-Apr-22 at 16:25

            I am wondering if it is possible in Cuda or Optix to accelerate the computation of the minimum and maximum value along a line/ray casted from one point to another in a 3D volume.

            If not, is there any special hardware on Nvidia GPU's that can accelerate this function (particularly on Volta GPUs or Tesla K80's)?

            ...

            ANSWER

            Answered 2021-Apr-22 at 16:25

            The short answer to the title question is: yes, hardware accelerated ray casting is available in CUDA & OptiX. The longer question has multiple interpretations, so I'll try to outline the different possibilities.

            The different axes of your question that I'm seeing are: CUDA vs OptiX, pre-RTX GPUs vs RTX GPUs (e.g., Volta vs Ampere), min ray queries vs max ray queries, and possibly surface representations vs volume representations.

            pre-RTX vs RTX GPUs:

            To perhaps state the obvious, a K80 or a GV100 GPU can be used to accelerate ray casting compared to a CPU, due to the highly parallel nature of the GPU. However, these pre-RTX GPUs don't have any hardware that is specifically dedicated to ray casting. There are bits of somewhat special purpose hardware not dedicated to ray casting that you could probably leverage in various ways, so up to you to identify and design these kinds of hardware acceleration hacks.

            The RTX GPUs starting with the Turing architecture do have specialized hardware dedicated to ray casting, so they accelerate ray queries even further than the acceleration you get from using just any GPU to parallelize the ray queries.

            CUDA vs OptiX:

            CUDA can be used for parallel ray tracing on any GPUs, but it does not currently (as I write this) support access to the specialized RTX hardware for ray tracing. When using CUDA, you would be responsible for writing all the code to build an acceleration structure (e.g. BVH) & traverse rays through the acceleration structure, and you would need to write the intersection and shading or hit-processing programs.

            OptiX, Direct-X, and Vulkan all allow you to access the specialized ray-tracing hardware in RTX GPUs. By using these APIs, one can achieve higher speeds with lower power requirements, and they also require much less effort because the intersections and ray traversal through an acceleration structure are provided for you. These APIs also provide other commonly needed features for production-level ray casting, things like instancing, transforms, motion blur, as well as a single-threaded programming model for processing ray hits & misses.

            Min vs Max ray queries:

            OptiX has built-in functionality to return the surface intersection closest to the ray origin, i.e. a 'min query'. OptiX does not provide a similar single query for the furthest intersection (which is what I assume you mean by "max"). To find the maximum distance hit, or the closest hit to a second point on your ray, you would need to track through multiple hits and keep track of the hit that you want.

            In CUDA you're on your own for detecting both min and max queries, so you can do whatever you want as long as you can write all the code.

            Surfaces vs Volumes:

            Your question mentioned a "3D volume", which has multiple meanings, so just to clarify things:

            OptiX (+ DirectX + Vulkan) are APIs for ray tracing of surfaces, for example triangles meshes. The RTX specialty hardware is dedicated to accelerating ray tracing of surface based representations.

            If your "3D volume" is referring to a volumetric representation such as voxel data or a tetrahedral mesh, then surface-based ray tracing might not be the fastest or most appropriate way to cast ray queries. In this case, you might want to use "ray marching" techniques in CUDA, or look at volumetric ray casting APIs for GPUs like NanoVDB.

            Source https://stackoverflow.com/questions/66978061

            QUESTION

            undefined reference to `cuCtxGetCurrent` while getting CUDA context for OptiX
            Asked 2021-Feb-20 at 06:36

            I'm trying to learn how to implement OptiX into my C++ project. One of the first steps is to get the current CUDA context with cuCtxGetCurrent(&some_CUcontext_variable), however I'm getting a compile time error saying that I've made an undefined reference to cuCtxGetCurrent.

            Here's what I have:

            • I'm following code from this repo to learn about OptiX and I'm on example 2 (where you get the CUDA context).
            • In my code (main.cpp) I have included cuda_runtime.h, device_launch_parameters.h, optix.h, and optix_stubs.h, but I'm still getting the error at compile time.
            • Interestingly, my IDE, JetBrains' CLion, is not showing any undefined reference errors/warnings inline. Errors only show up when I compile.
            • In my CMakeLists.txt, I've used find_package(CUDAToolkit REQUIRED) to get CUDA. I then used target_link_libraries{ ... CUDA::cudart} to link in CUDA.

            I believe this error is linker related, so I'm assume I'm missing something in my CMakeLists, but I don't know what. Please let me know how I can fix this issue!

            Thank you in advanced for your help!

            Update #2: Solved

            It's moments like this make make me pull my hair out: all I had to do with literally put cuda in my target link libraries. Not -lcuda or CUDA::cuda, just cuda. Somehow that linked in the drivers and it looks to be compiling now.

            [OLD, BUT KEPT FOR REFERENCE] Update #1: Here's my CMakeLists.txt.

            Sorry for the lack of code in my original post. I was trying to avoid pasting large chunks of arbitrary code.

            ...

            ANSWER

            Answered 2021-Feb-19 at 21:01

            As @talonmies notes, CUDA has two (official) host-side APIs: The "CUDA Runtime API" and the "CUDA Driver API"; you can read about the difference between them here.

            You have mentioned files and CMake identifiers relating to the Runtime API: cuda_runtime.h, CUDA::cudart. But - "CUDA Contexts" are concepts of the Driver API, and cuCtxGetCurrent() etc. are driver API calls.

            Specifically, an "undefined reference" is indeed a linker error. In your case, you need to link with the CUDA driver. As a library, on Linux systems, that's called libcuda.so. For that to happen, and for your executable named ERPT_Render_Engine, you need to add the command:

            Source https://stackoverflow.com/questions/66273536

            QUESTION

            Unity VM crash (looks like acceleration issue)
            Asked 2021-Jan-20 at 11:17

            There is a problem with run Unity project on Hyper-V virtual machine. To make a long story short, my Unity project is working on my PC, but doesn't work on a VM. I described this in detail here:

            https://stackoverflow.com/q/65550732/5709159.

            I found a crash log where Unity wrote everything. Because there is a restriction on number of chars that I can post on stack overflow I uploaded the full file here: https://drive.google.com/file/d/1xAtTUytNGH7WFSSIr8WGotCDrvQKW9f-/view, and here I just posted the last part of this file:

            ...

            ANSWER

            Answered 2021-Jan-13 at 06:17

            The execution fails when it tries to enable or access a dedicated graphics card/driver:

            Source https://stackoverflow.com/questions/65560295

            QUESTION

            How to use a Service into a web component
            Asked 2020-Nov-13 at 18:17

            I'm trying to make an angular web component by following this guide: https://www.codementor.io/blog/angular-web-components-8e4n0r0zw7

            It works but when I have to inject services into my component, nothing works anymore, if I write (private service: DataService) in the constructor I have a blank screen and no console errors.

            ...

            ANSWER

            Answered 2020-Nov-13 at 18:17
            constructor(injector: Injector) {}
            
             ngDoBootstrap(): void {
                const el = createCustomElement(OptixCalendarComponent, {injector});
                customElements.define('optix-calendar', el);
              }
            

            Source https://stackoverflow.com/questions/64824926

            QUESTION

            Template class with conditional typenames
            Asked 2020-Jul-07 at 16:20

            I would like to have a template class (e.g. float/double type), but I am using Nvidia CUDA and OptiX and have multiple other types (e.g. float2, double2, float3,...) that depend on the chosen template type.

            Something like this:

            ...

            ANSWER

            Answered 2020-Jul-07 at 07:44

            Implement a meta-function using template specialization that maps standard C++ types to OptiX types with the desired "rank":

            Source https://stackoverflow.com/questions/62770234

            QUESTION

            vector is holding single value instead of multiple values
            Asked 2020-Apr-23 at 06:59

            I am new to c++, this question might be silly to you.

            I am using Network Optix Video management service. Using their application I am building a plugin.

            I am using below code snippet to create metadata object packet.

            ...

            ANSWER

            Answered 2020-Apr-23 at 06:53

            Seems pretty simple, you need to move push_back so that it is inside your loop, not after your loop.

            Something like this

            Source https://stackoverflow.com/questions/61380700

            QUESTION

            get outward facing normal from vertices
            Asked 2020-Mar-09 at 18:55

            I'm working on a thermal application in Optix, I want to import a GLTF file and then start rays from each primitive.

            I don't fully understood the documentation regrading "front" and "back" for faces stored in gltf. Is there a correct way to calculate the outward facing normal using the three vertexes of a triangle and using the cross-product on the sides? If my code works as intended I sometimes get an inward and sometimes an outward normal. Or is the order in which the verteces are stored arbitrary and thus the orientation might inverse? Also for each face there are 3 "normals" stored, if I understand that correctly. If all my faces are flat/not curved, should I be able to use any of these without even having to compute anything?

            Thanks for your help in advance!

            ...

            ANSWER

            Answered 2020-Mar-09 at 18:55

            In glTF, normals are stored per vertex. The normals for faces are typically calculated during rasterization (hardware) in most graphics pipelines, as a linear interpolation between vertex normals for that face.

            For what it's worth, glTF does specify a counter-clockwise rotation in primitive.indices. However, materials in glTF are allowed to be double-sided, and the specification for Double Sided indicates that when viewing the back face of a surface, one must flip the normal before evaluating the lighting.

            In practice, sometimes authoring tools produce polygon meshes that are inside-out, or even have thin-walled (non-manifold, or non-water-tight) geometry. In such cases it can be difficult to say what is "inside" vs. "outside" as they look the same, and the winding order may be arbitrary. (In Blender Edit Mode, click menu Mesh -> Normals -> Recalculate Outside to fix this).

            For single-sided materials, the winding order should not be arbitrary, as the back sides are hidden from view. One would expect counter-clockwise winding order triangles when using those materials. In Blender, this can be done by selecting the "Eevee" engine, bringing up the material properties panel, and putting a checkmark on "Backface culling". Make sure this happens in the material settings, NOT in the viewport settings, otherwise the glTF exporter won't find it. Use "Material Preview" viewing mode to see the result.

            If all my faces are flat/not curved, should I be able to use any of these without even having to compute anything?

            Yes, if you have completely flat faces, I would expect the vertex normals within each face to be equal, such that linear interpolation would not produce any changes to the normal vector.

            Source https://stackoverflow.com/questions/60605836

            QUESTION

            Primitive ID, not unique if the same mesh is used more than once
            Asked 2020-Jan-27 at 18:16

            I working on a thermal tool using OptiX. I started with the "meshviewer" example which uses syoyo's tinygltf loader. Basically I want to import a file, get the number of primitives and then add up the intersections.

            Now I imported a file containing two cubes, which should consist of 12 triangles each, so 24 in total. When I start my program the loader only recognizes 12 triangles, but it renders 2 seperate cubes. The primitive IDs seem to be identical for both cubes.

            Is there a workaround when I export from blender? If I understood the documentation directly the separate cubes are treated as two "identical" instances of the same mesh and thus share the primitive IDs. I am using the v2.81 of Blender with the gltf exporter.

            Do I understand the problem correctly? And is there an easy workaround? If not it seems I will have to modify the tinygltf loader.

            Thank you for help in advance!

            ...

            ANSWER

            Answered 2020-Jan-27 at 18:16

            It's possible the two cubes share the same mesh. In the screenshot below, there are two Blender "objects", Left-Cube and Right-Cube. Both objects use the same Blender mesh, called Shared-Cube-Mesh.

            The glTF exporter recognizes this pattern and mirrors it in the glTF file. There will be two glTF nodes, corresponding to the two Blender objects that use the mesh. But there will only be a single glTF mesh, with a single cube.

            You can click the "number of users" button, shown below with a white arrow pointing to it, to make the second object use its own unique mesh. But be warned, this doubles the amount of mesh data being exported to glTF in this simple example. A complete copy of the mesh would be made in both Blender and the glTF binary payload.

            Source https://stackoverflow.com/questions/59935480

            QUESTION

            How to rtPrint with Optix Context Wrapper
            Asked 2019-Aug-01 at 21:36

            This question is meant to help beginners of NVIDIA OptiX (much like myself)

            What's Happening

            When working with the OptiX compiled examples (delivered with the installation of OptiX), I am trying to print to the console from one of the computer kernels and I keep getting these errors:

            ...

            ANSWER

            Answered 2018-Sep-12 at 00:42

            After looking further at the error and the original instantiation of the context, it turns out that the optixWhitted example uses a wrapper class to handle the rtContext object. The two objects are different classes and in doing some digging around, I discovered that NVIDIA has included the ContextObj class as a convenience wrapper for the underlying rtContext. This ContextObj class has very similar functions to the rtContext and functions outlined in Chapter 3 of the OptiX 5.1 Programming Guide.

            Looking through the ContextObj class, you will find analogous functions for setting the rtPrintf settings: OptiX ContextObj Wrapper Class.

            Specifically you'll find these functions:

            • setPrintEnabled(bool)
            • setPrintBufferSize(uint)

            Final Working Code

            This is the final working code, that uses the ContextObj wrapper class already present and in use inside the optixWhitted tutorial.

            Source https://stackoverflow.com/questions/52285842

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install OptiX

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/jkevin1/OptiX.git

          • CLI

            gh repo clone jkevin1/OptiX

          • sshUrl

            git@github.com:jkevin1/OptiX.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link