smatt Posted July 28, 2016 Share Posted July 28, 2016 Hello, I'd like to add water drops on the camera lens as an effect. How can it be done? Moving drops would be nice, but static is more than enough This screenshot should explain my goal RiptideGP: http://prnt.sc/byopvq Thanks for every answer, Simon Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 28, 2016 Share Posted July 28, 2016 You would need 2 cameras, a scene camera, & a drops camera which was ortho. Quote Link to comment Share on other sites More sharing options...
smatt Posted July 28, 2016 Author Share Posted July 28, 2016 14 minutes ago, JCPalmer said: You would need 2 cameras, a scene camera, & a drops camera which was ortho. Why is there a need for a second camera? Couldn't be the drops on the default "FreeCamera"? Is it possible to put a bump mapping in front of the camera with zero alpha and PBR? (I'm pretty new to Babylon.JS ) Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted July 28, 2016 Share Posted July 28, 2016 Yes, a post process could be used, but you are going need to write a fragment shader. Quote Link to comment Share on other sites More sharing options...
smatt Posted July 28, 2016 Author Share Posted July 28, 2016 48 minutes ago, JCPalmer said: Yes, a post process could be used, but you are going need to write a fragment shader. Has somebody already done this for Babylon.JS or know good resources for writing your own fragment shader? Quote Link to comment Share on other sites More sharing options...
Nabroski Posted July 28, 2016 Share Posted July 28, 2016 Hey man, you already answered your question take a plane an place it like a filter of a real world camera before your lens, then you can do anything you want with it, sprites, animate wrap UV, its cheap, quick and fast. 8 vertices, 1 texure, 2 lines of code. smatt 1 Quote Link to comment Share on other sites More sharing options...
smatt Posted July 28, 2016 Author Share Posted July 28, 2016 Thanks @Nabroski! Maybe I can get this to work Quote Link to comment Share on other sites More sharing options...
smatt Posted July 28, 2016 Author Share Posted July 28, 2016 Did it! It is actually much easier than I thought. Just add following line: var postProcess = new BABYLON.RefractionPostProcess("Refraction", "textures/normalMap.jpg", new BABYLON.Color3(1.0, 1.0, 1.0), 0.5, 0.5, 1.0, camera); Result is here: http://babylonjs-playground.com/#FCRJG I got this line from: http://www.babylonjs.com/Demos/PPRef/ Nabroski, jerome, adam and 1 other 4 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted July 28, 2016 Share Posted July 28, 2016 Gute Arbeit! smatt 1 Quote Link to comment Share on other sites More sharing options...
smatt Posted July 29, 2016 Author Share Posted July 29, 2016 Totally forgot to post a real rain example in here: GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted July 29, 2016 Share Posted July 29, 2016 you could simulate this with animated sprites smatt 1 Quote Link to comment Share on other sites More sharing options...
smatt Posted July 29, 2016 Author Share Posted July 29, 2016 @Pryme8 I'm going to implement this Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted July 29, 2016 Share Posted July 29, 2016 This polycount post could be interesting http://polycount.com/discussion/155940/animating-normal-maps-to-achieve-rain-drops-in-3ds-max-or-unity3d smatt 1 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.