Jump to content

[solved] "Animating" Post Processes


jools_n_jops
 Share

Recommended Posts

Hiya all.

Just joined up here- seems like a fantastic community, great stuff. Learning a lot from you guys.

 In this previous Q&A (thanks guys) there was a discussion about adjusting a "fade" post process after its creation, via scene.registerBeforeRender(function(){});

Here's the afore mentioned code snippet for where the post process gets created. 

var fadeLevel = 1;
var postProcess_fade = new BABYLON.PostProcess("Fade", "fade", ["fadeLevel"], null, 1.0, camera);
postProcess_fade.onApply = (effect) => 
	{
		effect.setFloat("fadeLevel", fadeLevel);
	};	

Lets say I wanted to do the same on other post processes such as a horizontal Blur (increasing blur on a certain event for example). I sorta tried doing a similar thing....

var kernel=50;
var postProcess_Blur = new BABYLON.BlurPostProcess("Horizontal blur",new BABYLON.Vector2(1.0,0.0), ["kernel"], 1, camera);
postProcess_Blur.onApply = (effect) => 
	{
		effect.setFloat("kernel", kernel);
	};

...the scene / canvas all initialises ok, but it's drawing a black frame. Not sure if its because of some difference with the blur post process in particular? https://doc.babylonjs.com/classes/3.0/blurpostprocess says the parameter name is "kernel". 

 

Thanks v much for any insights or assistance.

*edit: link to playground https://www.babylonjs-playground.com/#K9NTY4#6 

*edit: solved https://www.babylonjs-playground.com/#K9NTY4#7

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...