Jump to content

PostProcess on specific mesh


Recommended Posts

  • 4 months later...

I played with alpha but I didn't find a convenient solution.

I have many materials whish are dynamic, that means I have no backup of their material.


I tried to play with fog, I fog all the scene and try to set fogEnabled to false for mesh that I want to see, but that don't work too.


Is it possible to set a material temporarily ?


Imagine, you have a virtual smartphone and you want to take a picture of an object wish is very closest, so the phone's camera focus on object, this object is clear and all the rest of the scene is blured, do you have an idea to do similar effect with babylonjs ?

Link to comment
Share on other sites

A solution to this could be:

  1. first, render the scene using a special shader that will make the focused object completely white, and the rest of the scene completely black (this used to be called a stencil buffer but I'm not sure this has a meaning nowadays); store this in a frame buffer object
  2. then, render the scene again with the post process of your choice, and use the first frame buffer as an input; as you apply the post process, check for the provided frame buffer if its corresponding pixel is white or black: this will tell you if you're currently postprocessing your focused object or not

This technique is for example used to render blurred halos around silhouettes (think Left4dead). You'll have to tinker a bit with the engine though :)

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.

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.


  • Recently Browsing   0 members

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