Procedurally generate a curved normals in shader?

Hi. Does someone know how I can generate curved normals on the plane using shader logic?

I don’t want to use any normal map, I want to generate normals using for example texcoord node or something else.

To get normals simlar to a sphere for example…

Then I want to transform it to world space and use it with dot product to get a fake reflection like this…

https://i.imgur.com/1ulgzvh.png

But I can’t figure it with my self. Linear gradient doesn’t give the right thing and I can’t figure how I should distort it to get right normals…

I’ve found this…

And after some study I’ve managed to shrink it to this:

And it looks like this:

216638-shot-171014-101607.png

Still not sure how I should manage the curvature of the normal O__o

Other words how I should do this?

Any ideas?

Oh my god! Where was my head before?..
I can just do it like this:

The question: “how I suppose to control the curveness of the sphere?” - is still open.

So here is the solution I made at the end:

Using Parameters in Curvature Adjustments section you can change the curvature of the normal, for example make it look inwards…
Here some results made using this shader:

Pay attention that if you have a circular shape with a propper UV’s then you can get rid from “remove unwanted” section and save some instructions. Also linear radial gradient calculated using distance node can be used instead, but personally I like it more without the sqrt (Commented as Radial Gradient Mask).

Good luck…

1 Like