-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix singlepass lighting artifacts and make it the default #2652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
26105de
prefer singlepass lighting
riccardobl decaa1c
keep old tests by defaulting to multipass lighting
riccardobl 08582ac
make sure TBN is always normalized
riccardobl 2e576b3
update tests
riccardobl 0a61098
fix sp lighting when no light is in the scene
riccardobl eb0e2da
apply Gram-Schmidt orthogonalization do SPLighting
riccardobl 104c4fa
update tests
riccardobl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 21 additions & 16 deletions
37
jme3-core/src/main/resources/Common/ShaderLib/Math.glsllib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,22 @@ | ||
| #ifndef __MATH_GLSLLIB__ | ||
| #define __MATH_GLSLLIB__ | ||
|
|
||
| /// Multiplies the vector by the quaternion, then returns the resultant vector. | ||
| vec3 Math_QuaternionMult(in vec4 quat, in vec3 vec){ | ||
| return vec + 2.0 * cross(quat.xyz, cross(quat.xyz, vec) + quat.w * vec); | ||
| } | ||
|
|
||
| void Math_lengthAndNormalize(in vec3 vec,out float outLength,out vec3 outNormal){ | ||
| float dotv=dot(vec,vec); | ||
| float invl=inversesqrt(dotv); | ||
| outNormal=vec*invl; | ||
| outLength=invl*dotv; | ||
| } | ||
|
|
||
|
|
||
| #ifndef __MATH_GLSLLIB__ | ||
| #define __MATH_GLSLLIB__ | ||
|
|
||
| /// Multiplies the vector by the quaternion, then returns the resultant vector. | ||
| vec3 Math_QuaternionMult(in vec4 quat, in vec3 vec){ | ||
| return vec + 2.0 * cross(quat.xyz, cross(quat.xyz, vec) + quat.w * vec); | ||
| } | ||
|
|
||
| void Math_lengthAndNormalize(in vec3 vec,out float outLength,out vec3 outNormal){ | ||
| float dotv=dot(vec,vec); | ||
| if(dotv <= 0.0){ | ||
| outNormal = vec3(0.0); | ||
| outLength = 0.0; | ||
| return; | ||
| } | ||
| float invl=inversesqrt(dotv); | ||
| outNormal=vec*invl; | ||
| outLength=invl*dotv; | ||
| } | ||
|
|
||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+2 Bytes
(100%)
...eyengine.screenshottests.effects.TestIssue1773.testIssue1773_localSpace_f45.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1 Byte
(100%)
...eyengine.screenshottests.effects.TestIssue1773.testIssue1773_worldSpace_f45.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-101 Bytes
(100%)
...tests.light.pbr.TestPBRLighting.testPBRLighting_DefaultDirectionalLight_f12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-142 Bytes
(100%)
...screenshottests.light.pbr.TestPBRLighting.testPBRLighting_HighRoughness_f12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-202 Bytes
(100%)
....screenshottests.light.pbr.TestPBRLighting.testPBRLighting_LowRoughness_f12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+76 Bytes
(100%)
...tests.light.pbr.TestPBRLighting.testPBRLighting_UpdatedDirectionalLight_f12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-93 Bytes
(100%)
...creenshottests.light.pbr.TestPBRSimple.testPBRSimple_WithRealtimeBaking_f10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-93 Bytes
(100%)
...enshottests.light.pbr.TestPBRSimple.testPBRSimple_WithoutRealtimeBaking_f10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+39 Bytes
(100%)
....jmonkeyengine.screenshottests.material.TestSimpleBumps.testSimpleBumps_f10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5 Bytes
(100%)
....jmonkeyengine.screenshottests.material.TestSimpleBumps.testSimpleBumps_f60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5.05 KB
(110%)
...s/org.jmonkeyengine.screenshottests.post.TestCartoonEdge.testCartoonEdge_f1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+371 Bytes
(100%)
...rc/test/resources/org.jmonkeyengine.screenshottests.post.TestFog.testFog_f1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+19 Bytes
(100%)
...onkeyengine.screenshottests.post.TestLightScattering.testLightScattering_f1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-262 Bytes
(100%)
...rces/org.jmonkeyengine.screenshottests.water.TestPostWater.testPostWater_f1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.