Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issue #53

Open
Makrophago opened this issue Oct 21, 2019 · 1 comment
Open

Performance issue #53

Makrophago opened this issue Oct 21, 2019 · 1 comment

Comments

@Makrophago
Copy link

I tried to make a neon effect for platforms that are supposed to move. For that, I chained three effects and tested a basic motion. Code is bellow. When I run my test, the motion is slow and not smooth. Maybe I do something wrong...

moonshine = require('moonshine')

function love.load()
  y = 0

  blueNeon = moonshine(moonshine.effects.glow).chain(moonshine.effects.fastgaussianblur).chain(moonshine.effects.godsray)
  blueNeon.godsray.exposure = 0.2 --number between 0 and 1
  blueNeon.godsray.decay = 0.8 -- number between 0 and 1
  blueNeon.godsray.density = 0.05 -- number between 0 and 1
  blueNeon.godsray.weight = 0.9 -- number between 0 and 1
  blueNeon.godsray.light_x = 0.5 -- number
  blueNeon.godsray.light_y = 0.5 -- number
  blueNeon.godsray.samples = 30 -- number >= 1
  blueNeon.glow.min_luma = 0
  blueNeon.glow.strength = 5

  yellowNeon = moonshine(moonshine.effects.glow).chain(moonshine.effects.fastgaussianblur).chain(moonshine.effects.godsray)
  yellowNeon.godsray.exposure = 0.2 --number between 0 and 1
  yellowNeon.godsray.decay = 0.8 -- number between 0 and 1
  yellowNeon.godsray.density = 0.05 -- number between 0 and 1
  yellowNeon.godsray.weight = 0.9 -- number between 0 and 1
  yellowNeon.godsray.light_x = 0.5 -- number
  yellowNeon.godsray.light_y = 0.5 -- number
  yellowNeon.godsray.samples = 30 -- number >= 1
  yellowNeon.glow.min_luma = 0
  yellowNeon.glow.strength = 5
  yellowNeon.fastgaussianblur.taps = 9
end

function love.update(dt)
  y = y+50*dt
end

function love.draw()
  blueNeon(function()
    love.graphics.setColor(0.17, 0.46, 1)
      love.graphics.rectangle("fill", 300, y, 100, 3, 5, 5, 20)
    love.graphics.setColor(0, 0, 0)
  end)

  yellowNeon(function()
    love.graphics.setColor(1, 1, 0.05)
      love.graphics.rectangle("fill", 300, y+8, 100, 2, 5, 5, 20)
    love.graphics.setColor(0, 0, 0)
  end)

end
@gustavostuff
Copy link

gustavostuff commented May 2, 2020

Try using a lower resolution with for:
blueNeon = moonshine(moonshine.effects.glow).chain(moonshine.effects.fastgaussianblur).chain(moonshine.effects.godsray)
and
yellowNeon = moonshine(moonshine.effects.glow).chain(moonshine.effects.fastgaussianblur).chain(moonshine.effects.godsray)

I had performance issues and they were gone when I used my game internal resolution (384x216)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants