Skip to content

ALEXMORF/Spectra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 

Repository files navigation

Spectra

A real-time SDF pathtracer. Edit your SDFs and see it pathtraced interactively.

LIVE DEMO

Build it

Load cl.exe into environment variable, then invoke code/build.bat to generate the binary.

Usage

Build Spectra and run it. While the application is running, you can edit code/scene.hlsl and the changes will be hotloaded in real-time.

To make this work, you need to define the following three functions in scene.hlsl file:

// user-defined functions:

point_query Map(float3 P, float Time)
{
  // define geometry
}

material MapMaterial(int MatId, float3 P, float Time)
{
  // define material
}

float3 Env(float3 Rd, float Time)
{
  // define environment lighting
}

float Fog(float Depth)
{
  // define fog attenuation
}

To see how these functions are getting called, check out raymarch.hlsl and primary_shading.hlsl.

Examples

Also, the source comes with some example scenes I've made in the form of include files:


#include "sphere.hlsl"
//#include "cornellbox.hlsl"
//#include "tron.hlsl"
...
...

Selectively un-comment the scene you want to see. Here are some screenshots of these stock scenes I've prepared:

tunnel.hlsl: tunnel

sphere.hlsl: sphere

cornellbox.hlsl: cornellbox

tron.hlsl: tron

coolbox.hlsl: coolbox

interior.hlsl: interior

About

a real-time SDF pathtracer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published