Author Topic: How to do "Fog" in particular axis?  (Read 175 times)

Offline SonicBurst2

  • byte
  • *
  • Posts: 24
    • View Profile
How to do "Fog" in particular axis?
« on: June 01, 2017, 11:44:56 pm »
Like for example , if I have a valley ( lets assume depth is in z axis ) , then is there a way / technique to have the fog density increasing along z axis ? So that the depth fades away .
I have checked "setFogging()"... but it's density increases along camera-view's direction.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: How to do "Fog" in particular axis?
« Reply #1 on: June 02, 2017, 08:42:41 am »
You could do that in a shader. However, I don't quite get the point of it. Maybe I misunderstood what you want to do. You want a kind of static fogging, but fades out parts of the scene but indepent from the camera's view?

Offline SonicBurst2

  • byte
  • *
  • Posts: 24
    • View Profile
Re: How to do "Fog" in particular axis?
« Reply #2 on: June 02, 2017, 10:58:12 am »
    Yes, it should be independent of the camera view ,
Like ,Suppose I have a very tall tree , then when looked from above ,with an angle (Like in isometric projection type view),
I shall not be able to see the base of the tree and the ground, it simply fades away ...
I want to give a perception of extreme depth...
The existing inbuilt fogging works, but only when viewed from extreme top view angle. If I change my angle, I can see the base of my "Cliff" and the props on the top side becomes faded which are at a distance .
« Last Edit: June 02, 2017, 11:36:17 am by SonicBurst2 »

Offline MichaelJPCT

  • long
  • ***
  • Posts: 136
    • View Profile
Re: How to do "Fog" in particular axis?
« Reply #3 on: June 05, 2017, 06:55:14 am »
i guess it is called "layered fog". it requires shader and quite much calculation.
but somtimes you can do fake fog - use a transparent plane with foggy texture.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: How to do "Fog" in particular axis?
« Reply #4 on: June 06, 2017, 07:44:33 am »
Or you could use one of the defatul shaders (in the jpct-ae.jar) and modify it in a way that it calculates the fog based on something else but the distance from the camera.