img-phy-sim 0.3__tar.gz → 0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {img_phy_sim-0.3/img_phy_sim.egg-info → img_phy_sim-0.8}/PKG-INFO +224 -34
- img_phy_sim-0.3/PKG-INFO → img_phy_sim-0.8/README.md +187 -39
- {img_phy_sim-0.3 → img_phy_sim-0.8}/img_phy_sim/__init__.py +16 -0
- img_phy_sim-0.8/img_phy_sim/data.py +417 -0
- img_phy_sim-0.8/img_phy_sim/eval.py +146 -0
- {img_phy_sim-0.3 → img_phy_sim-0.8}/img_phy_sim/img.py +35 -8
- img_phy_sim-0.8/img_phy_sim/ism.py +828 -0
- img_phy_sim-0.8/img_phy_sim/ism_slow.py +498 -0
- img_phy_sim-0.8/img_phy_sim/math.py +185 -0
- {img_phy_sim-0.3 → img_phy_sim-0.8}/img_phy_sim/ray_tracing.py +59 -54
- img_phy_sim-0.3/README.md → img_phy_sim-0.8/img_phy_sim.egg-info/PKG-INFO +236 -25
- {img_phy_sim-0.3 → img_phy_sim-0.8}/img_phy_sim.egg-info/SOURCES.txt +4 -0
- img_phy_sim-0.8/img_phy_sim.egg-info/requires.txt +12 -0
- img_phy_sim-0.8/pyproject.toml +4 -0
- img_phy_sim-0.8/setup.py +84 -0
- img_phy_sim-0.3/img_phy_sim/math.py +0 -154
- img_phy_sim-0.3/img_phy_sim.egg-info/requires.txt +0 -4
- img_phy_sim-0.3/pyproject.toml +0 -28
- img_phy_sim-0.3/setup.py +0 -41
- {img_phy_sim-0.3 → img_phy_sim-0.8}/img_phy_sim.egg-info/dependency_links.txt +0 -0
- {img_phy_sim-0.3 → img_phy_sim-0.8}/img_phy_sim.egg-info/top_level.txt +0 -0
- {img_phy_sim-0.3 → img_phy_sim-0.8}/setup.cfg +0 -0
|
@@ -1,23 +1,44 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: img-phy-sim
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
5
|
-
Home-page: https://github.com/
|
|
6
|
-
Download-URL: https://github.com/
|
|
3
|
+
Version: 0.8
|
|
4
|
+
Summary: Physical Simulations on Images.
|
|
5
|
+
Home-page: https://github.com/M-106/Image-Physics-Simulation
|
|
6
|
+
Download-URL: https://github.com/M-106/Image-Physics-Simulation/archive/v_04.tar.gz
|
|
7
7
|
Author: Tobia Ippolito
|
|
8
|
-
|
|
9
|
-
Project-URL:
|
|
10
|
-
|
|
8
|
+
Project-URL: Documentation, https://M-106.github.io/Image-Physics-Simulation/img_phy_sim
|
|
9
|
+
Project-URL: Source, https://github.com/M-106/Image-Physics-Simulation
|
|
10
|
+
Keywords: Simulation,Computer-Vision,Physgen
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier:
|
|
13
|
-
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
19
|
Description-Content-Type: text/markdown
|
|
15
20
|
Requires-Dist: numpy
|
|
16
21
|
Requires-Dist: opencv-python
|
|
17
22
|
Requires-Dist: matplotlib
|
|
18
23
|
Requires-Dist: scikit-image
|
|
24
|
+
Requires-Dist: joblib
|
|
25
|
+
Requires-Dist: shapely
|
|
26
|
+
Provides-Extra: full
|
|
27
|
+
Requires-Dist: torch; extra == "full"
|
|
28
|
+
Requires-Dist: torchvision; extra == "full"
|
|
29
|
+
Requires-Dist: datasets==3.6.0; extra == "full"
|
|
30
|
+
Requires-Dist: prime_printer; extra == "full"
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: classifier
|
|
33
|
+
Dynamic: description
|
|
34
|
+
Dynamic: description-content-type
|
|
19
35
|
Dynamic: download-url
|
|
20
36
|
Dynamic: home-page
|
|
37
|
+
Dynamic: keywords
|
|
38
|
+
Dynamic: project-url
|
|
39
|
+
Dynamic: provides-extra
|
|
40
|
+
Dynamic: requires-dist
|
|
41
|
+
Dynamic: summary
|
|
21
42
|
|
|
22
43
|
# **I**mage-**P**hysics-**S**imulation
|
|
23
44
|
|
|
@@ -31,10 +52,14 @@ Contents:
|
|
|
31
52
|
- [Raytracing Computation](#raytracing-computation)
|
|
32
53
|
- [Raytracing Tutorial](#raytracing-tutorial)
|
|
33
54
|
- [Performance Test](#performance-test)
|
|
55
|
+
- [Ray-Tracing Formats](#ray-tracing-formats)
|
|
34
56
|
|
|
35
|
-
[> Documentation <](https://
|
|
57
|
+
[> Documentation <](https://M-106.github.io/Image-Physics-Simulation/img_phy_sim.html)
|
|
36
58
|
|
|
37
|
-
<img src="
|
|
59
|
+
<img src="https://github.com/M-106/Image-Physics-Simulation/raw/main/img_phy_sim/raytracing_example.png" width="46%"></img>
|
|
60
|
+
<img src="https://github.com/M-106/Image-Physics-Simulation/raw/main/img_phy_sim/ism_example.png" width="46%"></img>
|
|
61
|
+
|
|
62
|
+
> Ray-Beams and ISM
|
|
38
63
|
|
|
39
64
|
<br><br>
|
|
40
65
|
|
|
@@ -45,18 +70,27 @@ This repo only need some basic libraries:
|
|
|
45
70
|
- `matplotlib`
|
|
46
71
|
- `opencv-python`
|
|
47
72
|
- `scikit-image`
|
|
73
|
+
- `joblib`
|
|
74
|
+
|
|
75
|
+
If you want to use the `data` module then this package needs also:
|
|
76
|
+
- `torch`
|
|
77
|
+
- `torchvision`
|
|
78
|
+
- `datasets`
|
|
79
|
+
- `prime_printer`
|
|
48
80
|
|
|
49
81
|
You can download / clone this repo and run the example notebook via following Python/Anaconda setup:
|
|
50
82
|
```bash
|
|
51
83
|
conda create -n img-phy-sim python=3.13 pip -y
|
|
52
84
|
conda activate img-phy-sim
|
|
53
|
-
pip install numpy matplotlib opencv-python ipython jupyter shapely prime_printer datasets==3.6.0 scikit-image
|
|
85
|
+
pip install numpy matplotlib opencv-python ipython jupyter shapely prime_printer datasets==3.6.0 scikit-image joblib shapely
|
|
54
86
|
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
|
|
55
87
|
```
|
|
56
88
|
|
|
57
89
|
You can also use this repo via [Python Package Index (PyPI)](https://pypi.org/) as a package:
|
|
58
90
|
```bash
|
|
59
91
|
pip install img-phy-sim
|
|
92
|
+
# or for using `data` module:
|
|
93
|
+
pip install img-phy-sim[full]
|
|
60
94
|
```
|
|
61
95
|
|
|
62
96
|
Here the instructions to use the package version of `ips` and an anconda setup:
|
|
@@ -64,11 +98,13 @@ Here the instructions to use the package version of `ips` and an anconda setup:
|
|
|
64
98
|
conda create -n img-phy-sim python=3.13 pip -y
|
|
65
99
|
conda activate img-phy-sim
|
|
66
100
|
pip install img-phy-sim
|
|
101
|
+
# or for using `data` module:
|
|
102
|
+
pip install img-phy-sim[full]
|
|
67
103
|
```
|
|
68
104
|
|
|
69
|
-
To run the example code you
|
|
105
|
+
To run the example code you also need (this is included in `img-phy-sim[full]`):
|
|
70
106
|
```bash
|
|
71
|
-
pip install prime_printer
|
|
107
|
+
pip install prime_printer datasets==3.6.0
|
|
72
108
|
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
|
|
73
109
|
```
|
|
74
110
|
|
|
@@ -76,20 +112,20 @@ pip install torch torchvision torchaudio --index-url https://download.pytorch.or
|
|
|
76
112
|
|
|
77
113
|
### Download Example Data
|
|
78
114
|
|
|
79
|
-
You can download Physgen data if wanted via the `
|
|
115
|
+
You can download Physgen data if wanted via the `data.py` using following commands:
|
|
80
116
|
|
|
81
117
|
```bash
|
|
82
118
|
conda activate img-phy-sim
|
|
83
|
-
cd "D:\Informatik\Projekte\Image-Physics-Simulation" && D:
|
|
84
|
-
python
|
|
119
|
+
cd "D:\Informatik\Projekte\Image-Physics-Simulation\img_phy_sim" && D:
|
|
120
|
+
python data.py --output_real_path ./datasets/physgen_train_raw/real --output_osm_path ./datasets/physgen_train_raw/osm --variation sound_reflection --input_type osm --output_type standard --data_mode train
|
|
85
121
|
```
|
|
86
122
|
|
|
87
123
|
```bash
|
|
88
|
-
python
|
|
124
|
+
python data.py --output_real_path ./datasets/physgen_test_raw/real --output_osm_path ./datasets/physgen_test_raw/osm --variation sound_reflection --input_type osm --output_type standard --data_mode test
|
|
89
125
|
```
|
|
90
126
|
|
|
91
127
|
```bash
|
|
92
|
-
python
|
|
128
|
+
python data.py --output_real_path ./datasets/physgen_val_raw/real --output_osm_path ./datasets/physgen_val_raw/osm --variation sound_reflection --input_type osm --output_type standard --data_mode validation
|
|
93
129
|
```
|
|
94
130
|
|
|
95
131
|
<br><br>
|
|
@@ -183,6 +219,23 @@ class PhysGenDataset(Dataset):
|
|
|
183
219
|
- `open`: load your saved rays txt file
|
|
184
220
|
- `get_linear_degree_range`: get a range for your beam-directions -> example beams between 0-360 with stepsize 10
|
|
185
221
|
- `merge_rays`: merge 2 rays to one 'object'
|
|
222
|
+
- `ism`
|
|
223
|
+
- `reflect_point_across_infinite_line`: Reflects a point across the infinite line defined by two endpoints
|
|
224
|
+
- `paths_to_rays`: Converts polyline paths into your ray/segment representation, optionally normalizing points to ([0,1]) image space
|
|
225
|
+
- `reflection_map_to_img`: Normalizes a float reflection/energy map to a uint8 visualization image in ([0,255])
|
|
226
|
+
- `Segment`: Immutable dataclass representing a 2D line segment with convenience access to its endpoints
|
|
227
|
+
- `_seg_seg_intersection`: Computes the unique intersection point of two finite 2D segments, returning None for parallel/colinear/no-hit cases
|
|
228
|
+
- `_bresenham_points`: Generates all integer grid points along a line between two pixels using Bresenham’s algorithm
|
|
229
|
+
- `is_visible_raster`: Tests line-of-sight between two points by checking whether Bresenham-sampled pixels hit an occlusion raster
|
|
230
|
+
- `build_wall_mask`: Builds a binary 0/255 wall mask from an input image using explicit wall labels or mask-like heuristics
|
|
231
|
+
- `get_wall_segments_from_mask`: Extracts wall boundary contours from a binary mask and converts them into geometric Segment primitives
|
|
232
|
+
- `build_occlusion_from_wallmask`: Produces a binary occlusion raster (optionally dilated) used for fast visibility checks
|
|
233
|
+
- `enumerate_wall_sequences_indices`: Enumerates all reflection sequences (as wall-index tuples) up to a maximum reflection order
|
|
234
|
+
- `precompute_image_sources`: Computes image-source positions for each reflection sequence by iteratively mirroring the source across the corresponding walls
|
|
235
|
+
- `build_path_for_sequence`: Reconstructs the specular reflection polyline for a given wall sequence by backtracking virtual receivers and segment intersections
|
|
236
|
+
- `path_energy`: Computes a simple physically-inspired path contribution based on total path length and per-reflection losses
|
|
237
|
+
- `check_path_visibility_raster`: Verifies that every segment of a candidate path is unobstructed using raster line-of-sight tests
|
|
238
|
+
- `compute_reflection_map`: Evaluates all valid ISM paths from one source to a receiver grid and accumulates path counts
|
|
186
239
|
- `img`
|
|
187
240
|
- `open`: load an image via Open-CV
|
|
188
241
|
- `save`: save an image
|
|
@@ -190,6 +243,21 @@ class PhysGenDataset(Dataset):
|
|
|
190
243
|
- `advanced_imshow`: show multiple images with many options
|
|
191
244
|
- `show_image_with_line_and_profile`: show an image with a red line + the values of the image on this line
|
|
192
245
|
- `plot_image_with_values`: plot an image with it's value plotted and averaged to see your image in values
|
|
246
|
+
- `math`
|
|
247
|
+
- `get_linear_degree_range`: generate evenly spaced degrees within a range
|
|
248
|
+
- `degree_to_vector`: convert a degree angle to a 2D unit vector
|
|
249
|
+
- `vector_to_degree`: convert a 2D vector into its corresponding degree
|
|
250
|
+
- `normalize_point`: Normalize a 2D point to [0, 1] range
|
|
251
|
+
- `denormalize_point`: Denormalize a 2D point to pixel coordinates
|
|
252
|
+
- `numpy_info`: Get statistics about an numpy array
|
|
253
|
+
- `eval`
|
|
254
|
+
- `calc_metrices`: calculate F1, Recall and Precision between rays (or optinal an image) and an image
|
|
255
|
+
- `data`
|
|
256
|
+
- `PhysGenDataset()`: PyTorch dataset wrapper for PhysGen with flexible input/output configuration
|
|
257
|
+
- `resize_tensor_to_divisible_by_14`: resize tensors so height and width are divisible by 14
|
|
258
|
+
- `get_dataloader`: create a PyTorch DataLoader for the PhysGen dataset
|
|
259
|
+
- `get_image`: retrieve a single dataset sample (optionally as NumPy arrays)
|
|
260
|
+
- `save_dataset`: export PhysGen inputs and targets as PNG images to disk
|
|
193
261
|
|
|
194
262
|
|
|
195
263
|
That are not all functions but the ones which should be most useful. Check out the documentation for all functions.
|
|
@@ -209,17 +277,12 @@ That are not all functions but the ones which should be most useful. Check out t
|
|
|
209
277
|
|
|
210
278
|
### Raytracing Tutorial
|
|
211
279
|
|
|
212
|
-
[See also the example notebook
|
|
280
|
+
[See also the example notebook 👀](./example/physgen.ipynb)
|
|
213
281
|
|
|
214
282
|
In general you need to do:
|
|
215
|
-
1.
|
|
216
|
-
2. **
|
|
217
|
-
3. **Calculate the Beams** -> using `ips.img.open`
|
|
218
|
-
4. **Draw (Export) the Beams** -> using `ips.img.open`
|
|
283
|
+
1. Load your Image + Calculate the Wall-Map + **Calculate the Beams** -> using `ips.ray_tracing.trace_beams`
|
|
284
|
+
2. **Draw (Export) the Beams on a image** -> using `ips.ray_tracing.draw_rays`
|
|
219
285
|
|
|
220
|
-
Using this lib, this is reduced to:
|
|
221
|
-
1. **Calculate the Beams** (including Wall-Map and loading your Image) -> using `ips.img.open`
|
|
222
|
-
2. **Draw (Export) the Beams** -> using `ips.img.open`
|
|
223
286
|
|
|
224
287
|
See this example:
|
|
225
288
|
|
|
@@ -303,7 +366,7 @@ ips.ray_tracing.print_rays_info(rays)
|
|
|
303
366
|
|
|
304
367
|
Following features are included:
|
|
305
368
|
- Setting custom startposition for raytracing
|
|
306
|
-
- Adding custom beam shooting positions in degree (where 0
|
|
369
|
+
- Adding custom beam shooting positions in degree (where 0° is the east/right of the image and 90° is south/bottom and so on)
|
|
307
370
|
- Setting reflexion order (how many maxium reflexions should be calculated)
|
|
308
371
|
- Setting if the border of the image should be reflective or not
|
|
309
372
|
- And setting if the input image should be scaled and if the rays itself should be scaled
|
|
@@ -348,7 +411,17 @@ I hope this little tutorial could be helpful. Good luck with your project <3
|
|
|
348
411
|
|
|
349
412
|
<br>
|
|
350
413
|
|
|
351
|
-
[> See the notebook/code <](./example/physgen_performance.ipynb)
|
|
414
|
+
[> See the notebook/code <](./example/physgen_performance.ipynb) [(or parallel notebook)](./example/physgen_parallel_performance.ipynb)
|
|
415
|
+
|
|
416
|
+
<br><br>
|
|
417
|
+
|
|
418
|
+
Comparison no parallel vs parallel computing:
|
|
419
|
+
- Parallel Mean Experiment time: 3.48 seconds (mean first experiment: 8.85 seconds)
|
|
420
|
+
- Standard Mean Experiment time: 4.53 seconds (mean first experiment: 16.00 seconds)
|
|
421
|
+
|
|
422
|
+
<br><br>
|
|
423
|
+
|
|
424
|
+
Parameter Experiments:
|
|
352
425
|
|
|
353
426
|
Executed with 50 random images.
|
|
354
427
|
|
|
@@ -461,13 +534,130 @@ Summary:
|
|
|
461
534
|
The Stepsize/amount of rays have the biggest impact on the performance. The other parameters have rather a small impact.
|
|
462
535
|
|
|
463
536
|
|
|
464
|
-
| **Experiment** | **Number of Experiments** | **avg_time (mean
|
|
537
|
+
| **Experiment** | **Number of Experiments** | **avg_time (mean ± std)** | **avg_compute_time (mean ± std)** | **avg_draw_time (mean ± std)** | **rel_change (avg_time)** | **Trend** | **Conclusion** |
|
|
465
538
|
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
466
|
-
| **1. Ray Amount** | 4 | 16.01
|
|
467
|
-
| **2. Ray Scaling** | 2 | 0.57
|
|
468
|
-
| **3. Reflection Order** | 6 | 0.93
|
|
469
|
-
| **4. Detail Draw** | 2 | 0.63
|
|
539
|
+
| **1. Ray Amount** | 4 | 16.01 ± 23.63 s | 15.11 ± 22.23 s | 0.90 ± 1.39 s | **351.22 %** | Increasing (+17.31 s/exp) | Performance changes **significantly** |
|
|
540
|
+
| **2. Ray Scaling** | 2 | 0.57 ± 0.01 s | 0.56 ± 0.00 s | 0.016 ± 0.006 s | **2.73 %** | Decreasing (−0.016 s/exp) | Performance changes **slightly** |
|
|
541
|
+
| **3. Reflection Order** | 6 | 0.93 ± 0.74 s | 0.90 ± 0.72 s | 0.029 ± 0.016 s | **227.71 %** | Increasing (+0.37 s/exp) | Performance changes **significantly** |
|
|
542
|
+
| **4. Detail Draw** | 2 | 0.63 ± 0.05 s | 0.56 ± 0.00 s | 0.071 ± 0.050 s | **16.39 %** | Increasing (+0.10 s/exp) | Performance changes **slightly** |
|
|
543
|
+
|
|
544
|
+
<!--
|
|
545
|
+
<br><br>
|
|
546
|
+
|
|
547
|
+
### Optimization
|
|
548
|
+
|
|
549
|
+
<br>
|
|
550
|
+
|
|
551
|
+
Speed comparison between `standard`, `with joblib` and `joblib + CPython`.
|
|
552
|
+
|
|
553
|
+
FIXME -> table
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
<br>
|
|
557
|
+
|
|
558
|
+
Cython is Pyhon code which is closer to C. Instead of compiling to Python-Bytecode (`.pyc`), your code will be compiled as C-Extension (`.so`/`.pyd`).
|
|
559
|
+
|
|
560
|
+
There are 3 layers of Cython optimization:
|
|
561
|
+
1. Writing in `.pyx` files not `.py` files -> you can just rename your file<br>
|
|
562
|
+
- +5% to +30% speedup
|
|
563
|
+
2. Set `cdef` for local variables + helper-functions + `cpdef` for API-functions -> add types<br>
|
|
564
|
+
Example:
|
|
565
|
+
```python
|
|
566
|
+
cdef double x0, y0, dx, dy
|
|
567
|
+
cdef int cell_x, cell_y, steps
|
|
568
|
+
```
|
|
569
|
+
- +5x to +50x speedup
|
|
570
|
+
3. Add types everywhere, especially in numpy arrays. <br>
|
|
571
|
+
Example:
|
|
572
|
+
```python
|
|
573
|
+
cimport numpy as cnp
|
|
574
|
+
|
|
575
|
+
def trace(..., cnp.ndarray[double, ndim=2] img):
|
|
576
|
+
cdef double value = img[y, x]
|
|
577
|
+
```
|
|
578
|
+
- +20× to +500×
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
| **Optimization Layer** | **Effort** | **Speedup** | **What It Does** |
|
|
583
|
+
|---|---|---|---|
|
|
584
|
+
| **1. `.py` → `.pyx`** | minimal | **+5–30%** | Reduces Python interpreter overhead and applies basic Cython optimizations |
|
|
585
|
+
| **2. `cdef` variables & `cpdef` functions** | medium | **+5×–50×** | Moves loops and math into pure C, eliminating Python object overhead |
|
|
586
|
+
| **3. `cimport numpy` + typed NumPy arrays** | high | **+20×–500×** | Enables direct C‑level memory access with zero Python indexing overhead |
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
> Use `pip install cypthon` to install it.
|
|
591
|
+
|
|
592
|
+
In `setup.py` you need following changes:
|
|
593
|
+
```python
|
|
594
|
+
from setuptools import setup, find_packages, Extension
|
|
595
|
+
from Cython.Build import cythonize
|
|
596
|
+
|
|
597
|
+
...
|
|
598
|
+
|
|
599
|
+
ext_1 = Extension(
|
|
600
|
+
name="img_phy_sim.ray_tracing",
|
|
601
|
+
sources=["img_phy_sim/ray_tracing.pyx"],
|
|
602
|
+
include_dirs=[],
|
|
603
|
+
extra_compile_args=["-O3"],
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
ext_2 = Extension(
|
|
607
|
+
name="img_phy_sim.math",
|
|
608
|
+
sources=["img_phy_sim/math.pyx"],
|
|
609
|
+
include_dirs=[],
|
|
610
|
+
extra_compile_args=["-O3"],
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
setup(
|
|
614
|
+
ext_modules=cythonize(
|
|
615
|
+
[ext_1, ext_2],
|
|
616
|
+
compiler_directives={
|
|
617
|
+
"language_level": "3",
|
|
618
|
+
"boundscheck": False,
|
|
619
|
+
"wraparound": False,
|
|
620
|
+
"initializedcheck": False,
|
|
621
|
+
"nonecheck": False,
|
|
622
|
+
"cdivision": True,
|
|
623
|
+
},
|
|
624
|
+
annotate=True,
|
|
625
|
+
),
|
|
626
|
+
...
|
|
627
|
+
)
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
-->
|
|
631
|
+
|
|
632
|
+
<br><br>
|
|
633
|
+
|
|
634
|
+
### Ray-Tracing Formats
|
|
635
|
+
|
|
636
|
+
<br>
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
**Your current approach (DDA / Pixel Ray Marching)**
|
|
640
|
+
* **Forward integration**: Ray is propagated step by step through a **discrete grid** (pixel/grid).
|
|
641
|
+
* **Collision model**: A "hit" occurs when the ray enters a **wall cell** (quantization).
|
|
642
|
+
* **Reflection**: Occurs **locally at the collision pixel** with a (often quantized) normal/orientation.
|
|
643
|
+
* Result: good for "many rays" / field of view, but **not deterministic with regard to reflection paths** (you need directions/sampling).
|
|
644
|
+
|
|
645
|
+
**Noise modeling style (image source method / geometric acoustics)**
|
|
646
|
+
* **Path construction**: Reflection paths are constructed **deterministically** via **mirror sources** (virtual sources).
|
|
647
|
+
* **Continuous geometry**: works in $\mathbb{R}^2 / \mathbb{R}^3$ with lines/segments/polygons ("infinity-based" in the sense of *continuous space*, not raster).
|
|
648
|
+
* **Validation**: Path is then accepted/rejected via **visibility/occlusion checks**.
|
|
649
|
+
* Result: Delivers **all specular paths up to order N** without angle sampling.
|
|
650
|
+
|
|
651
|
+
Short form:
|
|
652
|
+
|
|
653
|
+
* **Pixel-based + stochastic/directed** (original approach here) vs. **continuous + deterministically constructed** (noise modelling).
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
<br>
|
|
657
|
+
|
|
658
|
+
How to use which of them in `img-phy-sim`:
|
|
470
659
|
|
|
660
|
+
FIXME
|
|
471
661
|
|
|
472
662
|
|
|
473
663
|
|