How does the grid sampler determine the grid boundary?
PerryXDeng opened this issue · 4 comments
Hi, thanks to the contributors of this project. Is there a way to determine the minimum and maximum x,y,z coordinates from the .glsl files in the data-files/sdf directory? I would like to build a custom adaptive grid sampler but there doesn't seem to be a way to determine the boundary of such a grid.
It seems like the boundary is determined by the sampler logic mapping some openGL UV space to the object XYZ space. If the contributors can offer some comments/explanations on this mapping, it would make it a lot easier to develop extensions!
Hi,
What do you mean exactly by a minimum and maximum XYZ coordinates? In general the SDFs should reside mostly in normalized [-1, 1]
space.
Thanks for the response @tovacinni ! That's what I assumed first, but I tried one of the examples and it seems like it was sampling outside the [-1, 1]^3 space.
Example:
`
import sdfdes
viewer_path = '/sdf-explorer/build'
sample_path = '/sdf-explorer/samples'
sdf = "Torus"
N = 257
pattern = "grid"
bin_path = os.path.join(sample_path, f"grid/{sdf}.bin")
sample_cmd = f"./sdf-explorer --sample {N**3} {pattern} {sdf} {sample_path}"
proc = sp.check_output(sample_cmd.split(), shell=False, cwd=viewer_path)
pos, dist, normal = sdfdes.deserialize(bin_path)
print(torch.max(pos[:, 0]))
`
This will output 7.22, which is outside [-1, 1]
Hi,
Thanks for looking into this. At first glance this seems like a bug... I'll try to look into this.
I think ideally we should actually be generating these things in morton order.
Best,
Towaki