Skip to content

Commit a395dfb

Browse files
peterbradenclaude
andcommitted
Add noise module to main.rs imports
Include noise.rs and material/noise.rs in the module declarations to properly support noise functionality in the codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8727331 commit a395dfb

5 files changed

Lines changed: 911 additions & 0 deletions

File tree

demo/scenes/noise-test.json

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
{
2+
"width": 640,
3+
"height": 480,
4+
5+
"supersamples": 35,
6+
"background": [0.2, 0.2, 0.2],
7+
8+
"chunk_size": 64,
9+
"samples_per_chunk": 2,
10+
"shadow_bias": 0.0001,
11+
"max_depth": 2,
12+
13+
"materials": {
14+
"PERLIN_NOISE": {
15+
"type": "noise",
16+
"base_material": "WHITE_PLASTIC",
17+
"noise_type": "perlin",
18+
"color": [0.8, 0.1, 0.1],
19+
"scale": 0.2,
20+
"blend_factor": 0.8
21+
},
22+
"FBM_NOISE": {
23+
"type": "noise",
24+
"base_material": "WHITE_PLASTIC",
25+
"noise_type": "fbm",
26+
"color": [0.1, 0.8, 0.1],
27+
"scale": 0.2,
28+
"blend_factor": 0.8,
29+
"octaves": 4,
30+
"persistence": 0.5,
31+
"lacunarity": 2.0
32+
},
33+
"MARBLE_NOISE": {
34+
"type": "noise",
35+
"base_material": "WHITE_PLASTIC",
36+
"noise_type": "marble",
37+
"color": [0.1, 0.1, 0.8],
38+
"scale": 0.05,
39+
"blend_factor": 0.8
40+
},
41+
"TURBULENCE": {
42+
"type": "noise",
43+
"base_material": "GOLD",
44+
"noise_type": "turbulence",
45+
"color": [0.8, 0.8, 0.2],
46+
"scale": 0.1,
47+
"blend_factor": 0.6,
48+
"octaves": 4
49+
},
50+
"WORLEY": {
51+
"type": "noise",
52+
"base_material": "WHITE_PLASTIC",
53+
"noise_type": "worley",
54+
"color": [0.8, 0.2, 0.8],
55+
"scale": 0.5,
56+
"blend_factor": 0.8,
57+
"point_density": 2.0,
58+
"seed": 42
59+
},
60+
"WHITE_PLASTIC": {
61+
"type": "lambertian",
62+
"albedo": [0.9, 0.9, 0.9]
63+
},
64+
"GOLD": {
65+
"type": "metal",
66+
"reflective": [1, 0.85, 0.57],
67+
"roughness": 0.1
68+
},
69+
"WHITE_MARBLE": {
70+
"type": "lambertian",
71+
"albedo": [0.9, 0.9, 0.9]
72+
},
73+
"BLACK_MARBLE": {
74+
"type": "lambertian",
75+
"albedo": [0.1, 0.1, 0.1]
76+
}
77+
},
78+
"media": {
79+
"CHECKERED_MARBLE": {
80+
"type": "checkered-y-plane",
81+
"m1": "WHITE_MARBLE",
82+
"m2": "BLACK_MARBLE"
83+
}
84+
},
85+
86+
"camera": {
87+
"location": [5, 5, -15],
88+
"lookat" : [0, 2, 0],
89+
"up" : [0, 1, 0],
90+
"angle": 0.8,
91+
"aperture": 0.1
92+
},
93+
94+
"lights" : [],
95+
"variables" : {},
96+
97+
"objects": [
98+
{
99+
"type": "sphere",
100+
"radius": 2,
101+
"location": [-5, 2, 0],
102+
"material" : "PERLIN_NOISE"
103+
},
104+
{
105+
"type": "sphere",
106+
"radius": 2,
107+
"location": [-2, 2, 4],
108+
"material" : "FBM_NOISE"
109+
},
110+
{
111+
"type": "sphere",
112+
"radius": 2,
113+
"location": [2, 2, 4],
114+
"material" : "MARBLE_NOISE"
115+
},
116+
{
117+
"type": "sphere",
118+
"radius": 2,
119+
"location": [5, 2, 0],
120+
"material" : "TURBULENCE"
121+
},
122+
{
123+
"type": "sphere",
124+
"radius": 2,
125+
"location": [0, 2, -5],
126+
"material" : "WORLEY"
127+
},
128+
{
129+
"type" : "checkeredplane",
130+
"y": 0,
131+
"medium" : "CHECKERED_MARBLE"
132+
},
133+
{
134+
"type" : "skysphere"
135+
}
136+
]
137+
}

src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ mod material {
3434
pub mod functions;
3535
pub mod legacy;
3636
pub mod plastic;
37+
pub mod noise;
3738
}
3839
mod intersection;
3940
mod sceneobject;
@@ -67,6 +68,7 @@ mod procedural {
6768
pub mod fireworks;
6869
}
6970
mod participatingmedia;
71+
mod noise;
7072

7173
use crate::trace::trace;
7274
use crate::rendercontext::RenderContext;

src/material/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,23 @@ pub enum SamplesRequired {
6060
Many, // Can only be derived from a Monte-Carlo integration of many samples.
6161
}
6262

63+
// Module declarations
64+
pub mod ambient;
65+
pub mod dielectric;
66+
pub mod diffuse_light;
67+
pub mod functions;
68+
pub mod lambertian;
69+
pub mod legacy;
70+
pub mod model;
71+
pub mod normal;
72+
pub mod noise;
73+
pub mod plastic;
74+
pub mod specular;
75+
pub mod texture;
76+
77+
// Re-export noise module components for external use
78+
pub use noise::{NoiseTexture, NoiseType};
79+
6380
/*
6481
pub trait BSDFToRename{
6582

0 commit comments

Comments
 (0)