Jump to content

Need help to create good 2d fake light


GBear
 Share

Recommended Posts

hi everybody..

could you give me tips to create fake light?

i draw fake light like following image with blendMode..(i don't use shader here because it's slow on mobile).
light_64.png

it will be drawn on maps..

i wanna add good simple animation like intensity of light or  glittering 
 

i need good formula or function to draw good..


thx..

 

 

Link to comment
Share on other sites

i set 'sine wave spectrum' first

 

var value = (Math.sin(this.frequency) + center)/(center+1)/this.amplitude + noise;

 

 

if center is 0
this formula range have -1 ~ 1

if center is 1
this formula range have 0 ~ 1

if center is 2
this formula range have 0.3 ~ 1

if center is 3
this formula range have 0.4 ~ 1

and frequency is like velocity; you can control speed

noise is noise 

noise = (Math.random()+Math.random()-1)/10;


it's looks better.. but not perfect..

i will do more.. 


thx.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...