Jump to content

Shadamar's fog


drarem
 Share

Recommended Posts

Hi, I have two questions.

1)

I'm using this:

Shaders/PostEffects/02_pp_fog_by_klepto.lua

 

and adding this:

self.camera:SetKeyValue("fog_fogrange","5,60")

self.camera:SetKeyValue("fog_fogcolor","0.7,0.66,0.62,0.6")

self.camera:SetKeyValue("fog_fogangle","5,21")

 

 

and 2d sprites even with the Z-sort set, looks weird when fog is in background. If I have the fog really close in, the sprite tends to blend in or disappear when viewing it with the fog. When the 2d sprite is against a 3d background, it looks fine.

 

2)

Also on the second question, I'm wondering if I should create 3 large half-spheres and parent to the Player. Create fog textures for them, so furthest away has everything the most opaue. Do stuff behind it get rendered or not, although I think the posteffects would make for the best fog.

 

Thanks.

 

It says by 'klepto', maybe i'm confused but i know Shadmar is the go to guy for shaders.

Link to comment
Share on other sites

Is it now 50_pp_klepto_fog.lua ?

 

I tried using this and get these:

 

http://ibin.co/26GDiJcVU14Q

http://ibin.co/26GDnw3UvKje

 

here is the code (also tried just adding to the Scene root, same effect):

 

mfog = self.camera:AddPostEffect("AddOns/Post Process Shaders (shadmar)/50_pp_klepto_fog.lua")

 

self.camera:SetFOV(70)

self.camera:SetRange(0.05,16000)

self.camera:SetMultisampleMode((System:GetProperty("multisample","4")))

 

--self.camera:AddPostEffect("Shaders/Post Process Shaders(shadmar)/50_pp_klepto_fog.lua")

self.camera:SetKeyValue("fog_fogrange","5,25")

self.camera:SetKeyValue("fog_fogcolor","0.7,0.66,0.62,0.6")

self.camera:SetKeyValue("fog_fogangle","5,21")

self.camera:SetKeyValue("fog_fogislocal","1")

Link to comment
Share on other sites

I uninstalled, deleted Shaders/Posteffects folder and then reinstalled. This still causes the sprites to 'fade into the fog'

 

mfog = self.camera:AddPostEffect("Shaders/PostEffects/02_pp_fog_by_klepto.lua")

 

self.camera:SetFOV(70)

self.camera:SetRange(0.05,16000)

self.camera:SetMultisampleMode((System:GetProperty("multisample","2")))

 

self.camera:SetKeyValue("fog_fogrange","5,25")

self.camera:SetKeyValue("fog_fogcolor","0.7,0.66,0.62,0.6")

self.camera:SetKeyValue("fog_fogangle","5,21")

Link to comment
Share on other sites

Sorry I'm trying, not getting the results i'm expecting. i want a close-in fog. skybox is also blending where you can see it thruogh the top of the fog.

 

self.camera:SetKeyValue("fog_fogrange","0,1000")

self.camera:SetKeyValue("fog_fogcolor","0.7,0.66,0.62,0.6")

self.camera:SetKeyValue("fog_fogangle","5,21")

self.camera:SetKeyValue("fog_fogislocal","1")

Link to comment
Share on other sites

I might have figured out what's going on. If the material for the texture is set to solid instead of alpha then the fog doesn't interfere with it. You just have to make sure your sprite has alpha in it for the see-through parts. We have a bunch of materials set to Alpha instead of Solid, the fog appears to attenuate? or worsen the alpha effect .

 

 

*** UPDATE ***

Yep, that was it. I turned zsort back off, changed Alpha to Solid, then shader to diffuse+normal+alphamask.shader and everything is ok once again. Let me know if this helps anyone else.

Link to comment
Share on other sites

Hey, you can try adding this as line 63 in _klepto_fog.shader and set fogislocal to 0

 	 if (fragData0.a < 1.0) fogeffect*=clamp(fragData0.a,0.0,1.0);

 

or keep fogislocal as 1 and add this as line 63:

 

 	 if (fogislocal) fogeffect=0;

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Doesn't seem to have helped tried both changes in line 63 as suggested.

 

with first one:

http://ibin.co/26MezaBQwsok

 

with second one/code:

http://ibin.co/26MhBi3siqPN

 

mfog = self.camera:AddPostEffect("Shaders/PostEffects/02_pp_fog_by_klepto.lua")

self.camera:SetMultisampleMode((System:GetProperty("multisample","2")))

 

self.camera:SetKeyValue("fog_fogrange","5,15")

self.camera:SetKeyValue("fog_fogcolor","0.7,0.66,0.62,0.6")

self.camera:SetKeyValue("fog_fogangle","5,21")

self.camera:SetKeyValue("fog_fogislocal","1")

Link to comment
Share on other sites

Ok, I see the problem, that is not easy to fix since sprites and particles always renders without depth, so the fog shaders doesn't even consider the sprites/paticles at all (they are invisible for the shader and the fog shader, they keep the depth of the geometry behind them)

 

Unfortunately there is no way for me to calculate their depth either.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

I was thinking about it a bit more, i wouldn't mind the particles sticking out a bit more than the fog since the fog is usually in the distance. I think it would be better than blending with the fog by default. I can always tone the particles alpha down even more if needed, would that be possible?

 

Thanks.

Link to comment
Share on other sites

<Ok, I see the problem, that is not easy to fix since sprites and particles always renders without depth, so the fog shaders doesn't even consider the sprites/paticles at all (they are invisible for the shader and the fog shader, they keep the depth of the geometry behind them)

 

Unfortunately there is no way for me to calculate their depth either.>

 

 

On sprites, I can set a static sprite to Solid as long as it has alpha, it appears with no problem. Any updates on this?

 

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...