Conversation
…into remove_pmrem_flag
…into remove_pmrem_flag
* generated environment map now RGBM16 * switched RGBM16 to RGBE * started gaussianBlur * gaussianBlur compiles * gaussian blur functional * gaussianBlur properly parameterized * target caching works * removed extraneous cache, cleaned up generation * Reuse renderer in tests * switched cubeGenerators * reuse renderer in TextureUtils-spec * addressing feedback * generated environment map now RGBM16 * switched RGBM16 to RGBE * started gaussianBlur * gaussianBlur compiles * gaussian blur functional * gaussianBlur properly parameterized * switched cubeGenerators * reuse renderer in TextureUtils-spec * addressing feedback * fixed IE11 shader bug
…del-viewer into newPMREM
cdata
left a comment
There was a problem hiding this comment.
Looks good 👍 but some minor cleanup requested
| licensed under <a href="https://hdrihaven.com/p/license.php">CC0</a> | ||
| (<a href="https://hdrihaven.com/hdri/?h=aircraft_workshop_01">source</a>) | ||
|
|
||
| ## music_hall_01_4k.hdr |
| Symbol('loadEnvironmentMapFromSkyboxUrl'); | ||
| const $loadGeneratedEnvironmentMap = Symbol('loadGeneratedEnvironmentMap'); | ||
|
|
||
| export interface TextureUtilsConfig { |
src/three-components/TextureUtils.ts
Outdated
| const HDR_FILE_RE = /\.hdr$/; | ||
| const ldrLoader = new TextureLoader(); | ||
| const hdrLoader = new RGBELoader(); | ||
| const cubemapSize = 256; |
There was a problem hiding this comment.
Let's capitalize this e.g, CUBEMAP_SIZE (and yeah, ldrLoader / hdrLoader break our convention here a little; they should probably be static class members or something but we can fix that later).
src/three-components/TextureUtils.ts
Outdated
| await Promise.all([environmentMapLoads, skyboxLoads]); | ||
|
|
||
| if (skybox != null) { | ||
| skybox = this.gaussianBlur(skybox, 0.004, GammaEncoding); |
There was a problem hiding this comment.
Doesn't this return a reference to a new, distinct render target? If so, who manages the lifecycle of this instance? When does it get disposed?
There was a problem hiding this comment.
Sometimes it is the same renderTarget (if the input is jpg); if it is hdr then gaussianBlur disposes of the one you gave it and returns this new one in its place.
There was a problem hiding this comment.
Doesn't that mean we're possibly disposing of the cached render target?
There was a problem hiding this comment.
Let's fix this in a following PR to extend our usage of your cachingPolicy.
There was a problem hiding this comment.
To be clear, we're no longer disposing of the cached render target, but we are leaking backgrounds.
src/three-components/TextureUtils.ts
Outdated
| cubeTarget: WebGLRenderTargetCube, | ||
| standardDeviationRadians: number = 0.04) { | ||
| standardDeviationRadians: number = 0.04, | ||
| outputEncoding: TextureEncoding|null = null): WebGLRenderTargetCube { |
There was a problem hiding this comment.
If you just want this to be an optional third argument, you can express it as outputEncoding?: TextureEncoding. The "loose" equality conditionals are useful for this particular scenario only: checking if a value is undefined or null. So, the check further down the page will work as written.
src/three-components/TextureUtils.ts
Outdated
| this.renderer.toneMapping = toneMapping; | ||
| this.renderer.toneMappingExposure = toneMappingExposure; | ||
| this.renderer.gammaOutput = gammaOutput; | ||
| if (outputEncoding != null && outputEncoding === GammaEncoding && |
There was a problem hiding this comment.
Strictly speaking, you probably don't need the first clause of this condition because outputEncoding === GammaEncoding will always be false for every non-number value.
| vec4 inputTexelToLinear(vec4 value, int encoding){ | ||
| if(encoding == 0){ | ||
| uniform int inputEncoding; | ||
| uniform int outputEncoding; |
src/three-components/TextureUtils.ts
Outdated
| if (outputEncoding != null && outputEncoding === GammaEncoding && | ||
| cubeTexture.encoding !== GammaEncoding) { | ||
| cubeTarget.dispose(); | ||
| const outParams = { |
There was a problem hiding this comment.
Let's call this blurTargetOptions or something like that
* removed pmrem attribute * removed pmrem attribute from non-code files * default environment map now uses PMREM * fixed tests * using PMREM for all cases, fixing #565 * increasing sauce timeout to 3min * target caching works * removed extraneous cache, cleaned up generation * added LDR and HDR environment tests * updated goldens * Reuse renderer in tests (#668) * Refactor envmap / skybox generation * default stage light to zero, removed hemisphere light (#674) * added new PMREMGenerator * modified MeshStandardShader to show it can work * Switch environment generation from HalfFloat to RGBE (#670) * generated environment map now RGBM16 * switched RGBM16 to RGBE * started gaussianBlur * gaussianBlur compiles * gaussian blur functional * gaussianBlur properly parameterized * target caching works * removed extraneous cache, cleaned up generation * Reuse renderer in tests * switched cubeGenerators * reuse renderer in TextureUtils-spec * addressing feedback * generated environment map now RGBM16 * switched RGBM16 to RGBE * started gaussianBlur * gaussianBlur compiles * gaussian blur functional * gaussianBlur properly parameterized * switched cubeGenerators * reuse renderer in TextureUtils-spec * addressing feedback * fixed IE11 shader bug * added envmap chunk * updated three's shaders * fixed shaders * shaders compile * fixed all WebGL errors * PMREMGenerator now takes any encoding of input texture * fixed several shader bugs * fixed mipmap generation * fixed maxLod * PMREM mostly working * recreate intermediate targets * fixed mipmap level selection * minor cleanup * addressing feedback * refactored PMREM * cleanup * dispose of temp materials * removed envMap hack * blurring skybox * HDR skyboxes are now interpolated * reduced skybox resolution to match input * minor cleanup * fixed skybox metadata * reduced cubemapSize, cleanup * updated all environments to 1k * re-enable Android tests * Revert "re-enable Android tests" This reverts commit f743b26. * addressing feedback * Gaussian blur returns a new target
|
Love the blurred skyboxes! 👌 I tried the feature in http://model-viewer-tester.glitch.me/ and I'm not sure the exposure works correctly for the background now. Is there something I should change in my test? |
|
I played around with it and couldn't tell if anything was wrong. Do you
have a screenshot of what you expected it to look like at that exposure
level?
…On Tue, Aug 13, 2019 at 4:41 PM Mr.doob ***@***.***> wrote:
Love the blurred skyboxes! 👌
I tried the feature in http://model-viewer-tester.glitch.me/ and I'm not
sure the exposure works correctly for the background now.
[image: Screen Shot 2019-08-13 at 4 35 40 PM]
<https://user-images.githubusercontent.com/97088/62984723-2195b600-bde9-11e9-851b-afcd288b6bff.png>
Is there something I should change in my test?
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#695>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAB2TUY74V36YSW5NWAI3OLQENBCPANCNFSM4IJZCYAA>
.
|
|
Ah yes, good catch. This is because of the way I made the skybox
interpolate, by converting it to RGB. Works great except when the exposure
changes, which I neglected to test. I guess I should tweak the shader
instead to interpolate RGBE.
…On Tue, Aug 13, 2019 at 5:31 PM Christopher Joel ***@***.***> wrote:
👍 great catch @mrdoob <https://github.com/mrdoob> I filed #707
<#707> to
investigate
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#695>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMS2LDXGG3GL4CRPVSHY2DQENG53ANCNFSM4IJZCYAA>
.
|
Blur skybox (google#695) * removed pmrem attribute * removed pmrem attribute from non-code files * default environment map now uses PMREM * fixed tests * using PMREM for all cases, fixing google#565 * increasing sauce timeout to 3min * target caching works * removed extraneous cache, cleaned up generation * added LDR and HDR environment tests * updated goldens * Reuse renderer in tests (google#668) * Refactor envmap / skybox generation * default stage light to zero, removed hemisphere light (google#674) * added new PMREMGenerator * modified MeshStandardShader to show it can work * Switch environment generation from HalfFloat to RGBE (google#670) * generated environment map now RGBM16 * switched RGBM16 to RGBE * started gaussianBlur * gaussianBlur compiles * gaussian blur functional * gaussianBlur properly parameterized * target caching works * removed extraneous cache, cleaned up generation * Reuse renderer in tests * switched cubeGenerators * reuse renderer in TextureUtils-spec * addressing feedback * generated environment map now RGBM16 * switched RGBM16 to RGBE * started gaussianBlur * gaussianBlur compiles * gaussian blur functional * gaussianBlur properly parameterized * switched cubeGenerators * reuse renderer in TextureUtils-spec * addressing feedback * fixed IE11 shader bug * added envmap chunk * updated three's shaders * fixed shaders * shaders compile * fixed all WebGL errors * PMREMGenerator now takes any encoding of input texture * fixed several shader bugs * fixed mipmap generation * fixed maxLod * PMREM mostly working * recreate intermediate targets * fixed mipmap level selection * minor cleanup * addressing feedback * refactored PMREM * cleanup * dispose of temp materials * removed envMap hack * blurring skybox * HDR skyboxes are now interpolated * reduced skybox resolution to match input * minor cleanup * fixed skybox metadata * reduced cubemapSize, cleanup * updated all environments to 1k * re-enable Android tests * Revert "re-enable Android tests" This reverts commit f743b26. * addressing feedback * Gaussian blur returns a new target


Fixes #181
Fixes #528
This applies our cubemap Gaussian blur function to the skybox. In the process, it also converts an RGBE skybox to RGB so that it can be mipmapped and interpolated like an LDR skybox. I'm not 100% happy with the Gaussian blur function yet, as there is still a bit of aliasing, but I have an idea to improve it that we can look into as a follow-on.