Opened 12 years ago

Last modified 15 months ago

#1560 new defect

Actors should be revealed gradually in LOS

Reported by: historic_bruno Owned by:
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords: sod fow los
Cc: Krinkle Patch: Phab:D3077, Phab:D3083

Description (last modified by Krinkle)

This is very noticeable on the Punjab 3 map, if you send some units scouting around the base, they will appear to walk toward open ground but suddenly grass will pop out of nowhere. It seems that LOS is only checking the center of the actors for visibility, when it should be if any part of the model would be visible (can be approximated as a rectangle / bounding box)

http://i.imgur.com/a1OTt.jpg

Change History (10)

comment:1 by historic_bruno, 12 years ago

Summary: Actors should smoothly appear in LOSActors should be revealed gradually in LOS

comment:2 by myconid, 12 years ago

I added 3 lines at :620 in simulation2/CCmpVisualActor.cpp. If uncommented, they solve the problem you are describing.

But, there's a catch.

This forces the engine to draw models that are hidden in the unexplored areas of the map. This is actually not an unreasonable thing to do.

Currently, by not drawing those models because they are hidden from LOS, the game is fast at the beginning, but becomes gradually slower as it progresses and the map is explored.

Either way, the end result is similar: the game is only as fast as the user's hardware can run it.

For our part, there are three things we can do:

  • Find a way to draw only objects that are at near visible LOS, but not necessarily in it. The distance may be hardcoded, or it may depend on the sun position.
  • Give the player the option to disable LOS-based model culling through the config.
  • Disable LOS-based model culling altogether, as it's unnecessary.

I like the second option.

in reply to:  2 comment:3 by historic_bruno, 12 years ago

Replying to myconid:

For our part, there are three things we can do:

  • Find a way to draw only objects that are at near visible LOS, but not necessarily in it. The distance may be hardcoded, or it may depend on the sun position.

Why would it depend on sun position, for shadows?

I was actually thinking of a fourth option, using a smart "culling" (or I guess technically hiding) technique, aren't there efficient ways of storing 2D/3D bounding boxes to determine what should be rendered or not? :)

As for the performance savings of LOS "hiding", I think it's going to be negligible as you hinted, because consider that we will have proxy entities for fog-of-war-hidden entities (#599) so they must be rendered, and many actors like gaia objects are always visible in fog of war. Clearly if the player does any level of exploration at all, LOS will not save much rendering time other than on hidden enemy units, but it seems to me if there are large numbers of enemy units on screen, they will be visible to the player soon enough?

Really I feel that the current behavior is buggy and performance aside, needs to be corrected: imagine approaching a large enemy structure and despite it's edge being in LOS and it being able to see your units, you are unable to see it because the center of the structure is not in LOS and therefor not rendered. That could be the difference between walking right into a trap and scouting it out, and that's when a graphics problem becomes a gameplay problem.

comment:4 by myconid, 12 years ago

If the sun is too low, you get long shadows. As models pop into existence so do their shadows, and a long shadow isn't just at the edge of the LOS, it can go all the way across the screen! If we want to do the LOS culling, we need to take into account how long the shadows are, to decide which models to draw, even if they aren't visible.

A second, related issue exists with main view/shadowmap camera culling. Set the sun to a low position and move the camera around. You'll notice that as models move out of the screen, their shadows disappear, only to pop back into existence when the model is moved back in.

Incidentally, I've thought of one advantage of having LOS culling: if we draw models even if they are completely hidden by LOS (i.e. black), a smart player could cheat by moving his camera around and looking at the framerate. As he passes over the opponent's base, he'll see a drop in framerate, even if he can't actually see it. Maybe the proxy buildings (in combination for a fix for the second problem above) can help with this.

in reply to:  4 comment:5 by fabio, 12 years ago

Replying to myconid:

A second, related issue exists with main view/shadowmap camera culling. Set the sun to a low position and move the camera around. You'll notice that as models move out of the screen, their shadows disappear, only to pop back into existence when the model is moved back in.

#579 is a similar issue.

comment:6 by Krinkle, 5 years ago

Cc: Krinkle added
Description: modified (diff)

comment:7 by wraitii, 3 years ago

Keywords: los added
Milestone: BacklogAlpha 25
Patch: Phab:D3077, Phab:D3083
Priority: Nice to HaveShould Have

#5606 was a duplicate of this. Bumping back to A25, this needs more attention at least for structures and such IMO.

comment:8 by wraitii, 3 years ago

Milestone: Alpha 25Alpha 26

Remains one of the bigger graphical woes in-game.

comment:9 by Freagarach, 2 years ago

Milestone: Alpha 26Alpha 27

comment:10 by Freagarach, 15 months ago

Milestone: Alpha 27Backlog

Pushing back.

Note: See TracTickets for help on using tickets.