Light bending effect?

Can you bend the light around specific object? (Camera effect) like a back hole:

§

Sure, with a shader:

https://www.shadertoy.com/view/ldy3zK

You need to send the position of the object you want to bend around as a uniform.

3 Likes

How demanding is it on a mobile phone?

That is totally dependent on the phone hardware, and how much calculations you perform in the shader. In general, if you do a bunch of arithmetics with no branches (if:s) you should be fine.

1 Like

We have a tutorial on adapting shadertoy shaders: https://www.defold.com/tutorials/shadertoy/

And I have an example as well: https://github.com/britzl/publicexamples/tree/master/examples/radial_blur

2 Likes

Is there any possibility that you could prepare a tutorial for beginners about effect of radial blur in your project? Just to have basic understanding about what is done there. It looks great, and I’m thinking about creating an effect of sunlight beams going through the bushes or trees - it would look awesome :wink: