Closed SaulMyers closed 2 years ago
I've had a poke around in the code and found that this logic in WorldConverter.h is excluding the relevant polygons when converting the world over:
// Check if we even need this polygon
if ( poly->GetPolyFlags()->GhostOccluder && poly->GetPolyFlags()->PortalPoly) {
continue;
}
Apparently the polys that are displayed around the forests are PortalPoly's, because if you remove that check from the IF, then they're included and displayed:
The issue now is that the engine isn't increasing the transparency of them as you get closer to the forest - I'll do some more looking around in the code but I have no idea what I'm doing so if any of the original devs can point me in the right direction then that would be great.
I had a crack at writing a shader to implement the old school forest effect and it looks great I think - the dark forests fade into view like they do with the original renderer. I'll do some more testing and tidy up the code and see if I can figure out how to create a merge request - I never did get a handle on how git works.
Here's the shader for what it's worth:
//-------------------------------------------------------------------------------------- // World/VOB-Pixelshader for G2D3D11 by Badmofo //--------------------------------------------------------------------------------------
cbuffer DIST_Distance : register(b3) { float DIST_DrawDistance; float3 DIST_Pad; }
//-------------------------------------------------------------------------------------- // Textures and Samplers //-------------------------------------------------------------------------------------- SamplerState SS_Linear : register(s0); SamplerState SS_samMirror : register(s1); Texture2D TX_Texture0 : register(t0); Texture2D TX_Texture1 : register(t1); Texture2D TX_Texture2 : register(t2); TextureCube TX_ReflectionCube : register(t4);
//-------------------------------------------------------------------------------------- // Input / Output structures //-------------------------------------------------------------------------------------- struct PS_INPUT { float2 vTexcoord : TEXCOORD0; float2 vTexcoord2 : TEXCOORD1; float4 vDiffuse : TEXCOORD2; float3 vNormalVS : TEXCOORD4; float3 vViewPosition : TEXCOORD5; float4 vPosition : SV_POSITION; };
//-------------------------------------------------------------------------------------- // Pixel Shader //-------------------------------------------------------------------------------------- DEFERRED_PS_OUTPUT PSMain(PS_INPUT Input) : SV_TARGET { //how far is the nameless hero from the object? float distFromCamera = distance(Input.vViewPosition, Input.vPosition);
//start / end distances for fading
float startFade = 8000.0f;
float completeFade = 6000.0f;
//how much to fade the object by
float percentageFade = (distFromCamera - completeFade) / (startFade - completeFade);
//keep the fade in bounds
if (percentageFade < 0) { percentageFade = 0.0f; clip(-1); }
if (percentageFade > 1) {percentageFade = 1.0f;}
//sample the texture we want to fade out
float4 color = TX_Texture0.Sample(SS_Linear, Input.vTexcoord) / 2;
//apply fade
DEFERRED_PS_OUTPUT output;
output.vDiffuse = float4(color.rgb, percentageFade);
return output;
}
I'll do some more testing and tidy up the code and see if I can figure out how to create a merge request - I never did get a handle on how git works.
for an easy route: Just click up there on "fork", clone your new repository, apply the changes there, push the commits and then github will automatically ask you if you want to PR :)
OK you have a pull request. Let me know if you have any questions - I have no experience writing shaders so there's probably a better way to do it. I also considered making this configurable but didn't in the end - it wouldn't be hard to do though.
Actually @kirides ignore that first pull request, I've found a situation where PB used some ground textures to darken cave entrances, etc and they can't be blended, so it doesn't look right. I've fixed that and might have an improvement for the waterfall splashes incoming too so will do some more testing and report back.
@lucifer602288 can you try the following build, once it's completed? https://github.com/kirides/GD3D11/actions/runs/3112378474 alpha blending was removed again
@SaulMyers you're keeping an eye open at the review messages in https://github.com/kirides/GD3D11/pull/108 ? :)
@SaulMyers you're keeping an eye open at the review messages in #108 ? :)
No I don't see any review messages there.
Thanks for the feedback I'll look into those issues 👍
OK @lucifer602288 I've fixed that forest illumination issue. I don't have a Gothic 2 save close to the ocean and I didn't check it before applying this fix, but it looked OK for me from a distance. If it still doesn't look right then please attach a screen shot.
The illumination is not fixed, it is still as the above picture above but the fading effect is better. Regarding the ocean at Gothic 2 it was a previous comment which I deleted. The waterfall foam is currently not transparent.
The illumination was working fine for me but I've made a change to darken it by degrees depending on the day / night cycle - try the latest version and let me know if you're still having trouble.
I also added load / save of SunLightStrength and ShadowStrength from the ini file - their defaults don't look right in Gothic 1 I don't think, so I wanted to be able to edit and load them.
Yes it doesn't look right - can you confirm that your build is copying the latest version of the shader into the GD3D11\shaders folder? This is the latest version: https://github.com/kirides/GD3D11/pull/108/commits/ec50ce2ef8f9fec263da7c961aa4939f09b048d7#diff-8dc7029fe52829be0586e7f8296f3332f0eff221b51087442f5cdc54630588af
@SaulMyers you're keeping an eye open at the review messages in #108 ? :)
No I don't see any review messages there.
[...]
i assigned you the PR #108 Hopefully they show up ^^
@SaulMyers Yes the latest version from today was used. I think the illuminatation can not be completly prevented because it is as well without the renderer available. And I removed the installed VDFs to check if this forest illumination has something to do with a plugin or texture package. Therefore I would keep this as it is and as well let others test it if it is ok for them. Maybe the fading effect away should have a diffuse effect. You can see the hard fading away texture edge in the follwing video in the last seconds: https://mega.nz/file/0RtjkKga#wASpTQ6XPO8H5TGIxrmgAf_xThMgYX_ZFBBsUiM_hws Here two forests can be seen: https://mega.nz/file/kdcFzQxb#yhxvIcmtvENK0ml1QLKEz7uZl9FXmVw4y--o8IAwtU0
Thanks for rechecking but I can't explain it - the shader gives complete control over the illumination and as you can see below, I see no illumination. This is looking at one of the forests you shared in the second video. I tested this without any custom settings or texture packs and it works OK - did you look in your game's shader folder and confirm that the correct version of the 'PS_PortalDiffuse.hlsl' is in there?
And yes the shader does use a diffuse effect on the actual texture - that hard fade you see there is the depth buffer instance of the texture which is rendered to ensure that fog isn't seen through the texture. All I could do was clip that depth buffer instance, which is why the texture itself fades out nicely but you still see that hard line sometimes - that's the fog clipping back in.
This is all new to me, I've never done anything with a renderer before, so I haven't solved that problem yet. I'll have another look when I have time.
And BTW I've made some changes to the water and fog shaders to stop them glowing at night. I'll wait for this change to be finished before commiting that though.
Before:
After:
Here's a video to show how the forests (and fog / water) darkens / brightens depending on the where the sun is in the sky:
@SaulMyers you're keeping an eye open at the review messages in #108 ? :)
No I don't see any review messages there. [...]
i assigned you the PR #108 Hopefully they show up ^^
I still don't see any review comments...? I've never used GitHub before so might be missing something.
@SaulMyers: Edit: Merged the water fall foam change from ThielHater which is a slight change. If you have a better solution for the water fall foam I would like to have added this in the pull request #108 before merging. Nevertheless thank you for improving the look of Gothic.
Additional the water reflects in real world at night the surrounding light from the sky/moon, a lamp or torch, glowing is unnormal. Yes the mountains in the background did glow which is unnormal.
Somehow the lot of options of the renderer in the F11 menu, the Ctrl+F11 menu and the ini file should be documented. I think somehow to work collaborative on it a google document should be created.
Yes that would be good, and I also think that some of the defaults for G1 aren't right. I assume this engine was originally meant for G2 because they look good there - atmospheric scattering for example looks good in G2 but not good in G1.
For anyone who's interesting in using the change associated with this ticket, there's a new Ctrl+11 setting under 'General' called 'DrawForestPortals'. This will turn on the dark forest feature being discussed here - it's disabled by default because I wasn't sure if anyone else would want this visible.
I love this renderer but I do miss the dark forests from the outside looking in, which seem to be achieved by opaque panels that become transparent as you get near to them. These are missing when using the DX11 renderer and I wonder if there's a way to introduce them?
Original: https://ibb.co/WyLpfjv
DX11: https://ibb.co/q0zsw3x