• Stars
    star
    198
  • Rank 196,898 (Top 4 %)
  • Language
    C#
  • Created over 6 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A C# ray tracer, capable of running on both the CPU and GPU.

Veldrid Ray Tracer

Image

This is a simple, brute-force ray tracer written in C# and capable of running on the CPU (using .NET Core) and on the GPU in a compute shader (using Veldrid and ShaderGen). Everything is written in C#, and a majority of the logic is shared between the versions that run on the CPU and GPU.

How To Run

This is a .NET Core application, so you will need the .NET Core SDK for your platform to build and run it.

dotnet run -c Release -p raytracer.csproj

By default, the ray tracing will be done on the GPU. You can change this by setting _drawModeCPU to true. When drawing on the CPU, you may want to lower the Width and Height of the output image, as well as the NumSamples used. These are all found at the top of RayTracingApplication.cs.

You can force a different graphics API to be used by changing the backend variable at the beginning of RayTracingApplication.Run(). By default, the application will automatically choose the "platform default" graphics API.

There's two scenes included in the program. Uncomment one of the Create__Scene methods to use a different scene.

See Also

Ray Tracing in One Weekend by Peter Shirley. Most of the general structure of this ray tracer is based on the code from this book.

More Repositories

1

veldrid

A low-level, portable graphics library for .NET.
C#
2,136
star
2

ImGui.NET

An ImGui wrapper for .NET.
C#
1,428
star
3

ShaderGen

Proof-of-concept library for generating HLSL, GLSL, and Metal shader code from C#,
C#
489
star
4

CrazyCore

Repository containing the game assets and code for Crazy Core
C#
380
star
5

ge

A general-purpose 3D game engine with editor, built with .NET Core
C#
313
star
6

vk

Low-level Vulkan bindings for .NET.
C#
175
star
7

veldrid-samples

Sample projects for Veldrid
C#
119
star
8

nativelibraryloader

A .NET Standard library for loading native shared libraries and retrieving function pointers.
C#
90
star
9

veldrid-spirv

SPIR-V shader translation for Veldrid, using SPIRV-Cross
C#
43
star
10

ImGui.NET-nativebuild

Windows/macOS/Linux/iOS/Android build automation for cimgui. Used to package up ImGui.NET.
Batchfile
22
star
11

synthapp

Experimental audio sequencer with .NET Core
C#
13
star
12

coreui

A libui wrapper for .NET Core
C#
12
star
13

assemblybrowser

A GUI-based CIL browser running on .NET Core
C#
12
star
14

ecs

Trying out an experimental ECS with real ECS principles
C#
9
star
15

Veldrid.TextRendering

Text rendering with Veldrid and SharpFont
C#
9
star
16

veldrid-docs

Documentation site for Veldrid
7
star
17

Vx

Experimenting with an easy-to-use immediate mode 3D renderer
C#
7
star
18

corebuild

A minimal configuration for creating a .NET Core console application using a regular MSBuild csproj
7
star
19

Veldrid.TinyDemo

A minimal demo project using Veldrid
C#
6
star
20

Snake

Snake
C#
6
star
21

bootstrap

Helper script for bootstrapping .NET Core on new platforms
Shell
5
star
22

BoxGame

A prototype game engine and small sample game using OpenTK and BEPU Physics, running atop CoreCLR.
C#
4
star
23

ApiTools

Repo for some of the tools used in the corefx build, like GenFacades and ApiCompat
C#
3
star
24

Veldrid.Collections

A set of experimental, low-level collections.
C#
3
star
25

coretemplate

A simple template for building .NET Core libraries and applications using MSBuild
C#
3
star
26

mos6502

MOS Technology 6502 CPU emulator
C#
3
star
27

dota2-api-viewer

A very primitive console application for querying some of the Dota 2 Web APIs.
C#
2
star
28

NetworkInformationApp

A small app that prints stuff retrieved from the System.Network.NetworkInformation library.
C#
2
star
29

Veldrid-Legacy

Repository containing old branches of Veldrid
C#
2
star
30

VeldridNSViewExample

A basic example showing how to use Veldrid to render into an NSView.
C#
1
star