I am trying to get a 2d effect of a shiny ball. However, I need the ball to be able to roll (not fixed angle on Rigidbody2D). I cannot simply have a texture like this one:
Because when the ball rolls, obviously the light shiny patch will roll around aswell, which would not happen.
I have tried using lights but have not had success in creating the same effect.
Does anyone know how I can achieve this?
Also, I want to be able to add a shop where you can buy new balls, some have alpha in their sprites. So I can’t just have a faded out sprite of the shiny part following the ball unless it is only rendered on non alpha parts (don’t know if that made any sense…)
Any help is greatly appreciated, thanks!
Take a look at this video
Its about Material
this one is about 2d Texture
I’m newbie here, but i think if you can apply a metallic texture into your 2d ball the light will reflect properly.
I think what Masterio Said can work but if you have more than one source of light it will not be cool since the ball will not “react” to the lights.
Good luck. Sorry for my english.
Add a child object to your 2D ball. On the child object add a “Point” light component. You will need to play with the “Range” and “Intensity” settings to get the effect that you are looking for. Good luck!
Edit: It is important to set the child object Z value for the light to a negative value. This you also need to play around with to get the desired effect. But unfortunately this does not work for a black ball as you have in your example so creating a shine layer as a child object like others have mentioned is most likely the way to go.
I would try to separate the shine from the object. I would treat it as another image component and add it to the ball. Making the ball to have two images components, one with the base colour (in your example, black) and on top, another image that will be the shine.
This way you can treat the base colour and the shine as two different colours and with a bit of code, I guess that it might be possible to make the shine follow a light source.
you mean you wanna roll a 2D ball object without roll it’s sprite ?? you can freeze rotation it’s Z asix, or set rotation Z asix = 0 in Update()
I dont really do 2D but I came across this little tut on Pixel Lighting.
You can create a depth or spec map and rotate that on its own leaving the texture sprite unrotated. This should give the impression of the ball moving. Think of little specs of light and shadow from little pits in the surface of the ball.
This means you can leave your original texture alone if you want the shine to stay put.