-
Notifications
You must be signed in to change notification settings - Fork 18
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
Render fog zones in Gothic 1 #153
Conversation
Signed-off-by: ThielHater <[email protected]>
I did not notice that. Looking at the code, that change was not intentional and I guess it stems from using the fog color Gothic calculated. |
Could you point me towards the visual changes that should happen? I can't really make out what has changed. for G1 i stood right in the Swamp camp, where there is colored fog, what i think should be a "fog zone" as well as toggled rain (marvin console What do i need to look at to observe the changes? |
My bad, I probably should have given a little more explanation. In Gothic 1 there are just two fog zones, you can find them if you search for zCZoneZFog in World.zen. The default fog zone has a view distance of 15000 units, the fog zone in the Psi Camp has 8000 units. However, the effect is somewhat subtle. You may have a look at this video of the original renderer: fog_d3d7.mp4If you look at the tree right infront, it gets revealed more and more as the camera gets closer but at about 5 seconds it gets covered by the fog again. That is when the camera enters the fog zone and the view distance (also know as far Z value) is reduced. Then the tree gets revealed again, as we are getting closer all the time. Now here is how it looks with the version of the D3D11 renderer, which I want to merge: fog_d3d11.mp4Gothic 1 does not respect the color of the fog zones. Instead it uses the value of SKY_OUTDOOR.zDayColor0 from Gothic.ini for most of the day and interpolates between a list of pre-defined colors, depending on the time of the day. I wrote a Union plugin to calculate the fog color like Gothic 2 does, taking in base color, time of the day and fog zones the player is in, and writing the value to the corresponding address in memory. (By the way, with this change the setting FogColorMod will loose effect for Gothic 1 and the value from zEngine will be used.) As the color of the fog zone in the Psi Camp is 120/120/120, it looks like this: fog_d3d11_plugin.mp4I am not a hundred percent happy with the result. With the D3D11 renderer, the resulting fog color is darker than the original because the shader mixes it with a value coming from the atmospheric scattering. Do you have an idea? Of course things get more interesting, when a mod has it's own fog zones with different colors. 😅 |
One more thing: Gothic 1 uses 95/95/95 as fog color during rain, which is a neutral and not a warm gray. I am not concerned about that, but you raised the question. 😄 |
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.
LGTM
Now that I know what the result should be, everything looks fine :)
Further changes can be in another PR if you're not 100% happy with the current state of the coloring
@ThielHater is this now ready to be merged?
Please go ahead. |
By the way, do you plan a new release? I noted that assimp was updated for example. At first the game crashed because I had an older version. |
I do not in the near time, due to having no time for validating that all changes are OK. People raised some issues about crashes in Chronicles of Myrtana Archolos, which someone has to check if that's on the Renderer or just because the game/mod keeps leaking memory. For now all changes are automatically included, without complete validation, in the |
This PR will modulate the fog density in Gothic 1 based on the far Z value. The behaviour of the renderer with Gothic 2 is not changed.
The fog in Gothic 1 is not that complex. There is no override flag or -color, compared to Gothic 2. Only the far Z value is changed, limiting the maximum view distance and leaving the rest to D3D. That version of zEngine does not even calculate the color but I wrote a Union plugin to fix that.
I did not module HF_WeightZNear and HF_WeightZFar as it was not beneficial to the graphics, the default values are fine.
The change was tested on Gothic 1 inside and outside of a fog zone, with and without rain as well as with and without my additional plugin. Everything looked fine.