Conversation
|
See #4834 for discussion about the pow() warnings, it's a known issue, and actually a DirectX warning from the Angle translation of shaders. |
0e922a8 to
41c0bdb
Compare
|
@aardgoose Good to know it is a known problem, at least. Not introduced by me now. This is (properly) ready for review. |
|
@gogoend This PR modifies existing docs and adds a new class |
There was a problem hiding this comment.
The PR introduces FogExp in a straightforward, copy-paste, search-replace way.
The additional changes to documentation are needed. They may need a couple more critical eyes on them, though.
It felt natural to include the GLSL optimizations in the same PR. Comment #17316 (comment) by @WestLangley (and the following discussion) applies to this PR too, to the extent that it is a valid point:
Be aware that this PR, as currently-written, is going to significantly change fog behavior for users who use linear fog with and an OrthographicCamera and a negative value for near plane.
I will not be surprised if there are complaints.
I replied that the docs do not seem to allow negative near plane, and that multiplying sign(fogPosition.z) into fogDepth may be a simple solution if negative near is to be supported. I suggest continuing the discussion here, since @supereggbert has expressed support for pursuing my PR as first choice.
|
|
||
| float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth ); | ||
|
|
||
| vec3 scaledFogPosition = fogDensity * fogPosition; |
There was a problem hiding this comment.
This and the following lines avoid computing a precisionSafeLength just to square it (which would invariably fail in exactly the same cases where length would fail). Proposed in #17316 (comment)
| import { FogExp2 } from '../../../../src/scenes/FogExp2'; | ||
|
|
||
| export default QUnit.module( 'FoxExp2', () => { | ||
| export default QUnit.module( 'FogExp2', () => { |
There was a problem hiding this comment.
This was a typo that I discovered when doing search&replace. It should be fixed whether or not the PR is merged.
|
@titansoftime Would you like to test this? Considering how #14786 ended. |
|
I can test once merged. |
|
@mrdoob Any chance of getting a review/merge soon? I try not to nag people too much, but FogExp was accepted by you as a good addition, so I went ahead with implementing it for common good. #17264 (comment) #17264 (comment) Are any of the additional changes problematic? I think I have justified them well, but I am sure more perspectives may improve them further. @Mugen87 @WestLangley |
Would you like to test the https://eliashasle.github.io/testing/fog_types/ demo on your mobile device before I start refactoring to the new API? I guess part of the refactoring update will also be to make examples that explicitly set precision |
Looks good. Though without an orbit cam, it's kinda difficult to be sure. Previously I would rotate the camera to reveal "fail areas" in the fog. |
|
Thanks! Did you get to test all three fog types and different param values? (dat.gui isn't the most mobile-friendly) And are you certain that you were running in
I think I disabled it to avoid some event-handling conflicts. |
author Elias Hasle <elias.hasle@gmail.com> 1566822048 +0200 committer Elias Hasle <elias.hasle@gmail.com> 1569597690 +0200 RangeFog(color, near, far) and DensityFog(color, density, squared) Added fog types example. Currently includes some extra examples that show functionality of legacy signatures, and mediump and lowp operation for all fog types. Includes the change to distance-based depth, as well as corrections to better support mediump. Makes mrdoob#17316 and mrdoob#17324 obsolete. Force update when squared is changed. Fix legacy example and mediump example Attempted fixes for editor
|
This gets worse and worse. Until a few minutes ago there was a monster diff, and now there is no diff at all, and the PR was "merged" and automatically closed. 😛 I will just have to go on... |
|
#17592 is a new try... I will clean it up a bit before I mark it as ready for review. |

Update: #17592 replaces this PR.
Step 2 of the plan in #17264, adapted to comply with #17420 (comment).
Outdated
Also correct typescript docstring and misspelled name in test file for FogExp2, as well as docs for standard Fog.Includes the change to distance-based depth, as well as corrections to better support mediump and avoid unnecessary squaring of a square root. Makes #17316 and #17324 obsolete.
Requires new build, update to the library build used in the editor, doc build, examples build.
I added an example named
webgl_geometry_terrain_fog_types, which is basicallywebgl_geometry_terrain_fogwithout flight and with a GUI to try different fog setups. Everything seems to work.Outdated link... Will be updated soon
Running version here: https://eliashasle.github.io/testing/fog_types/ (I thinkFogExplooks much more natural than the others.)I have added additional versions of the new example, that test legacy signatures,
mediumpandlowp, respectively. They should probably be removed before merging.I am currently struggling with git. Hoping to get everything in order soon.
Resolved
Some examples give an apparently unrelated warning message about using `pow` with negative input. I would really appreciate pointers into what goes wrong, as I am not using `pow` in my code or, as far as I can see, outputting anything that can be negative.