{"id":19112741,"url":"https://github.com/pgrit/seesharp","last_synced_at":"2025-09-10T19:41:15.386Z","repository":{"id":44871027,"uuid":"249547919","full_name":"pgrit/SeeSharp","owner":"pgrit","description":"A cross-platform framework for rendering algorithm research. Written in C#.","archived":false,"fork":false,"pushed_at":"2025-07-23T14:41:43.000Z","size":33402,"stargazers_count":26,"open_issues_count":2,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-22T06:53:16.409Z","etag":null,"topics":["csharp","raytracing","renderer"],"latest_commit_sha":null,"homepage":"","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/pgrit.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,"zenodo":null}},"created_at":"2020-03-23T21:27:38.000Z","updated_at":"2025-07-23T14:41:46.000Z","dependencies_parsed_at":"2023-11-08T02:47:23.451Z","dependency_job_id":"d8a7db2f-4fc2-4407-ac2f-ebd04f8e509c","html_url":"https://github.com/pgrit/SeeSharp","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/pgrit/SeeSharp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2FSeeSharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2FSeeSharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2FSeeSharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2FSeeSharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgrit","download_url":"https://codeload.github.com/pgrit/SeeSharp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgrit%2FSeeSharp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274514071,"owners_count":25299803,"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","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","raytracing","renderer"],"created_at":"2024-11-09T04:34:00.422Z","updated_at":"2025-09-10T19:41:15.320Z","avatar_url":"https://github.com/pgrit.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"logo.png\" width=120 height=120 alt=\"SeeSharp Logo\" /\u003e\n\n![Build](https://github.com/pgrit/SeeSharp/workflows/Build/badge.svg)\n\u003ca href=\"https://www.nuget.org/packages/SeeSharp/\"\u003e\n    ![NuGet Version](https://img.shields.io/nuget/v/SeeSharp)\n\u003c/a\u003e\n\n# SeeSharp\n\nSeeSharp is a flexibility-first framework for rapid prototyping of rendering algorithms.\nCurrently, it only works with triangle meshes and only handles surface interactions.\nThe framework implements some basic integrators, namely unidirectional and bidirectional path tracing,\nphoton mapping, and vertex connection and merging.\nThese offer a range of virtual functions to easily and cleanly inject additional logic, like\nbetter importance sampling, path guiding, and so on.\n\nImages being rendered can be streamed interactively to the [tev](https://github.com/tom94/tev) image viewer, via sockets.\n\nAdditionally, the framework offers utility classes to render comparisons of different integrators and/or settings.\nThat is, we use C# to implement the integrators and logic, and as the scripting language to run experiments.\n\nAn example of how to successfully use this framework to conduct experiments for a research paper can be found\nin the implementation of our [EG 2021 paper on correlation-aware MIS](https://github.com/pgrit/MisForCorrelatedBidir).\n\n## Getting started\n\n### Dependencies\n\nWe use [TinyEmbree](https://github.com/pgrit/TinyEmbree), a simple C# wrapper around [Embree](https://www.embree.org/),\nfor ray tracing, and [SimpleImageIO](https://github.com/pgrit/SimpleImageIO), a C# wrapper around [TinyEXR](https://github.com/syoyo/tinyexr) and\n[stb_image](https://github.com/nothings/stb). On 64 Bit Windows, Linux, or macOS, you should be able to use the pre-built binaries included in the\nnuget packages. These are linked by default, so you do not need to do anything and can skip ahead to the next section.\n\nOn other platforms you will need to build these from source. Instructions how to do that can be found in the respective README.md files.\nAfter building your platform specific version of these, the easiest way is to pack them as a local nuget package.\nFor example:\n\n```\nmkdir ~/LocalNuget\ndotnet nuget add source ~/LocalNuget\n\ncd [TinyEmbree ROOT]\ndotnet pack -c Release\ncp TinyEmbree/bin/Release/TinyEmbree.[VERSION].nupkg ~/LocalNuget\n```\n\nAn alternative is to replace the `\u003cPackageReference .../\u003e` in `SeeSharp.csproj` by a `\u003cProjectReference .../\u003e` to your local\nTinyEmbree.csproj, which also allows you to more easily modify both.\n\n\u003e **Note**: The .fbx loader is currently relying on Assimp.NET. On Linux (and maybe MacOS) you might see a\n\u003e \"library not found\" exception for `libassimp.so`. In that case, you need to manually install  `libminizip`.\n\u003e (Linking `libassimp.so` fails if that dependency is not found. It is not bundled in the NuGet package).\n\n### Testing\n\nThe unit tests can be run via a simple\n\n```\ndotnet test\n```\n\nThe validation test, which ensure that all integrators agree on the same results for a number of trivial test scenes,\ncan be run in Release mode via:\n\n```\ndotnet run --project SeeSharp.Validation -c Release\n```\n\nNote that the validation tests assume that they are run from within the root directory of this project, as they\nrely on some scene files stored in the `Data` directory.\n\n### Exporting a scene from Blender\n\nSeeSharp comes with a very basic Blender add-on. The `see_blender.zip` file is automatically [built for each release](https://github.com/pgrit/SeeSharp/releases). You can install it in Blender via `Edit -\u003e Preferences -\u003e Add-ons -\u003e Install...`. Check [the docs](https://docs.blender.org/manual/en/latest/editors/preferences/addons.html) for more details.\n\nWhen building locally, you can run `build_blender.bat` or `build_blender.sh` to generate the Blender add-on.\n\nThe add-on currently handles two things: exporting a scene to our `.json` format and rendering a preview when hitting F12 (final render only, viewport rendering not yet supported). These are very rudimentary and might not work for all possible Blender features and scene configurations.\nAlso, the add-on offers some basic GUI support to configure material parameters and add an HDR background.\n\nSome simple Cycles materials can be converted to a SeeSharp material. Currently, there is a coarse mapping from:\n\n- DiffuseBSDF: either with a constant color or a texture, roughness is ignored\n- PrincipledBSDF: roughly mapped to our GenericMaterial, which currently ignores SSS, sheen, and clearcoat. Also,\nonly BaseColor and roughness can be textured at the moment\n- Emission: mapped to a diffuse black body emitter\n- The viewport preview color and roughness, if all else fails\n\nFor most existing scenes, you will need to manually simplify the usually complex shader graphs to\none of the above, else only the viewport settings will be used.\n\nAll materials in the entire scene can be converted via `File -\u003e Import -\u003e Convert all materials to SeeSharp`.\nConverting an individual material is also possible, via a button in that material's parameter settings.\n\n### Conducting an experiment\n\n### With a project\n\nSeeSharp is designed to be used as a library, to write rendering experiments with.\nTo get started, you should first create a new console application that will contain you experiment set-up,\nas well as any additional algorithms or other changes you will introduce.\n\n```\ndotnet new console -o MyFirstExperiment\ncd MyFirstExperiment\ndotnet add package SeeSharp\n```\n\nNow, you can implement new or derived integrators and write your own experiment setup,\nfor instance by deriving a class from `ExperimentFactory`.\n\n### In a script\n\nAnother option is to use [.NET interactive](https://github.com/dotnet/interactive) in a Jupyter notebook.\nOr, you could write a [C# script](https://github.com/filipw/dotnet-script) or F# script.\n\nThe following example of a .csx script conducts an experiment that compares a path tracer to the vertex connection and merging algorithm, at equal sample count:\n```C#\n#r \"nuget: SeeSharp, 1.4.0\"\n\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing SeeSharp.Experiments;\nusing SeeSharp.Image;\nusing SeeSharp.Integrators;\nusing SeeSharp.Integrators.Bidir;\n\n// Configure an experiment that compares VCM and path tracing.\nclass PathVsVcm : Experiment {\n    public override List\u003cMethod\u003e MakeMethods() =\u003e new() {\n        new(\"PathTracer\", new PathTracer() { MaxDepth = 5, TotalSpp = 4 }),\n        new(\"Vcm\", new VertexConnectionAndMerging() { MaxDepth = 5, NumIterations = 2 })\n    };\n}\n\n// Register the directory as a scene file provider.\n// Asides from the geometry, it is also used as a reference image cache.\nSceneRegistry.AddSource(\"Data/Scenes\");\n\n// Configure a benchmark to compare path tracing and VCM on the CornellBox\n// at 512x512 resolution. Display images in tev during rendering (localhost, default port)\nBenchmark benchmark = new(new PathVsVcm(), new() {\n    SceneRegistry.LoadScene(\"CornellBox\", maxDepth: 5),\n    SceneRegistry.LoadScene(\"CornellBox\", maxDepth: 2).WithName(\"CornellBoxDirectIllum\")\n}, \"Results/PathVsVcm\", 512, 512, FrameBuffer.Flags.SendToTev);\n\n// Render the images\nbenchmark.Run(format: \".exr\");\n\n// Optional, but usually a good idea: assemble the rendering results in an overview\n// figure using a Python script.\nProcess.Start(\"python\", \"./SeeSharp.Examples/MakeFigure.py Results/PathVsVcm PathTracer Vcm\")\n    .WaitForExit();\n\n// For our README file, we further convert the pdf to png with ImageMagick\nProcess.Start(\"magick\", \"-density 300 ./Results/PathVsVcm/Overview.pdf ExampleFigure.png\")\n    .WaitForExit();\n```\n\nThe first line automatically downloads and installs the SeeSharp package using nuget. Hence, you can simply run the experiment via:\n\n\n```\ndotnet script MyExperiment.csx\n```\n\nAlternatively, you could paste the same code in the cells of a .ipynb and run it with Jupyter. Then, you can even display the generated figure right underneath.\n\nIn this example, we automatically invoke Python, which is assumed to be in the PATH,\nto assemble the rendered images in a comparison figure. We use [figuregen](https://github.com/Mira-13/figure-gen) for that, so make sure to run:\n\n```\npython -m pip install figuregen\n```\n\nAnd here's the generated overview figure:\n\n![](ExampleFigure.png)\n\nThe project-file based version of this example, as well as the [MakeFigure.py](SeeSharp.Examples/MakeFigure.py) script, can be found in the [SeeSharp.Examples](SeeSharp.Examples) directory.\n\n## Coding conventions\n\nThe framework loosely follows the following coding conventions:\n\n- Class names, method names, properties, and public fields are PascalCase\n- Private fields, parameters, and local variables are camelCase\n- Opening brackets are on the same line\n- Lines should be less than 110 characters long, for better readability and comparisons\n\nThe .editorconfig and omnisharp.json files configure some of these conventions for Visual Studio and VS Code, respectively.\n\nExample:\n\n```C#\nclass SomeClass {\n    public int PublicField = 1;\n    public int PublicProperty =\u003e 13;\n    public void ComputeSomething(byte complexParameterName, int anotherVeryLongParameterName,\n                                 SomeClass mysteriousParameterThatIsNotNamedWell) {\n        if (complexParameterName == PublicProperty) {\n            int localName = 5;\n            implementationDetail = $\"SeeSharp {localName}\";\n        }\n    }\n    string implementationDetail;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgrit%2Fseesharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgrit%2Fseesharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgrit%2Fseesharp/lists"}