R3D-cs 0.9.0

dotnet add package R3D-cs --version 0.9.0
                    
NuGet\Install-Package R3D-cs -Version 0.9.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="R3D-cs" Version="0.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="R3D-cs" Version="0.9.0" />
                    
Directory.Packages.props
<PackageReference Include="R3D-cs" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add R3D-cs --version 0.9.0
                    
#r "nuget: R3D-cs, 0.9.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package R3D-cs@0.9.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=R3D-cs&version=0.9.0
                    
Install as a Cake Addin
#tool nuget:?package=R3D-cs&version=0.9.0
                    
Install as a Cake Tool

R3D-cs Logo

R3D-cs

CI NuGet NuGet Downloads

.NET/C# bindings for r3d, an advanced 3D rendering library built on top of raylib.

Experimental: This package is in early development. APIs may change between versions.

Note: r3d itself is under heavy development and has not reached version 1.0. Expect breaking changes in the underlying library as well.

Important: For now this package includes its own raylib.dll from r3d with some features enabled (like HDR file loading). This will overwrite the native library provided by raylib-cs.

Installation - NuGet (Easy mode)

dotnet add package R3D-cs --prerelease

Installation - Manual (Hard mode)

  1. Clone the repo with submodules:
    git clone --recursive https://github.com/graphnode/r3d-cs.git
    
  2. Add the R3D-cs project to your solution as an existing project.
  3. Build the native libraries from the External/r3d submodule (see Building) and copy them to R3D-cs/runtimes/<rid>/native/.

Requirements

  • .NET 10.0 or later (might work with earlier versions but not tested)
  • Raylib-cs (included as a dependency)
  • Native r3d library for your platform (included in package)

Quick Start

using System.Numerics;
using Raylib_cs;
using R3D_cs;

// Initialize window
Raylib.InitWindow(800, 450, "[r3d] - Basic example");
Raylib.SetTargetFPS(60);

// Initialize R3D
R3D.Init(Raylib.GetScreenWidth(), Raylib.GetScreenHeight());

// Create meshes
var plane = R3D.GenMeshPlane(1000, 1000, 1, 1);
var sphere = R3D.GenMeshSphere(0.5f, 64, 64);
var material = R3D.GetDefaultMaterial();

// Setup environment
var env = R3D.GetEnvironmentEx();
env.Ambient.Color = new Color(10, 10, 10, 255);
R3D.SetEnvironmentEx(env);

// Create light
Light light = R3D.CreateLight(LightType.Spot);
R3D.LightLookAt(light, new Vector3(0, 10, 5), Vector3.Zero);
R3D.EnableShadow(light);
R3D.SetLightActive(light, true);

// Setup camera
var camera = new Camera3D() {
    Position = new Vector3(0, 2, 2),
    Target = Vector3.Zero,
    Up = new Vector3(0, 1, 0),
    FovY = 60
};

// Main loop
while (!Raylib.WindowShouldClose())
{
    Raylib.UpdateCamera(ref camera, CameraMode.Orbital);

    Raylib.BeginDrawing();
        Raylib.ClearBackground(Color.RayWhite);

        R3D.Begin(camera);
            R3D.DrawMesh(plane, material, new Vector3(0, -0.5f, 0), 1.0f);
            R3D.DrawMesh(sphere, material, Vector3.Zero, 1.0f);
        R3D.End();
    Raylib.EndDrawing();
}

// Cleanup
R3D.UnloadMesh(sphere);
R3D.UnloadMesh(plane);
R3D.Close();

Raylib.CloseWindow();

Alternatives

  • R3d.Net - .NET bindings for r3d by Kiriller12

Documentation

Building

dotnet build R3D-cs.sln

Updating r3d upstream

The r3d source is included as a git submodule at External/r3d. To update to a newer version:

cd External/r3d
git fetch origin
git checkout <new-tag-or-commit>   # e.g. git checkout v0.9
cd ../..
git add External/r3d

After updating, regenerate the bindings and rebuild the native libraries:

# Regenerate C# bindings
cd R3D-cs.GenerateBindings
dotnet run

# Build native libraries for local testing
cd ../External/r3d
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
      -DR3D_ASSIMP_VENDORED=ON -DR3D_RAYLIB_VENDORED=ON
cmake --build build --config Release

Contributing

Feel free to open an issue. If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are welcome.

License

This project is licensed under the zlib license. See r3d for the original library license.

Acknowledgements

We're grateful to the raylib, r3d, raylib-cs, and r3d-net developers for their outstanding contributions to the raylib community. This project's structure, documentation, and packaging are all inspired by their excellent work.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.0 105 3/28/2026
0.8.2 112 2/16/2026
0.8.1 117 2/10/2026
0.8.0 102 2/10/2026
0.8.0-dev.1 55 2/10/2026
0.7.0-alpha.33f10e7 56 1/30/2026