0beqz/screen-space-reflections

request: allow ssr for selected meshes

Closed this issue · 11 comments

similar to outlines and bloom in postprocessing: https://github.com/pmndrs/postprocessing/blob/main/src/core/Selection.js this could allow us to mix and match, place it on certain regions and perhaps achieve a cleaner look while improving performance? in sketchfab they have something similar where ssr is usually being using on metallic surfaces.

0beqz commented

I can definitely add that. Selective reflections will definitely improve performance. So these selected objects shouldn't reflect anything but can still be reflections or should they be excluded entirely so that they don't reflect anything and also will never be visible regarding reflections. I could add both options.

from how outlines work, the selected meshes will have the effect: https://codesandbox.io/s/selective-outlines-d36mw

that component abstracts EffectPass.selection. so if i had a car and i want only the bumper to receive reflections, i'd select it, everything else remains untouched.

0beqz commented

Ah I see, I'll check how it's done in postprocessing.js and will implement it similar to it

err
err1

i'm guessing this would solve the problem i'm getting immediately when composer is turned on ?

+1 for this, it'll improve performance greatly on large scene.

0beqz commented

err err1

i'm guessing this would solve the problem i'm getting immediately when composer is turned on ?

That shouldn't happen in the first place, I'm not sure what's causing that. Can you tell me from which line in the SSRPass (or better from ReflectionPass) this error is coming from?

@0beqz there's no error in the reflection , SSR and Render pass it's just the line which calls the render function which it last went went through before the error but this error only comes when using SSR + pmndrs composer

can you try adding a transform controls in the scene and try ?

i tried on 1.0.8 and three js 142 same error

SSR initialized like this (other passes like bloom ssao brightness cont works fine)

  const ssrEffect = new SSRPass(scene, camera);
  composer.addPass(ssrEffect)
0beqz commented

@0beqz there's no error in the reflection , SSR and Render pass it's just the line which calls the render function which it last went went through before the error but this error only comes when using SSR + pmndrs composer

can you try adding a transform controls in the scene and try ?

i tried on 1.0.8 and three js 142 same error

SSR initialized like this (other passes like bloom ssao brightness cont works fine)

  const ssrEffect = new SSRPass(scene, camera);
  composer.addPass(ssrEffect)

Alright, so the transform controls seem to be causing that, I'll try to check what could be the issue behind that.

no-tcon
tcon added

Checked on an barebones scene to better isolate the issue (was using scissor test and other stuff before and just wanted to confirm ), and can confirm , just adding transformcontrols into the scene will result in this error

Should I make a new issue?

0beqz commented

Alright sure, make a new issue. I'm wondering in which line from ReflectionsPass this error emerges from.
Could you test if you are also getting this error in the example scene of this repository? I wasn't able to replicate that error when I used TransformControls in that scene - so adding it to the scene didn't seem to cause any issues there.

0beqz commented

You can now use the SSREffect's selection property to set which meshes should reflect. Leaving it empty will make all meshes reflect.