Skip to content

Add support for fog in materials. - #1094

Merged
2 commits merged into
masterfrom
unknown repository
May 30, 2019
Merged

Add support for fog in materials.#1094
2 commits merged into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented May 23, 2019

Copy link
Copy Markdown

As per thread: https://hub.jmonkeyengine.org/t/add-fog-to-lighting-j3md/41873/6

I have added fog to multi-pass lighting.j3md/lighting.vert/lighting.frag for consideration.
I have not made any changes to SPLighting.vert/.frag or PBRLighting yet because the implementation would be the same, so once this has been approved, it can be ported to the rest of the materials.

I have also included a TestLightingFog in the jme-examples to test the three available fog-modes.

  • Linear (simple, lightweight, useful on low-end and android devices)
  • Exponential (medium - prettier but slightly more expensive than linear)
  • ExponentialSquared (expensive compared to the previous two, but the best looking).

The user sets the parameter "UseFog" to enable fog, and must set a FogColor.

  • setBoolean("UseFog", true);
  • setColor("FogColor", new ColorRGBA(0.5f, 0.6f, 0.7f, 1.0f);

Setting one of the following settings will enable that fog type. This is how you decide which fog-type to use.

  • setVector2("LinearFog", new Vector2f(near, far));
  • setFloat("ExpFog", 0.015f);
  • setFloat("ExpSqFog", 0.02ff);

All of this is described in code in the TestLightingFog class.
https://github.com/jayfella/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/light/TestLightingFog.java

@ghost
ghost requested a review from Nehon May 24, 2019 09:36
@ghost
ghost merged commit a8f5ac0 into jMonkeyEngine:master May 30, 2019
@stephengold stephengold added this to the v3.3.0 milestone Jul 8, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants