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

Changing light quality - softness, color,... #46

Open
MiB76 opened this issue May 8, 2024 · 5 comments
Open

Changing light quality - softness, color,... #46

MiB76 opened this issue May 8, 2024 · 5 comments

Comments

@MiB76
Copy link

MiB76 commented May 8, 2024

Hello,

I´m developing an 3D insect scanner and would be interested if and how it may be possible to change the lighting quality in OpenLime. Is there an easy way of changing the light softness/hardness, brightness and the color of the light? One case: I want to shine blue light on my object.
I´m quite happy with my first result (http://www.michaelbachhofer.com/PS/) but for presenting such scans with OpenLime in an art context, I would need to also influence the light quality.
Perhaps this might be possible by changing values in the "openlime.min.js" file.

Many thanks and kind regards,
Michael

@ponchio
Copy link
Contributor

ponchio commented May 8, 2024

Hi,
your dataset has been captured with only 9 light directions (why so few?)
If you were to use RBF (radial basis function interpolation) in order to have a good interpolation, you would need to increase the sigma parameter (command line is -S, default 0.125). This parameter however can also be changed during rendering (ShaderRTI class sigma parameter, which is read from the json).

You are using Bilinear instead, but, unlike RBF, the sigma parameter is 'baked' into the dataset, and that parameter is only available (for the moment) in the relight-cli application.

An alternative would be to compute a softer light relighting coefficients as the weighted sum of multiple light directions, I can add support for this, in case.

About the color of the light: I can add support for the light color parameter, but inherent to the RTI mathematical model, emissive color for example would not really work. For example a red LED in a scene would remain red even if you shine a blue light, but RTI has no reasonable way (for the moment) to distinguish emissive from diffuse and the red would turn dark.

In case you prefer (the matter is complex), we can have a call, just set up an appointment (write me at [email protected]).

@MiB76
Copy link
Author

MiB76 commented May 9, 2024

Hello,

Thank you for your prompt reply and the different solutions.

I just have 9 light directions because my scanner will work with photometric stereo and photogrammetry. Because I have to stack around 300 images per view/perspective and will need about 160-300 perspectives per insect, working with more light sources would tremendously increase scanning time. Working with higher magnification objectives would go into the weeks. With this lens about one to two days.

OK, I will try to use RBF and test changing the light during rendering. Your alternative to use weighted sums of multiple light directions sounds more complicated, but thanks for the offer!

It would be very helpful if there would be a function to change light color in real time, by a key combined with the mouse wheel (r for red, b for blue and g for green or h for hue), but I do not know if such a thing would be possible within OpenLime.

Would changing the lights size (light circle not covering the whole scene) be possible somehow? Dynamically change the light to brighter and darker? In the end I plan to use sensors around the projection of the insect and an infrared flashlight, to relight my insects in an art installation. At least this is what I dream about. But I could imagine that the sensors could not exactly know the IR flashlight position. I have no clue about geometry.

Thanks also for offering to have a call, perhaps I will come back on it, but my English is not very good and I have hearing problems, so this might not be the easiest thing.

All in all OpenLime is already a really helpful tool for art installations. I´m very happy that I found it.

Thank you again and kind regards,
Michael

@MiB76
Copy link
Author

MiB76 commented May 13, 2024

Hi again,

I used relight-cli application and afterwards a sigma of 0.5, which made the whole rendering much softer/smoother. Would there be an easy way to control this sigma value in real time from OpenLime?
I also changes other values in the json, which sometimes gave interesting results (also color changes and dramatic light changes). Could this be made dynamic by adding a script? Which parameters in the src or openlime.min.js would I need to control? Or do I have completely impossible ideas?
I cannot find any documentation about what can be done and how.

Many thanks and kind regards,
Michael

@ponchio
Copy link
Contributor

ponchio commented May 13, 2024

Ciao,
something like this would work (if you only have one layer in openlime, adjust the index otherwise:

ui.menu[1].list.push({ html: "<p>Softness:</p>" });
ui.menu[1].list.push({ slider: 'Softness', id: 'softness', oninput: (event) => { 
	layer0.shader.sigma = event.target.value/100 + 0.1; 
} });

You need to update the light direction to have a proper redraw, i need to expose some function to do so properly.

About the values in the json, it's perfectly doable to change them, but I need to understand which effect you would like to have implemented.

Documentation is pretty sparse (as the code is in development) sorry. Feel free to ask here.

@MiB76
Copy link
Author

MiB76 commented May 21, 2024

Hello,
sorry for my delayed response. I have many different "construction zones" right now (mainly in the hardware for the scanner) and I´m not really a multitasker.

I tested you suggestion and it works quite well. What is a little bit disturbing is the need for updating the light direction before one sees the resulting light-softness change in action. Is there no workaround for this? So that the light-softness would change immediately when making changes to the slider?

Maybe changing the JSON would not be so easy because the "basis" would need to be changed in so many different positions. Such a thing I could just imagine to do some presets (perhaps also in ui.menu[1]) that for instance change the red values at some positions and the blue ones for another direction/position.

Would there be an easier way to maybe just change the color temperature in general (like one would do when adjusting the white balance in photography; with some kind of "Kelvin-Slider")? Or to change the RGB values separately?

And, for a first exhibition, it would be good to have such a slider for the image brightness / the lights brightness. Because this could make images more dramatic too.

These functions would be sufficient for the first exhibitions beginning of June in my studio and end of June at the University.

I also managed to switch views or specimen with links to other folders.
e.g.

    <a href="https://xyz.com/other_folder" >

        <img src="preview1.png" alt="Preview 1">

    </a>
Would there be a more elegant way to switch between views and/or specimen? Perhaps just to switch JSON files. But how would the viewer know which image planes to load?

I know these are many questions.
Thank you very much in advance and kind regards,
Michael

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