-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add freely adjustable layered fog #1428
Conversation
* Fog logic moved to a separate file * Restructured JSON scene format, conversion of old scenes * Fog modes NONE, UNIFORM (classic) and LAYERED * Freely adjustable fog layers * Fog density modelled as the sum of sigmoid functions * GUI not yet adapted to new features
Hm… Maybe we can somehow keep the existing blending for uniform fog. 🤔 That would make this perfect. |
The issue was that the sky fog blending setting wasn't loaded from the JSON. It is intended that there is no use for the skyFogBlending and fastFog settings in LAYERED mode. |
@almrausch Thanks for the update! 🥳 So as I understand it, this adds layered fog and removes nothing. I'll review it asap. |
As @jackjt8 and I discussed in the discord, here's a suggestion for UI for this pull: Personally, I don't think that the live preview at the side needs to be interactive (dragging handles for width etc), except maybe for editing y levels of layers. Also, since this pull doesn't add different fog colours for different layers, there's no colour edit here, but space for one could be reserved for the future. Hopefully a javafx wizard could share their thoughts on feasibility, because it would be really cool if this is possible as-is (except a lot less mockup-y, of course). Personally, I find this quite intuitive and think it would work fairly well under a dropdown like we have for |
@ShirleyNekoDev - You are probably the closest to our resident JavaFX wizard. How feasible is a UI like this? |
Looks good, I think I can pull off something like that. But don't wait with merging this PR, I'll need some time and will create another PR for it. |
Probably best to move your UI mockup to a new issue and assign it to me 👍 |
@ShirleyNekoDev I've opened #1479, so you can get assigned to that if you want. In the meantime, when this gets merged but doesn't yet have a dedicated UI, what should we do with the current fog controls? Do they currently work as before but with the new backend? |
@nib9888 the old controls should work as before, you just can't select layered fog with them |
@almrausch It's been a while. 😅 So TL;DR this PR adds layered fog, doesn't modify the behavior of existing scenes and is ready to be merged, right? |
Indeed. It's complete from my side and doesn't interfere with existing scenes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this great new feature! 👏
Can't wait to see more of you video's features in Chunky.
Until we have a UI, I now changed it to be |
* Add freely adjustable layered fog * Fog logic moved to a separate file * Restructured JSON scene format, conversion of old scenes * Fog modes NONE, UNIFORM (classic) and LAYERED * Freely adjustable fog layers * Fog density modelled as the sum of sigmoid functions * GUI not yet adapted to new features * Fix skyFogDensity not being loaded from the JSON.
Completely rewrote the code for the fog so that fog can e.g. concentrate at the bottom, allowing for a wider range of effects. Fog density is modelled as a function of y. It is a sum of bell shaped sigmoid functions. Each fog layer has a center y coordinate, a density and a breadth value. Scattering works only for one layer so far. The scene JSON structure has been altered so that all fog data is stored in one JsonObject. The previous fog behavior is still supported and old scenes will be saved in the new format.
Import the following settings to test the new features:
{"fog":{"mode":"LAYERED","layers":[{"y":62,"breadth":10,"density":1}]}}
{"fog":{"mode":"UNIFORM","uniformDensity":0.05}}
{"fog":{"mode":"NONE"}}
A GUI implementation is still missing. So far the GUI still works the same except that the mode must be set to UNIFORM via JSON. I'd like to leave the GUI part to someone else.