Conversation
This can help avoid artifacting when generating environment maps
|
I can't work out why this issue isn't manifesting in the ocean demo though. https://threejs.org/examples/webgpu_ocean.html |
|
Before merging the PR, we should indeed find out why |
|
In case it's convenient, code for the demo is also here: https://github.com/jwheare/threejs-demos/tree/main/skytest
I added WaterMesh and pmrem tickbox options to more closely match the ocean example. |
|
Note that https://threejs.org/examples/webgl_animation_keyframes.html show a similar artifact in the sun itself.
|
|
Is that the mesh disc or the environment version? I can't replicate that with any azimuth/elevation. The closest I can get is on the webgl version of ocean there's a slightly pixellated reflection/environment disc, but not as bad as your screenshot. What precise settings give you that? |
|
This was just |
|
I think what The reflection issue can be somewhat mitigate by using a higher-resolution PMREM. Below fiddle uses 1024 as the PMRME size which mitigates the pixelation artifacts (at least it works better than in What also seems to help is to use a softer smoothstep boundary for the sun. Meaning instead of three.js/examples/jsm/objects/Sky.js Line 259 in 8356932 But that is something I wouldn't change since you normally want the sharper sun disc look for the skydome. |
Ah ok, I didn't realise that was looking at the cube itself, I've just been focusing on the flat plane reflections. |
|
I can't really afford the performance hit of the pmrem, even at the default lower resolution. A low res cube cam render target works ok for the overall effect, it's just the extremely pixelly sun that causes issues. I'll experiment with the smoothstep, but would you agree that there will still be a need for disabling the disc in this PR or would you instead recommend just switching to a custom forked version? |
|
I think a flag does make sense. I doubt this is "fixable" in Would you be willing to add this to |
|
Done, also made some small other consistency/docs tweaks. |



When rendering a SkyMesh to a cube camera render target or pmremgenerator for use as the scene environment, the sun disc can cause artifacts to appear on surfaces.
This PR adds a new option
showSunDisc, on by default, that lets you selectively disable it when rendering the environment map.I have also removed the extra unnecessary precision from constants that javascript will ignore. Let me know if you'd prefer this to be in a separate PR.
Here's a demo that shows the issue, you can toggle Sun -> showSunDiscEnv.
https://jwheare.com/threejs/skytest/
You can also adjust the time of day to see how the artifacting comes and goes.
Note that I'm using a cube camera and increasing the render target size doesn't help. The issue can be disguised by increasing roughness, but disabling the disc altogether and using a directional light for physical reflections works a lot better.