- Home /
Create Material with gradient on a sphere?
Hi,
what would be the best way to create a material for a sphere which gives me a gradient effect like the one in the picture?
Thanks in advance :)
Answer by Brad_Schneider · Oct 12, 2018 at 06:58 AM
If I understand correctly, you want your sphere in-game to look like that circle gradient in the picture. If that is the case, you're going to require a custom shader as it can't be done with just a texture/material.
Sadly I'm not a shaders guy, so I can't help with any of the specifics of how to go about this. Google provides some decent starting points though, such as this radial gradient shader. However, you'd have to adapt that from working with circles to working with a sphere which I don't think will be that simple.
Ok thanks a lot! I will look into that.
I just tried a few things with the standard shader in transparent mode and actually got a quite good result with which I could use if I can't figure it out. :)
Answer by Bunny83 · Oct 12, 2018 at 09:04 AM
What you're looking for is essentially a simplified version of the specular highlight. In this case we only care about the direction that connects the sphere center with the camera position. Since the sphere has smooth 360° normal vectors, the normals give you all you need. When the normal is pointing along the vector from the sphere center to the camera the fragment will be the brightest. If the normal is perpendicular or even facing away from the camera the fragment will be black (or transparent). The result will be somewhat similar to have a single quad with a texture like you've show that is billboarding towards the camera.
Your answer
Follow this Question
Related Questions
sphere texture problem 0 Answers
Textured model issue in Unity 3.5 -1 Answers
Projecting a plane onto a sphere 2 Answers
Hololens 4K 360 Video Possible? 0 Answers
Gradient transparency results in full opacity for half of the gradient 1 Answer