Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does the grid sampler determine the grid boundary? #5

Open
PerryXDeng opened this issue Aug 20, 2022 · 4 comments
Open

How does the grid sampler determine the grid boundary? #5

PerryXDeng opened this issue Aug 20, 2022 · 4 comments

Comments

@PerryXDeng
Copy link

PerryXDeng commented Aug 20, 2022

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.

@PerryXDeng
Copy link
Author

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!

@tovacinni
Copy link
Owner

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.

@PerryXDeng
Copy link
Author

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]

@tovacinni
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants