Problem with Motion Blur and prepass implementation in PBR

Hi folks!

It looks like the PBR material has, at least 5.0.0-beta.4, a problem with prepass integration and velocity buffer.

In this playground ( the motion blur post-process works well with PBR and cloned meshes. Once we add instances, the shader throws an error:

VERTEX SHADER ERROR: 'previousWorld' : undeclared identifier

Using Standard Material, everything works well. My intuition is that PBR is missing some #ifdef or has too much but I prefer to let PBR masters confirm that @sebavan :slight_smile:

Playground with PBR and instances (that fails):
Playground with STD and instances (that works):

PBR is life, thanks for your help!

This PR will fix the problem:

1 Like

You are awesome, I’ll tag you as PBR master as well :slight_smile:
Thanks a lot!

1 Like

He is the true master now !!!

1 Like

Hey @Evgeni_Popov !

I just tested and it appears the fix you have shared is not enough :frowning:

The error still appears in 5.0.0-beta.6 and it looks like the PR has been merge before beta.6:

react_devtools_backend.js:4061 BJS - [13:44:10]: Offending line [334] in vertex code: vPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);
react_devtools_backend.js:4061 BJS - [13:44:10]: Error: VERTEX SHADER ERROR: 0:334: 'previousWorld' : undeclared identifier

The playgrounds I shared are still valid as repro case.
Sorry for the inconvenience !

Thanks, it seems the bug was also in other locations (I don’t know how I missed that the first time…):


You rox !! <3