drarem Posted June 19, 2015 Share Posted June 19, 2015 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. Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 19, 2015 Share Posted June 19, 2015 it's hard to say without a screenshot, but you can try: self.camera:SetKeyValue("fog_fogislocal","1") Which eliminates fog at depth=1, fog maxrange is then fogrange Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
drarem Posted June 19, 2015 Author Share Posted June 19, 2015 Didn't help. Here are front and back views. http://ibin.co/25o02XrM7zkp http://ibin.co/25o0CKQiK1cK Quote Link to comment Share on other sites More sharing options...
drarem Posted June 23, 2015 Author Share Posted June 23, 2015 Anyone know what can be done to avoid the sprite from disappearing into the fog? Quote Link to comment Share on other sites More sharing options...
CreativeOcclusion Posted June 23, 2015 Share Posted June 23, 2015 I am having the same problem...fog even messes up particle effects... Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 23, 2015 Share Posted June 23, 2015 Well it should work in the latest workshop version. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
drarem Posted June 23, 2015 Author Share Posted June 23, 2015 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") Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 23, 2015 Share Posted June 23, 2015 Those you are using are outdated so that won't work, please update using the ones in workshop. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
drarem Posted June 23, 2015 Author Share Posted June 23, 2015 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") Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 23, 2015 Share Posted June 23, 2015 ... self.camera:SetKeyValue("fog_fogislocal","1") Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
drarem Posted June 24, 2015 Author Share Posted June 24, 2015 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") Quote Link to comment Share on other sites More sharing options...
drarem Posted June 24, 2015 Author Share Posted June 24, 2015 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. Quote Link to comment Share on other sites More sharing options...
drarem Posted June 24, 2015 Author Share Posted June 24, 2015 At the moment I'm thinking I need to make my own particle system out of 2d sprites. Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 24, 2015 Share Posted June 24, 2015 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; Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
drarem Posted June 24, 2015 Author Share Posted June 24, 2015 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") Quote Link to comment Share on other sites More sharing options...
CreativeOcclusion Posted June 24, 2015 Share Posted June 24, 2015 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. This worked for the fog but makes my plants flicker when I move camera... Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 24, 2015 Share Posted June 24, 2015 I can take another quick look, if you send me an example map to test with. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
drarem Posted June 24, 2015 Author Share Posted June 24, 2015 Sent email with attachment. Quote Link to comment Share on other sites More sharing options...
drarem Posted June 25, 2015 Author Share Posted June 25, 2015 Yep forgot the attachment. Check your pmail. Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 25, 2015 Share Posted June 25, 2015 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. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
drarem Posted June 25, 2015 Author Share Posted June 25, 2015 ok thank you for looking into this. Quote Link to comment Share on other sites More sharing options...
drarem Posted June 29, 2015 Author Share Posted June 29, 2015 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. Quote Link to comment Share on other sites More sharing options...
drarem Posted July 5, 2015 Author Share Posted July 5, 2015 <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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.