Skip to content
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

Docs: Improved PMREMGenerator page. #23514

Merged
merged 3 commits into from
Feb 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions docs/api/en/extras/PMREMGenerator.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,36 @@ <h1>[name]</h1>
CubeUV format that allows us to perform custom interpolation so that we can support nonlinear formats such as RGBE.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the RGBE comment still apply?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, good catch, since it's all float now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this page and the comments in the source code may be outdated. Can you please have a look? 😇

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Unlike a traditional mipmap chain, it only goes down to the LOD_MIN level (above), and then creates extra even more
filtered 'mips' at the same LOD_MIN resolution, associated with higher roughness levels. In this way we maintain
resolution to smoothly interpolate diffuse lighting while limiting sampling computation.
resolution to smoothly interpolate diffuse lighting while limiting sampling computation.<br/><br/>

Note: The minimum [page:MeshStandardMaterial]'s roughness depends on the size of the provided texture:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also note this is a slightly conservative bound. If your render has small dimensions or the shiny parts have a lot of curvature, you may still be able to get away with a smaller texture size.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added that additional info verbatim.


<table>
<tr>
<th>texture size</td><th>minimum roughness</td>
</tr>
<tr>
<td>16</td><td>0.21</td>
</tr>
<tr>
<td>32</td><td>0.15</td>
</tr>
<tr>
<td>64</td><td>0.11</td>
</tr>
<tr>
<td>128</td><td>0.076</td>
</tr>
<tr>
<td>256</td><td>0.054</td>
</tr>
<tr>
<td>512</td><td>0.038</td>
</tr>
<tr>
<td>1024</td><td>0.027</td>
</tr>
</table>
</p>

<h2>Constructor</h2>
Expand All @@ -42,16 +71,14 @@ <h3>[method:WebGLRenderTarget fromEquirectangular]( [param:Texture equirectangul
<p>
[page:Texture equirectangular] - The equirectangular texture.<br /><br />

Generates a PMREM from an equirectangular texture, which can be either LDR or HDR.
The ideal input image size is 1k (1024 x 512), as this matches best with the 256 x 256 cubemap output.
Generates a PMREM from an equirectangular texture.
</p>

<h3>[method:WebGLRenderTarget fromCubemap]( [param:CubeTexture cubemap] )</h3>
<p>
[page:CubeTexture cubemap] - The cubemap texture.<br /><br />

Generates a PMREM from an cubemap texture, which can be either LDR or HDR.
The ideal input cube size is 256 x 256, as this matches best with the 256 x 256 cubemap output.
Generates a PMREM from an cubemap texture.
</p>

<h3>[method:undefined compileCubemapShader]()</h3>
Expand All @@ -66,8 +93,7 @@ <h3>[method:undefined compileEquirectangularShader]()</h3>

<h3>[method:undefined dispose]()</h3>
<p>
Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, so you should not need more than one
PMREMGenerator object. If you do, calling dispose() on one of them will cause any others to also become unusable.
Disposes of the PMREMGenerator's internal memory.
</p>

<h2>Source</h2>
Expand Down