hit2501 Posted April 27, 2017 Share Posted April 27, 2017 Hi, I'm using: var lensEffect = new BABYLON.LensRenderingPipeline('lens', { distortion: 0.5 }, scene, 1.0, camera); scene.registerBeforeRender(function() { lensEffect.setEdgeDistortion(some_value); }); To distort the view dinamically but this only gives me a convex view, I tried to use negative values in "distortion" to get a concave view but didnt work. How can achieve it? Thank you all. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 27, 2017 Share Posted April 27, 2017 Hey this is expected: https://github.com/BabylonJS/Babylon.js/blob/dea49de07ac07a2bf7896aaa0e13c26e0f674c9e/src/Shaders/depthOfField.fragment.fx#L62 The distorsion is clamped between 0 and 1 Quote Link to comment Share on other sites More sharing options...
hit2501 Posted April 27, 2017 Author Share Posted April 27, 2017 Thank you Deltakosh, I saw that your sample is in c (or c++), but I must ask you to be incredibly patient because I'm an incredible noob learning to handle webgl but through Babylon. I dont know how to apply your sample because I dont know C (or C++), its a shame I know Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 28, 2017 Share Posted April 28, 2017 it is not C (or C++) but a shader. Written in GLSL which looks like C (but for GPU). There is no problem if you don't know how to change it What I tried to mention in my previous response was exactly this point: It is NOT easy to change Quote Link to comment Share on other sites More sharing options...
hit2501 Posted April 28, 2017 Author Share Posted April 28, 2017 Understood, in that case, can you suggest me other possible action to get a similar concavity effect? Thanks again DK. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 28, 2017 Share Posted April 28, 2017 Can you provide me an image or various images that showcase what you want to achieve? Quote Link to comment Share on other sites More sharing options...
hit2501 Posted April 29, 2017 Author Share Posted April 29, 2017 Yes, in the first one you can see the view without distortion, the second shows the convex distortion and the third one shows the effect (red lines) of what Im looking for but dont work: Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 30, 2017 Share Posted April 30, 2017 So you can try to compile your own version of babylon.js with the updated shader Just change this line: https://github.com/BabylonJS/Babylon.js/blob/dea49de07ac07a2bf7896aaa0e13c26e0f674c9e/src/Shaders/depthOfField.fragment.fx#L62 to this: float dist_amount = clamp(distortion*0.23, -1.0, 1.0); 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.