-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Feat: support spherical harmonic #392
Merged
GuoLei1990
merged 22 commits into
galacean:dev/0.5
from
zhuxudong:feat/support-spherical-harmonic
Aug 6, 2021
Merged
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
304c4c2
feat: support spherical harmonics
zhuxudong dfa4720
Merge branch 'dev/0.5' into feat/support-spherical-harmonic
696aef9
feat: use spherical harmonics to render indirect diffuse radiance
833dc86
refactor: return color is convenience
113956a
refactor: rename
zhuxudong 9e44f6f
refactor: scale the solid angle by light
zhuxudong 2f7555f
feat: support scale spherical harmonics
zhuxudong c2a8e13
refactor: use deep clone
zhuxudong bd04d3f
feat: [SH] support import/export sh
zhuxudong 34c61a1
docs: update comment
aa81785
perf: prevent gc
9faebd0
Merge branch 'dev/0.5' into feat/support-spherical-harmonic
841fdde
Merge branch 'dev/0.5' into feat/support-spherical-harmonic
3c86ab7
doc: add comments
0ac023d
refactor: use `setValueByArray` and `toArray` and adding `offset` of …
852fe4c
refactor: delete color
be252b7
refactor: use new sh api
12bbf41
refactor: use new macro name
441c885
doc: add comment
f4b74a3
refcator: opt code (#4)
GuoLei1990 b877062
fix: scale color
46b8c95
refactor: rename
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
There are no files selected for viewing
This file contains 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 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 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 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,21 +1,9 @@ | ||
#if defined(RE_IndirectDiffuse) | ||
|
||
vec3 irradiance = vec3(0); | ||
|
||
#ifdef O3_USE_DIFFUSE_ENV | ||
vec3 lightMapIrradiance = textureCube(u_env_diffuseSampler, geometry.normal).rgb * u_envMapLight.diffuseIntensity; | ||
#else | ||
vec3 lightMapIrradiance = u_envMapLight.diffuse * u_envMapLight.diffuseIntensity; | ||
#endif | ||
|
||
#ifndef PHYSICALLY_CORRECT_LIGHTS | ||
lightMapIrradiance *= PI; | ||
#endif | ||
|
||
irradiance += lightMapIrradiance; | ||
|
||
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); | ||
|
||
#ifdef O3_USE_SH | ||
vec3 irradiance = getLightProbeIrradiance(u_env_sh, normal) * u_envMapLight.diffuseIntensity; | ||
#else | ||
vec3 irradiance = u_envMapLight.diffuse * u_envMapLight.diffuseIntensity; | ||
#endif | ||
|
||
RE_IndirectDiffuse_Physical( irradiance, geometry, material, reflectedLight ); | ||
|
||
|
This file contains 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check this :http://www.fractalforums.com/programming/shader-function-or-instruction-cost-(performance)/
How to say: many engine get irradiance use the func like this:
Because
dot
cost only 3 cycles in GPU, so is faster, If you do this you must do some modifies before Incoming shader.