relight icon indicating copy to clipboard operation
relight copied to clipboard

Segfault when using relight-cli -L parameter

Open ruven opened this issue 2 years ago • 7 comments

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)

ruven avatar Jun 23 '22 14:06 ruven

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).

ponchio avatar Jun 23 '22 15:06 ponchio

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.

ruven avatar Jun 24 '22 10:06 ruven

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).

ponchio avatar Jun 24 '22 11:06 ponchio

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.

ruven avatar Jun 24 '22 12:06 ruven

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.

ponchio avatar Jun 24 '22 14:06 ponchio

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!

ruven avatar Jun 27 '22 10:06 ruven

You are qualitatively right on the light directions., but you should work with unit length (x^2 + y^2 + z^2 = 1) vectors on the surface of an emisphere (z > 0).

Send me the sample and I will debug the PTM conversion problem....

On Mon, Jun 27, 2022 at 12:47 PM Ruven @.***> wrote:

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!

— Reply to this email directly, view it on GitHub https://github.com/cnr-isti-vclab/relight/issues/47#issuecomment-1167194723, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUDV2YUNTSF4MD54ACXYODVRGBDNANCNFSM5ZUQMUYA . You are receiving this because you commented.Message ID: @.***>

ponchio avatar Jun 27 '22 13:06 ponchio