Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ Rays.rust is a raytracer written in Rust with the following features:
- Modules organized by functionality (material, shapes, procedural)
- Scene definitions stored in JSON files (in demo/ and demo/scenes/)
- Rendering progress tracking via indicatif
- Sample scenes available in demo/scenes/ with corresponding .png outputs
- Sample scenes available in demo/scenes/ with corresponding .png outputs

## Development Best Practices
- Make small, incremental changes focused on a single concern
- Break complex features into smaller, sequential commits
- Commit frequently to create checkpoints (after each logical change)
- Run tests and linting before each commit
- Create dedicated branches for each distinct feature
- Write descriptive commit messages explaining the purpose of changes
- Keep feature branches simple and focused on a single goal
- Verify each change works before moving to the next step
150 changes: 150 additions & 0 deletions demo/scenes/noise-medium-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"width": 640,
"height": 480,

"supersamples": 35,
"background": [0.2, 0.2, 0.2],

"chunk_size": 64,
"samples_per_chunk": 2,
"shadow_bias": 0.0001,
"max_depth": 2,

"materials": {
"RED_PLASTIC": {
"type": "lambertian",
"albedo": [0.9, 0.1, 0.1]
},
"BLUE_PLASTIC": {
"type": "lambertian",
"albedo": [0.1, 0.1, 0.9]
},
"GREEN_PLASTIC": {
"type": "lambertian",
"albedo": [0.1, 0.9, 0.1]
},
"GOLD": {
"type": "metal",
"reflective": [1, 0.85, 0.57],
"roughness": 0.1
},
"GLASS": {
"type": "dielectric",
"refractive_index": 1.5,
"attenuate": [0.95, 0.95, 0.95]
},
"WHITE_MARBLE": {
"type": "lambertian",
"albedo": [0.9, 0.9, 0.9]
},
"BLACK_MARBLE": {
"type": "lambertian",
"albedo": [0.1, 0.1, 0.1]
}
},
"media": {
"PERLIN_NOISE_MEDIUM": {
"type": "noise_medium",
"m1": "RED_PLASTIC",
"m2": "BLUE_PLASTIC",
"noise_type": "perlin",
"scale": 0.2,
"threshold": 0.5
},
"FBM_NOISE_MEDIUM": {
"type": "noise_medium",
"m1": "GREEN_PLASTIC",
"m2": "GOLD",
"noise_type": "fbm",
"scale": 0.2,
"threshold": 0.5,
"octaves": 4,
"persistence": 0.5,
"lacunarity": 2.0
},
"MARBLE_NOISE_MEDIUM": {
"type": "noise_medium",
"m1": "WHITE_MARBLE",
"m2": "BLACK_MARBLE",
"noise_type": "marble",
"scale": 0.05,
"threshold": 0.5
},
"WORLEY_NOISE_MEDIUM": {
"type": "noise_medium",
"m1": "GLASS",
"m2": "GOLD",
"noise_type": "worley",
"scale": 0.5,
"threshold": 0.5,
"point_density": 2.0,
"seed": 42
},
"COMBINED_NOISE_MEDIUM": {
"type": "noise_medium",
"m1": "RED_PLASTIC",
"m2": "GREEN_PLASTIC",
"noise_type": "combined",
"scale": 0.1,
"threshold": 0.5,
"falloff": 0.05
},
"CHECKERED_MARBLE": {
"type": "checkered-y-plane",
"m1": "WHITE_MARBLE",
"m2": "BLACK_MARBLE"
}
},

"camera": {
"location": [5, 5, -15],
"lookat" : [0, 2, 0],
"up" : [0, 1, 0],
"angle": 0.8,
"aperture": 0.1
},

"lights" : [],
"variables" : {},

"objects": [
{
"type": "sphere",
"radius": 2,
"location": [-5, 2, 0],
"medium" : "PERLIN_NOISE_MEDIUM"
},
{
"type": "sphere",
"radius": 2,
"location": [-2, 2, 4],
"medium" : "FBM_NOISE_MEDIUM"
},
{
"type": "sphere",
"radius": 2,
"location": [2, 2, 4],
"medium" : "MARBLE_NOISE_MEDIUM"
},
{
"type": "sphere",
"radius": 2,
"location": [5, 2, 0],
"medium" : "WORLEY_NOISE_MEDIUM"
},
{
"type": "sphere",
"radius": 2,
"location": [0, 2, -5],
"medium" : "COMBINED_NOISE_MEDIUM"
},
{
"type" : "checkeredplane",
"y": 0,
"medium" : "CHECKERED_MARBLE"
},
{
"type" : "skysphere"
}
]
}
Binary file added demo/scenes/noise-medium-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
169 changes: 169 additions & 0 deletions demo/scenes/noise-simple-demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"width": 800,
"height": 600,

"supersamples": 35,
"background": [0.05, 0.05, 0.1],

"chunk_size": 64,
"samples_per_chunk": 2,
"shadow_bias": 0.0001,
"max_depth": 2,

"materials": {
"BRIGHT_RED": {
"type": "lambertian",
"albedo": [1.0, 0.0, 0.0]
},
"BRIGHT_GREEN": {
"type": "lambertian",
"albedo": [0.0, 1.0, 0.0]
},
"BRIGHT_BLUE": {
"type": "lambertian",
"albedo": [0.0, 0.0, 1.0]
},
"BRIGHT_YELLOW": {
"type": "lambertian",
"albedo": [1.0, 1.0, 0.0]
},
"BRIGHT_CYAN": {
"type": "lambertian",
"albedo": [0.0, 1.0, 1.0]
},
"BRIGHT_MAGENTA": {
"type": "lambertian",
"albedo": [1.0, 0.0, 1.0]
},
"WHITE": {
"type": "lambertian",
"albedo": [1.0, 1.0, 1.0]
},
"BLACK": {
"type": "lambertian",
"albedo": [0.0, 0.0, 0.0]
}
},
"media": {
"PERLIN_NOISE": {
"type": "noise_medium",
"m1": "BRIGHT_RED",
"m2": "BRIGHT_BLUE",
"noise_type": "perlin",
"scale": 0.15,
"threshold": 0.5
},
"FBM_NOISE": {
"type": "noise_medium",
"m1": "BRIGHT_GREEN",
"m2": "BRIGHT_MAGENTA",
"noise_type": "fbm",
"scale": 0.15,
"threshold": 0.5,
"octaves": 4,
"persistence": 0.5,
"lacunarity": 2.0
},
"MARBLE_NOISE": {
"type": "noise_medium",
"m1": "WHITE",
"m2": "BLACK",
"noise_type": "marble",
"scale": 0.05,
"threshold": 0.5
},
"WORLEY_NOISE": {
"type": "noise_medium",
"m1": "BRIGHT_CYAN",
"m2": "BRIGHT_YELLOW",
"noise_type": "worley",
"scale": 0.4,
"threshold": 0.5,
"point_density": 2.0,
"seed": 42
},
"COMBINED_NOISE": {
"type": "noise_medium",
"m1": "BRIGHT_RED",
"m2": "BRIGHT_GREEN",
"noise_type": "combined",
"scale": 0.1,
"threshold": 0.5,
"falloff": 0.05
},
"TURBULENCE_NOISE": {
"type": "noise_medium",
"m1": "BRIGHT_BLUE",
"m2": "BRIGHT_YELLOW",
"noise_type": "turbulence",
"scale": 0.15,
"threshold": 0.5,
"octaves": 4,
"persistence": 0.5,
"lacunarity": 2.0
},
"CHECKERED_FLOOR": {
"type": "checkered-y-plane",
"m1": "WHITE",
"m2": "BLACK"
}
},

"camera": {
"location": [0, 6, -18],
"lookat" : [0, 3, 0],
"up" : [0, 1, 0],
"angle": 0.8,
"aperture": 0.05
},

"lights" : [],
"variables" : {},

"objects": [
{
"type": "sphere",
"radius": 2,
"location": [-6, 3, 0],
"medium" : "PERLIN_NOISE"
},
{
"type": "sphere",
"radius": 2,
"location": [-3, 3, 3],
"medium" : "FBM_NOISE"
},
{
"type": "sphere",
"radius": 2,
"location": [0, 3, 4],
"medium" : "MARBLE_NOISE"
},
{
"type": "sphere",
"radius": 2,
"location": [3, 3, 3],
"medium" : "WORLEY_NOISE"
},
{
"type": "sphere",
"radius": 2,
"location": [6, 3, 0],
"medium" : "COMBINED_NOISE"
},
{
"type": "sphere",
"radius": 2,
"location": [0, 3, -3],
"medium" : "TURBULENCE_NOISE"
},
{
"type" : "checkeredplane",
"y": 0,
"medium" : "CHECKERED_FLOOR"
},
{
"type" : "skysphere"
}
]
}
Binary file added demo/scenes/noise-simple-demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading