Jump to content

setFloat of PostProcess effect in a PG with 2 scenes


royibernthal
 Share

Recommended Posts

Me and Andy (@Pryme8) have been trying to get a very plain post process to work in the back scene of a PG that has 2 scenes:

http://www.babylonjs-playground.com/#BLNIDI#19

It seems line 50 results in a webgl error when the value of time is set to anything other than 0, in any sort of render loop / timeout / interval.

It works fine when it's set to any float value if it's defined right after creating the PostProcess instance (possibly because it's before the scenes are rendered?)

uwPass.getEffect().setFloat('time', time);

The error can only be noticed when loading the PG:

Quote

WebGL: INVALID_OPERATION: uniform1f: location not for current program

I suppose that's because of:

Quote

WebGL: too many errors, no more errors will be reported to the console for this context.

I'm stating the obvious, but that means that error won't be logged when modifying the PG and running, you'll need to save it and reload the page.

 

When scene's camera is passed to the post process instead of backScene's camera, the error is not thrown:

http://www.babylonjs-playground.com/#BLNIDI#20

Link to comment
Share on other sites

Here is the fix:

http://www.babylonjs-playground.com/#BLNIDI#34

 

First I fixed the shader which was using texture instead of texture2D (which is required when running on non webgl2 devices)

Then I added line #43 which is where you are supposed to communicate with the effect. Everywhere else, there is no guarantee that the effect is connected or ready

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...