- Home /
TransparentTerrain wiki shader problems
Hello,
I'm trying to create a simple scene where you're walking along a cliff path and my problem is, when I look away, I see this:
My problem is that, despite setting the fog as intense and with any mode, I can still see the goddamn terrain in contrast to the skybox. I don't want that to happening, as in this case, you're supposed to be on top of a REALLY high cliff.
I tried doing what this wiki post says to do, and where I paint with a completely transparent I get blue, when I run it, like in the picture. On the scene editor, it isn't but kind of white, and relatively kind of transparent (on the edges). Anything I could be doing wrong, or any help you could provide?
I know there's a plugin on the asset store to do this, more than one even, but I'm broke as all hell (student, :( ) and don't really want to spend 5-10$ on a goddamn shader mod.
Thanks in advance, any help would be appreciated!
Answer by aldonaletto · Dec 25, 2013 at 02:54 PM
Apparently your problem is the skybox shader, that doesn't take the fog settings into account: the sky shows bright and clear behind the foggy mountains! I solved this problem once by modifying the original skybox shader in order to include fog, and added to it a parameter that adjusts how much the fog vanishes towards the sky - take a look at this answer.
That answer seems amazing! I'm fairly new to unity but that shader seems like it'd solve my problem! I'll try it when I can thanks for the answer man!
I just tried it, and it helped but my problem is still there x-x. Not as bad though, but the square terrain can still be seen brighter than the skybox. What I could really use would be some sort of fog that only happend below a certan y value, and that CO$$anonymous$$PLETELY blocked the terrain. I mean, eventually totally opaque.
You're right! I forgot to clamp the variable fog to the range 0..1 with the function saturate(). Just modify line 43 to this:
half fog = saturate(1 - normalize(i.dir).y / _Fog); // fog vanishes upwards
Tweak the parameter Fog Intensity in the skybox material in order to get the desired results. Thanks for pointing out the issue - my answer is ok now.
Thanks so much for the quick edit, you're helping a lot! It's just perfect now, thanks!
Your answer
Follow this Question
Related Questions
Adding a bump map to the TerrainFourLayer shader 1 Answer
Is it Possible to have Trees with Billboarded Leaves? 2 Answers
Make trees non transparent on camera touch 1 Answer
Make a simple tree 1 Answer
Custom Terrain AddPass not working 0 Answers