Skip to content

Commit f530c88

Browse files
committed
Turn off formatting in some sections
1 parent d783a19 commit f530c88

File tree

2 files changed

+70
-196
lines changed

2 files changed

+70
-196
lines changed

threedgrut_playground/utils/antialiasing.py

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -54,43 +54,36 @@ def __init__(self, enabled=True, apply_every_n_iterations=1, num_samples=16, fix
5454

5555
# Subpixel offset values used by DirectX MSAA (Source: Ray Tracing Gems II)
5656
subpixel_means = dict(
57-
s1=[[0.5, 0.5]],
58-
s2=[[0.25, 0.25], [0.75, 0.75]],
59-
s4=[[0.375, 0.125], [0.875, 0.375], [0.625, 0.875], [0.125, 0.625]],
60-
s8=[
61-
[0.5625, 0.6875],
62-
[0.4375, 0.3125],
63-
[0.8125, 0.4375],
64-
[0.3125, 0.8125],
65-
[0.1875, 0.1875],
66-
[0.0625, 0.5625],
67-
[0.6875, 0.0625],
68-
[0.9375, 0.9375],
69-
],
70-
s16=[
71-
[0.5625, 0.4375],
72-
[0.4375, 0.6875],
73-
[0.3125, 0.375],
74-
[0.75, 0.5625],
75-
[0.1875, 0.625],
76-
[0.625, 0.1875],
77-
[0.1875, 0.3125],
78-
[0.6875, 0.8125],
79-
[0.375, 0.125],
80-
[0.5, 0.9375],
81-
[0.25, 0.875],
82-
[0.125, 0.25],
83-
[0.0, 0.5],
84-
[0.9375, 0.75],
85-
[0.875, 0.0625],
86-
[0.0625, 0.0],
87-
],
57+
# fmt: off
58+
s1=[[0.500, 0.500]],
59+
s2=[[0.250, 0.250], [0.750, 0.750]],
60+
s4=[[0.375, 0.125], [0.875, 0.375],
61+
[0.625, 0.875], [0.125, 0.625]],
62+
s8=[[0.5625, 0.6875], [0.4375, 0.3125],
63+
[0.8125, 0.4375], [0.3125, 0.8125],
64+
[0.1875, 0.1875], [0.0625, 0.5625],
65+
[0.6875, 0.0625], [0.9375, 0.9375]],
66+
s16=[[0.5625, 0.4375], [0.4375, 0.6875],
67+
[0.3125, 0.3750], [0.7500, 0.5625],
68+
[0.1875, 0.6250], [0.6250, 0.1875],
69+
[0.1875, 0.3125], [0.6875, 0.8125],
70+
[0.3750, 0.1250], [0.5000, 0.9375],
71+
[0.2500, 0.8750], [0.1250, 0.2500],
72+
[0.0000, 0.5000], [0.9375, 0.7500],
73+
[0.8750, 0.0625], [0.0625, 0.0000]]
74+
# fmt: on
8875
)
8976
self.subpixel_means = {k: torch.tensor(v, device=self.device) for k, v in subpixel_means.items()}
9077

9178
# Max distance between points in this pattern
9279
self.subpixel_offset_max = dict(
93-
s1=0.5, s2=0.3535533905932738, s4=0.2795084971874737, s8=0.13975424859373686, s16=0.04419417382415922
80+
# fmt: off
81+
s1=0.5,
82+
s2=0.3535533905932738,
83+
s4=0.2795084971874737,
84+
s8=0.13975424859373686,
85+
s16=0.04419417382415922
86+
# fmt: on
9487
)
9588

9689
assert (

threedgrut_playground/utils/rng.py

Lines changed: 45 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import numpy as np
1919
import torch
2020

21-
"""
22-
A random number generator, specifically tailored for low-discrepency sequences.
21+
"""
22+
A random number generator, specifically tailored for low-discrepency sequences.
2323
Code Adapted from InstantNGP, originally from Burley [2019] https://www.jcgt.org/published/0009/04/01/paper.pdf
2424
2525
Module supports arbitrary uint32 buffer types, including torch tensors and numpy arrays
@@ -28,179 +28,60 @@
2828
UInt32Buffer = Union[torch.LongTensor, np.uint32]
2929
UINT32_MASK = 0xFFFFFFFF # torch doesn't natively support uint32 so we force the overflow with a mask
3030

31-
31+
# fmt: off
3232
SOBOL_DIRECTIONS = [
3333
[
34-
0x80000000,
35-
0x40000000,
36-
0x20000000,
37-
0x10000000,
38-
0x08000000,
39-
0x04000000,
40-
0x02000000,
41-
0x01000000,
42-
0x00800000,
43-
0x00400000,
44-
0x00200000,
45-
0x00100000,
46-
0x00080000,
47-
0x00040000,
48-
0x00020000,
49-
0x00010000,
50-
0x00008000,
51-
0x00004000,
52-
0x00002000,
53-
0x00001000,
54-
0x00000800,
55-
0x00000400,
56-
0x00000200,
57-
0x00000100,
58-
0x00000080,
59-
0x00000040,
60-
0x00000020,
61-
0x00000010,
62-
0x00000008,
63-
0x00000004,
64-
0x00000002,
65-
0x00000001,
34+
0x80000000, 0x40000000, 0x20000000, 0x10000000,
35+
0x08000000, 0x04000000, 0x02000000, 0x01000000,
36+
0x00800000, 0x00400000, 0x00200000, 0x00100000,
37+
0x00080000, 0x00040000, 0x00020000, 0x00010000,
38+
0x00008000, 0x00004000, 0x00002000, 0x00001000,
39+
0x00000800, 0x00000400, 0x00000200, 0x00000100,
40+
0x00000080, 0x00000040, 0x00000020, 0x00000010,
41+
0x00000008, 0x00000004, 0x00000002, 0x00000001
6642
],
6743
[
68-
0x80000000,
69-
0xC0000000,
70-
0xA0000000,
71-
0xF0000000,
72-
0x88000000,
73-
0xCC000000,
74-
0xAA000000,
75-
0xFF000000,
76-
0x80800000,
77-
0xC0C00000,
78-
0xA0A00000,
79-
0xF0F00000,
80-
0x88880000,
81-
0xCCCC0000,
82-
0xAAAA0000,
83-
0xFFFF0000,
84-
0x80008000,
85-
0xC000C000,
86-
0xA000A000,
87-
0xF000F000,
88-
0x88008800,
89-
0xCC00CC00,
90-
0xAA00AA00,
91-
0xFF00FF00,
92-
0x80808080,
93-
0xC0C0C0C0,
94-
0xA0A0A0A0,
95-
0xF0F0F0F0,
96-
0x88888888,
97-
0xCCCCCCCC,
98-
0xAAAAAAAA,
99-
0xFFFFFFFF,
44+
0x80000000, 0xC0000000, 0xA0000000, 0xF0000000,
45+
0x88000000, 0xCC000000, 0xAA000000, 0xFF000000,
46+
0x80800000, 0xC0C00000, 0xA0A00000, 0xF0F00000,
47+
0x88880000, 0xCCCC0000, 0xAAAA0000, 0xFFFF0000,
48+
0x80008000, 0xC000C000, 0xA000A000, 0xF000F000,
49+
0x88008800, 0xCC00CC00, 0xAA00AA00, 0xFF00FF00,
50+
0x80808080, 0xC0C0C0C0, 0xA0A0A0A0, 0xF0F0F0F0,
51+
0x88888888, 0xCCCCCCCC, 0xAAAAAAAA, 0xFFFFFFFF
10052
],
10153
[
102-
0x80000000,
103-
0xC0000000,
104-
0x60000000,
105-
0x90000000,
106-
0xE8000000,
107-
0x5C000000,
108-
0x8E000000,
109-
0xC5000000,
110-
0x68800000,
111-
0x9CC00000,
112-
0xEE600000,
113-
0x55900000,
114-
0x80680000,
115-
0xC09C0000,
116-
0x60EE0000,
117-
0x90550000,
118-
0xE8808000,
119-
0x5CC0C000,
120-
0x8E606000,
121-
0xC5909000,
122-
0x6868E800,
123-
0x9C9C5C00,
124-
0xEEEE8E00,
125-
0x5555C500,
126-
0x8000E880,
127-
0xC0005CC0,
128-
0x60008E60,
129-
0x9000C590,
130-
0xE8006868,
131-
0x5C009C9C,
132-
0x8E00EEEE,
133-
0xC5005555,
54+
0x80000000, 0xC0000000, 0x60000000, 0x90000000,
55+
0xE8000000, 0x5C000000, 0x8E000000, 0xC5000000,
56+
0x68800000, 0x9CC00000, 0xEE600000, 0x55900000,
57+
0x80680000, 0xC09C0000, 0x60EE0000, 0x90550000,
58+
0xE8808000, 0x5CC0C000, 0x8E606000, 0xC5909000,
59+
0x6868E800, 0x9C9C5C00, 0xEEEE8E00, 0x5555C500,
60+
0x8000E880, 0xC0005CC0, 0x60008E60, 0x9000C590,
61+
0xE8006868, 0x5C009C9C, 0x8E00EEEE, 0xC5005555
13462
],
13563
[
136-
0x80000000,
137-
0xC0000000,
138-
0x20000000,
139-
0x50000000,
140-
0xF8000000,
141-
0x74000000,
142-
0xA2000000,
143-
0x93000000,
144-
0xD8800000,
145-
0x25400000,
146-
0x59E00000,
147-
0xE6D00000,
148-
0x78080000,
149-
0xB40C0000,
150-
0x82020000,
151-
0xC3050000,
152-
0x208F8000,
153-
0x51474000,
154-
0xFBEA2000,
155-
0x75D93000,
156-
0xA0858800,
157-
0x914E5400,
158-
0xDBE79E00,
159-
0x25DB6D00,
160-
0x58800080,
161-
0xE54000C0,
162-
0x79E00020,
163-
0xB6D00050,
164-
0x800800F8,
165-
0xC00C0074,
166-
0x200200A2,
167-
0x50050093,
64+
0x80000000, 0xC0000000, 0x20000000, 0x50000000,
65+
0xF8000000, 0x74000000, 0xA2000000, 0x93000000,
66+
0xD8800000, 0x25400000, 0x59E00000, 0xE6D00000,
67+
0x78080000, 0xB40C0000, 0x82020000, 0xC3050000,
68+
0x208F8000, 0x51474000, 0xFBEA2000, 0x75D93000,
69+
0xA0858800, 0x914E5400, 0xDBE79E00, 0x25DB6D00,
70+
0x58800080, 0xE54000C0, 0x79E00020, 0xB6D00050,
71+
0x800800F8, 0xC00C0074, 0x200200A2, 0x50050093,
16872
],
16973
[
170-
0x80000000,
171-
0x40000000,
172-
0x20000000,
173-
0xB0000000,
174-
0xF8000000,
175-
0xDC000000,
176-
0x7A000000,
177-
0x9D000000,
178-
0x5A800000,
179-
0x2FC00000,
180-
0xA1600000,
181-
0xF0B00000,
182-
0xDA880000,
183-
0x6FC40000,
184-
0x81620000,
185-
0x40BB0000,
186-
0x22878000,
187-
0xB3C9C000,
188-
0xFB65A000,
189-
0xDDB2D000,
190-
0x78022800,
191-
0x9C0B3C00,
192-
0x5A0FB600,
193-
0x2D0DDB00,
194-
0xA2878080,
195-
0xF3C9C040,
196-
0xDB65A020,
197-
0x6DB2D0B0,
198-
0x800228F8,
199-
0x400B3CDC,
200-
0x200FB67A,
201-
0xB00DDB9D,
202-
],
74+
0x80000000, 0x40000000, 0x20000000, 0xB0000000,
75+
0xF8000000, 0xDC000000, 0x7A000000, 0x9D000000,
76+
0x5A800000, 0x2FC00000, 0xA1600000, 0xF0B00000,
77+
0xDA880000, 0x6FC40000, 0x81620000, 0x40BB0000,
78+
0x22878000, 0xB3C9C000, 0xFB65A000, 0xDDB2D000,
79+
0x78022800, 0x9C0B3C00, 0x5A0FB600, 0x2D0DDB00,
80+
0xA2878080, 0xF3C9C040, 0xDB65A020, 0x6DB2D0B0,
81+
0x800228F8, 0x400B3CDC, 0x200FB67A, 0xB00DDB9D
82+
]
20383
]
84+
# fmt: on
20485

20586

20687
def reverse_bits(x: UInt32Buffer) -> UInt32Buffer:

0 commit comments

Comments
 (0)