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

Trailing effect when rotating camera #6

Open
vis-prime opened this issue Mar 8, 2023 · 8 comments
Open

Trailing effect when rotating camera #6

vis-prime opened this issue Mar 8, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@vis-prime
Copy link

continuing this thread from twitter https://twitter.com/vis_prime/status/1632602124269023233?s=20

I'm noticing trails being formed which does not happen on the demo page

2023-03-08.16-02-07.mp4
@vis-prime
Copy link
Author

vis-prime commented Mar 8, 2023

Ok found the exact reason !

in the render loop camera.updateMatrixWorld() needs to be called, no more trails now

2023-03-08.16-12-05.mp4

the result is quite noisy & shadows are blocky , what could be the reason for that ?

demo : https://vis-prime.github.io/explore-vanilla-drei/?scene=RealismEffects
code : https://github.com/vis-prime/explore-vanilla-drei/blob/main/demos/realismEffectsDemo.js

@0beqz
Copy link
Owner

0beqz commented Mar 8, 2023

Do you get similar results when drag and dropping that model into the demo scene?
Otherwise increase the denoiser's aggressivity by increasing denoiseIterations, denoiseSpecular and denoiseDiffuse.
Maybe it could also be an issue with the temporal reprojection pass, what happens if you increase the blend factor of it to a higher value like 0.95?

Also, calling updateMatrixWorld() on the camera should only be done if you have matrixAutoUpdate disabled in your scene like it is the case in the demo scene - is it also disabled in your scene, as I'm wondering if the trailing only happens if you don't call updateMatrixWorld?

@vis-prime
Copy link
Author

on the drag and drop page i don't get the same artifacts

2023-03-09.22-20-55.mp4

So just to break down everything
here are all the special steps I took compared to a generic project

Renderer init

 renderer = new WebGLRenderer({
    powerPreference: "high-performance",
    premultipliedAlpha: false,
    stencil: false,
    antialias: false,
    alpha: false,
    preserveDrawingBuffer: true,
  })
  renderer.setPixelRatio(Math.min(1.5, window.devicePixelRatio))
  renderer.setSize(window.innerWidth, window.innerHeight)
  renderer.outputEncoding = sRGBEncoding
  renderer.toneMapping = ACESFilmicToneMapping
  renderer.autoClear = false

Postprocessing stack
first pass: velocityDepthNormalPass
second pass: SSGI/SSR/SSGDI ,TRAA ,motionBlur

If GI is off I use a renderPass so traa and motionblur can run independently
(also console.log prints composer.passes any time you change an option)

Exr loader
const exrLoader = new EXRLoader().setDataType(FloatType)

render loop
camera.updateMatrixWorld()

Anything obvious i've missed ?
I also haven't done the offscreen canvas thing
and did not add any matrixAutoUpdate false anywhere

demo same as before

screenshots
SSGI
ssgi
SSGDI
ssdgi
SSR
ssr

@0beqz
Copy link
Owner

0beqz commented Mar 14, 2023

Interesting, I'll check your demo when I have time. Do you get different results when not using TRAA and motion blur?

I'm also wondering if the device pixel ratio could play a role as you get some odd pattering in the images.

@vis-prime
Copy link
Author

vis-prime commented Mar 14, 2023

Screen goes black or frame freezes when i use SSGI with TRAA or motion blur, something definitely went wrong

i'll re-do the setup and use your example code as starting point , I'll report back with the findings

  • update
    looks good so far , demo

ss

does anything feel off ?

@vis-prime
Copy link
Author

vis-prime commented Mar 16, 2023

Update

Things i noticed are
camera.updateMatrixWorld is required on every frame to prevent the trails

  • The GI pass has to be on it's own effectPass without the other realism effects

  • motionblur or traa can be merged on another effectPass

  • other effects like bloom etc can be merged with either of theses effectPasses

I removed the scaling logic (since the model is built to scale) and i'm getting this random tearing effect

Using v1.0.14
demo
code

2023-03-16.23-01-34.mp4

@0beqz
Copy link
Owner

0beqz commented Mar 20, 2023

Thanks. So I've added camera.updateMatrixWorld() to the velocity pass so that shouldn't be an issue anymore. The problem was, that without using a RenderPass, the camera's matrix world would still be outdated when rendering the velocity in the velocity pass causing that trailing.
I recently added in the readme that without using a RenderPass, SSGI has to be in its own effect since that caused some confusion.

I'll try to look into that horizontal tearing, not too sure what could be causing that..

@0beqz 0beqz added the bug Something isn't working label Mar 20, 2023
@vis-prime
Copy link
Author

updated to latest

camera.updateMatrixWorld() no longer required

the random tearing issue still exists (only clue is that once I removed the scaling logic the models became very small compared to before)

this issue can be closed then , I'll make new one for the other issue I found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants