3Dlove Posted September 16, 2015 Share Posted September 16, 2015 Hello guys Is it possible to apply a postprocess on one mesh only and not on all the view of the camera ? I would like make a mode where all the scene is in black and white except one mesh Have a nice day Quote Link to comment Share on other sites More sharing options...
Temechon Posted September 16, 2015 Share Posted September 16, 2015 Hello, I don't think this is possible, as a postprocess is attached to the camera... But i'm not a postprocess professional :/ Quote Link to comment Share on other sites More sharing options...
3Dlove Posted September 16, 2015 Author Share Posted September 16, 2015 Okay, and is it possible to do that by another way ? ^^ Quote Link to comment Share on other sites More sharing options...
jerome Posted September 16, 2015 Share Posted September 16, 2015 I think postprocesses are just 2D here, so the whole canvas Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 16, 2015 Share Posted September 16, 2015 You could make a post process, which looks at the alpha of a fragment. If Alpha === .5 set alpha to 1.0else{ change to black & white} Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 16, 2015 Share Posted September 16, 2015 or you can just play with materials: creating a black and white material that you apply to all meshes but the one you want to highlight Quote Link to comment Share on other sites More sharing options...
3Dlove Posted January 26, 2016 Author Share Posted January 26, 2016 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 ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 26, 2016 Share Posted January 26, 2016 Material can be temporary because it is easy to switch them with mesh.material =.... To change the focus it could be fun to use this postprocess: http://www.babylonjs.com/Demos/DOF/ Quote Link to comment Share on other sites More sharing options...
jahow Posted January 26, 2016 Share Posted January 26, 2016 A solution to this could be: 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 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.