I have a 3d game with 2d sprites, i guess you call 2,5d, and i want to have fog in it. the standard one, distance fog. i dont know how though. i have some basic understanding of the unity shaders, but i dont know what is required to make sprite work with fog. so any suggestions and help would be appriciated!
also i tried searching for an answer, but none of the posts or unity answers work.
Fog is simply mixing a color based on the distance to the screen, so basically camera.position - object position, you might need to divide by a max distance, clamp the result to the max, which would give you a number between 0 and 1, use that number as a way to blend two colors together with a lerp, I mean the color of your object’s pixel and the color of the fog. Since the depth buffer is such a distance, you can use that to have that blending color.
but how do i get the color of the global fog? maybe some shader pro would like to show some code?
If you knew how to use fog you’d realise it’s in the lighting window and fully documented and you do not need to be a shader pro.
i know that, but my problem is it doesnt work with the default sprite shader. so how do i get sprites with the global fog? i think i need a custom shader. and i dont really know much about shader writing in unity, so if anybody already made a solution, or feel super generous and wants to write me an example, i would be super grateful!