{"id":22883665,"url":"https://github.com/jorgemagic/csharpdirectxraytracing","last_synced_at":"2025-08-04T14:38:45.012Z","repository":{"id":140513491,"uuid":"249841231","full_name":"Jorgemagic/CSharpDirectXRaytracing","owner":"Jorgemagic","description":"DirectX Raytracing Tutorials in CSharp","archived":false,"fork":false,"pushed_at":"2024-04-15T20:25:03.000Z","size":15925,"stargazers_count":82,"open_issues_count":4,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T07:22:24.093Z","etag":null,"topics":["csharp","directx12","dotnet","dxr","raytracing"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jorgemagic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-24T23:32:17.000Z","updated_at":"2025-03-23T23:39:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"d5b34792-310f-4ee2-9dc9-0b70d078c693","html_url":"https://github.com/Jorgemagic/CSharpDirectXRaytracing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jorgemagic%2FCSharpDirectXRaytracing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jorgemagic%2FCSharpDirectXRaytracing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jorgemagic%2FCSharpDirectXRaytracing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jorgemagic%2FCSharpDirectXRaytracing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jorgemagic","download_url":"https://codeload.github.com/Jorgemagic/CSharpDirectXRaytracing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252831098,"owners_count":21810777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","directx12","dotnet","dxr","raytracing"],"created_at":"2024-12-13T18:51:52.155Z","updated_at":"2025-05-07T06:43:06.191Z","avatar_url":"https://github.com/Jorgemagic.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSharp DirectX Raytracing Tutorials\nThis repository contain tutorials demostrating how to use DirectX12 Raytracing with CSharp. The Nvidia original C++ tutorials can be found [here](https://github.com/NVIDIAGameWorks/DxrTutorials). The DirectX12 CSharp binding used was [Vortice](https://github.com/amerkoleci/Vortice.Windows).\n\n## Requirements:\n\n- A GPU that supports DXR (Such as NVIDIA's Volta or Turing hardware)\n- Windows 10 RS5 (version 1809)\n- [Windows 10 SDK version 1809 (10.0.17763.0)](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive)\n- Visual Studio 2019\n\n## Tutorials\n\n### [Tutorial 01 Create Window](01-CreateWindow/)\n\n![alt Create Window](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/CreateWindow.png)\n\n### [Tutorial 02 Initialize DXR](02-InitDXR/)\n\n![alt Initialize DXR](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/InitializeDXR.png)\n\n### [Tutorial 03 Acceleration Structure](03-AccelerationStructure/)\n\nNothing to show\n\n### [Tutorial 04 Raytracing PipelineState](04-RtPipelineState/)\n\nNothing to show\n\n### [Tutorial 05 Shader Table](05-ShaderTable/)\n\nNothing to show\n\n### [Tutorial 06 Raytrace](06-Raytrace/)\n\nNothing to show\n\n### [Tutorial 07 Basic Shaders](07-BasicShaders/)\n\n![alt Draw triangle](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/DrawTriangle.png)\n\n### [Tutorial 08 Instancing](08-Instancing/)\n\n![alt Instancing](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/Instancing.png)\n\n### [Tutorial 09 Constant Buffer](09-ConstantBuffer/)\n\n![alt Color Constant Buffer](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/ConstantBuffer.png)\n\n### [Tutorial 10 Per Instance Constant Buffer](10-PerInstanceConstantBuffer/)\n\n![alt Individual Constant Buffer](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/ConstantBuffers.png)\n\n### [Tutorial 11 Second Geometry](11-SecondGeometry/)\n\n![alt Add plane geometry](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/Plane.png)\n\n### [Tutorial 12 Per Geometry Hit Shader](12-PerGeometryHitShader/)\n\n![alt Triangle and Plane HitShaders](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/TriangleAndPlaneHitShader.png)\n\n### [Tutorial 13 Second Ray Type](13-SecondRayType/)\n\n![alt Simple Shadow](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/Shadow.png)\n\n### [Tutorial 14 Refit](14-Refit/)\n\n![alt Rotate triangles](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/UpdateGeometryTransform.png)\n\n## Extra Tutorials\n\nAfter I ported Raytracing DXR Nvidia tutorials to CSharp I think that would be a great idea to extend theses tutorials with some more. So I am going to add new extra raytracing tutorials to explain how to create more complex raytracing scenes.\n\n### [Tutorial 15 Primitives](15-Primitives/)\n\nHow to create a Raytracing Acceleration Structure from vertex and index geometry buffers.\n![alt Primitives](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/Primitives.png)\n\n### [Tutorial 16 Lighting](16-Lighting/)\n\nHow to lighting mesh using Raytracing pipeline. The acceleration Structures only have information about the vertex position of the mesh so we need to pass vertexBuffer and indexBuffer information to the shader to reconstruct the vertex information after a hit.\n![alt Primitives](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/Lighting.png)\n\n### [Tutorial 17 Shadow](17-Shadow/)\n\nHow to project shadows using Raytracing pipeline. In this tutorial, we are going to add a second geometry (ground) to the Acceleration Structure and throw a second ray to know whether a hit point is in shadow.\n![alt Primitives](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/Shadow01.png)\n\n### [Tutorial 18 Reflection](18-Reflection/)\n\nHow to make reflection meshes using Raytracing pipeline. In this tutorial, we are going to add a third reflected ray for each hit point recursively to calculate the final color (4 rebounds maximum deep). I also added fresnel and visibility falloff to improve the render. Most of the important changes are in the shader.\n![alt Primitives](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/Reflection.png)\n\n\n### [Tutorial 19 xxx] under construction\n\n\n### [Tutorial 20 Instancing](20-Scene/)\n\nHow to do instancing using Raytracing pipeline. In this tutorial, we are going to use the Top Level Acceleration Structure to instance multiple geometries defined in the Bottom Level Acceleration Structure and create a scene. In addition, we will add two constant buffers (Scene parameters and Primitive parameters) to pass scene configuration to shader.\n![alt Primitives](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/InstancingScene.png)\n\n\n### [Tutorial 21 Materials](21-Scene-PerInstanceConstantBuffer/)\n\nHow to provide a constant buffer per instance defined in the Top Level AS using the Raytracing pipeline. In this tutorial, we are going to see a mechanism to bind different resources to different instances of the same geometry. It will be useful to provide different materials for our Raytracing scenes.\n![alt Primitives](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/ConstantBufferPerInstance.png)\n\n### [Tutorial 22 Load Models](22-LoadModel/)\n\nHow to load a Gltf model and render with DirectX12 Raytracing pipeline. Acceleration structure only stores vertex positions so you need pass Index and Vertex buffer to the shader to figure out another vertex attributes (Normals, Texcoords, etc.) when a ray hits a model's triangle.\n![alt Primitives](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/GLTFModel.png)\n\n\n### [Tutorial 23 Load Textures](23-LoadTexture/)\n\nHow to load a texture and applies to our gltf model with DirectX12 Raytracing pipeline. Acceleration structure only stores vertex positions so you need pass Index and Vertex buffer to the shader to figure out another vertex attributes (Normals, Texcoords, etc.) when a ray hits a model's triangle.\n![alt Primitives](https://github.com/Jorgemagic/CSharpDirectXRaytracing/blob/master/Screenshots/LoadTextures.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgemagic%2Fcsharpdirectxraytracing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorgemagic%2Fcsharpdirectxraytracing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgemagic%2Fcsharpdirectxraytracing/lists"}