0beqz / realism-effects

SSGI, Motion Blur, TRAA - Effects to enhance your three.js scene's realism
https://realism-effects-obeqz.vercel.app/
MIT License
1.43k stars 67 forks source link

Reduce trailing effect for a larger scene #11

Open SudevKiyadaTR opened 1 year ago

SudevKiyadaTR commented 1 year ago

Although, am not using any environment map for the scene, I quite love the way SSGI lifts up the scene. Is there a way to avoid the trailing effect at longer distance?

Am using this settings as option

options = {
  "distance": 1.5,
  "thickness": 20,
  "autoThickness": false,
  "maxRoughness": 1,
  "blend": 0.95,
  "denoiseIterations": 1,
  "denoiseKernel": 3,
  "denoiseDiffuse": 20,
  "denoiseSpecular": 0,
  "depthPhi": 14.022,
  "normalPhi": 0,
  "roughnessPhi": 0,
  "envBlur": 0.55,
  "importanceSampling": true,
  "directLightMultiplier": 1,
  "maxEnvLuminance": 50,
  "steps": 8,
  "refineSteps": 1,
  "spp": 3,
  "resolutionScale": 2,
  "missedRays": false
};

https://user-images.githubusercontent.com/111417465/226257265-01a9946b-892d-4545-86eb-d042c89f2477.mp4

Screenshot 2023-03-20 at 11 17 24 AM
0beqz commented 1 year ago

This seems to be an issue with the depthDistance and worldDistance being too low in the temporal reprojection pass (they are defined here: https://github.com/0beqz/realism-effects/blob/main/src/temporal-reproject/TemporalReprojectPass.js#L17). I think at that distance there are issues with precision so that the temporal reprojection pass constantly sees disocclusions there (due to a too high depth/distance difference between the current pixel and the reprojected pixel) which causes that flickering.

You can try to set depthDistance and worldDistance to higher values when passing the options when creating the SSGIEffect object. I'll look into it, maybe I can make distance play a role to account for the precision loss at higher distances.