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

Segfault when using relight-cli -L parameter #47

Open
ruven opened this issue Jun 23, 2022 · 7 comments
Open

Segfault when using relight-cli -L parameter #47

ruven opened this issue Jun 23, 2022 · 7 comments

Comments

@ruven
Copy link
Contributor

ruven commented Jun 23, 2022

I keep getting segfaults when using relight-cli's -L parameter.

I'd like to be able to generate an image corresponding to an arbitrary x,y,z light position. I've tried with various configurations and what I presume to be the correct parameters: -D test.jpg -L 1:0.5:1 which should give an image with lighting from the middle right (is that how x,y,z work?). However, no matter what parameters I give I get a segfault. Does this functionality in fact work? If so, how should it be used?

(I'm using the latest Github commit and compiling on Linux)

@ponchio
Copy link
Contributor

ponchio commented Jun 23, 2022

The -D parameter was ignored using instead the output parameter... sorry, I fixed it in the latest commit.

relight-cli -D test.jpg -L 1:0.5:0.5 rtifolder/info.json

This should workd ("/info.json" is optional).

Notice how x, y and z are supposed to be a directions, (a normalized unit vector), if it's not it get normalized, for example your parameter 1:0.5:1 becames actually 0.666:0.333:0.666 (indeed middle right a bit upper direction).

@ruven
Copy link
Contributor Author

ruven commented Jun 24, 2022

Thanks! It no longer crashes, but it still doesn't seem to be working properly. So, if I've understood correctly an xyz vector of 0:0:1 would be a light source pointing down from directly above and 1:0:0 would be raking from the right? No matter what vector I give, I only get a black image.

Also, I notice that you cannot save to JPEG - only PNG seems to work.

@ponchio
Copy link
Contributor

ponchio commented Jun 24, 2022

Strange, I made a test using the linux portable version and it works properly (and can save both jpg and png) on a sample dataset (HSH).

Could you share dataset (with exact command line)? It could be a dataset problem, but it might also be a library problem (libjpeg and in general QT dependencies).

@ruven
Copy link
Contributor Author

ruven commented Jun 24, 2022

Ah, it looks like an issue with the type of basis function used to create the RTI. I just tried with HSH and it works as it should. RBF, however, doesn't work.

Try this example, which I created using RBF: relight-cli -b rbf -p 9 -q 50 and generated the reconstruction using
relight-cli -D raking.png -L 0:0:1 ./info.json from within the folder.

test.zip

There's also possibly a QT issue somewhere. I tried on another machine running Ubuntu 22.04 (the first machine was Ubuntu 20.04) and this time was also able to export as JPEG.

@ponchio
Copy link
Contributor

ponchio commented Jun 24, 2022

I left a stupid debug value in the code. Should work now.
About QT: it migh have something to do with libjpeg version installed with QT and system or, maybe more likely, just some path missing: QT looks for a specific plugin folder where its libjpeg is supposed to be found.
I am working in 20.04.

@ruven
Copy link
Contributor Author

ruven commented Jun 27, 2022

Thanks, it now works for RBF!

Can you confirm exactly how the -L parameter works? If I've understood correctly, the vector is the direction towards the light source, right? So 0:0:1 is a light from directly above? 1:0:1 would be a light at 45deg elevation from the middle? And 0:1:0.2 would be a low raking light from the top of the object? Is that correct?

I also tested with PTM format (relight converted from an old PTM file), but I'm getting color casting, so there's maybe another debug value somewhere there too!

@ponchio
Copy link
Contributor

ponchio commented Jun 27, 2022 via email

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