Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Performance on Drawing Lightened Scene  (Read 8655 times)

0 Members and 1 Guest are viewing this topic.

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: Performance on Drawing Lightened Scene
« Reply #15 on: May 25, 2016, 05:48:30 pm »
Ok, makes sense :) But to be honest, I'm unsure how I could optimize the algorithmic approach.. maybe using some additional culling to determine which edges are really hit by a light's ray... 8)
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Performance on Drawing Lightened Scene
« Reply #16 on: May 25, 2016, 10:03:53 pm »
Where is that extra 0.1% of time coming from? (They keep adding up to 100.1%)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: Performance on Drawing Lightened Scene
« Reply #17 on: May 27, 2016, 08:13:12 am »
Where is that extra 0.1% of time coming from? (They keep adding up to 100.1%)
I guess its up to some rounding issue.

I reran the profiling analysis for few edges and many lights:
(click to show/hide)
Does this mean that there is no bottleneck in this case?
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Performance on Drawing Lightened Scene
« Reply #18 on: May 27, 2016, 05:11:54 pm »
Well think about it. Do you need to call prepareLight or getFarPoint 7200 times per (not sure how long that was sampled over)?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: AW: Performance on Drawing Lightened Scene
« Reply #19 on: May 27, 2016, 05:20:33 pm »
Well think about it. Do you need to call prepareLight or getFarPoint 7200 times per (not sure how long that was sampled over)?
prepareLight() is called twice per light per frame (could be reduced to once maybe). But calling it once is minimum because I don't want to have one sprite per light.. it's unnecessary from my point of view.
getFarPoint() is called once each pair of lights and edges, because each light could hit each edge. As mentioned: num_lights x num_edges is just an upper bound and not necessary in each case. I think that's the best way to go for me atm.
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Performance on Drawing Lightened Scene
« Reply #20 on: May 27, 2016, 05:40:40 pm »
Yes, if not already done, you should use space partitionning to limit useless computations (edges not in range of lights, for example).
Laurent Gomila - SFML developer

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: Performance on Drawing Lightened Scene
« Reply #21 on: May 27, 2016, 05:44:22 pm »
Yes, if not already done, you should use space partitionning to limit useless computations (edges not in range of lights, for example).
Thx, but this is already done :) Except not culling edges that are hidden by other edges but still visible in the scene.

But anyway: My problem also occures if I have lots of lights and few edges .. extreme case: 50 lights and 1 edge (assuming space partitioning is already applied). Then getFarPoint() will be called 50x (like 1 Light and 50 Edges which runs perfectly fine). The profiler tells me nothing (see spoiler above).
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

 

anything