2020-02-24 18:53 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0005214Spring engineLuapublic2017-09-24 19:12
Assigned ToKloot 
Product Version101.0 
Target VersionFixed in Version103.0 +git 
Summary0005214: New lua event callin to support fog widgets / gadgets
DescriptionThe dualfog gadget in the blueprint map draws its fog during the DrawWorld callin. This makes the fog obscure particles and CEGs that are in front of the fog.

Moving the fog drawing to an earlier call-in such as DrawWorldPreUnit causes the fog to fail to obscure units and features that lie within the fog.

I believe the right time to draw fog is after opaque projectiles have been drawn but immediately prior to drawing alpha particles, which appears to take place in ProjectileDrawer.cpp within CProjectileDrawer::Draw. If you could add a lua event callin at that point, we could update the dualfog gadget (and similar widgets and gadgets) to draw the fog using that callin, which would make for a much-improved appearance to maps which use fog such as Seth's Ravine and Siberian Divide.
Steps To Reproducea) Start a game on Siberian Divide, Map-Blueprint, or other map which uses the dualfog gadget.

b) Generate a CEG somewhere outside of the fog (for example, build a fusion plant and blow it up).

c) Position the camera outside the fog, looking through the CEG into the fog.

d) Observe that the CEG is obscured by the fog, even though the fog is BEHIND the particle effects.
TagsCEG, particle
Checked infolog.txt for Errors
Attached Files




gajop (developer)

Can you provide some screenshots for the status quo?
This is obviously a visual thing and you'd have a stronger argument if we could see what's going on in both of the current cases (callins).


CrazyEddie (reporter)

Screenshots attached.

For the first three, I started a game on Siberian Divide, attacked the ground with a beam laser, and paused the game. I then moved the camera and took three screenshots of the same game frame and game world state.

dw-visible.png shows what you would expect to see all the time. The com, target, beam, and camera are all outside of the fog; everything is visible, nothing is obscured.

dw-obscured_top shows the same scene, except that the camera has moved so that the fog (which is in the low-lying areas of the map) is visible in the background. Where the laser beam overlaps the fog, the fog has obscured the beam even though the fog is BEHIND the laser beam.

dw-obscured_bottom shows the same thing, except the camera has shifted slightly so that only the bottom portion of the beam is overlapping the fog.

These three screenshots show the principal problem. The fog is drawn during the DrawWorld call-in, which takes place AFTER the laser beam is drawn. But because CEGs are drawn without writing to the depth buffer, the fog is drawn ON TOP OF the laser beam and obscures it (as if the laser were within the fog, which it is not).

The same thing happens with any CEG, such as explosions.

To make the fourth screenshot, I edited the fog gadget and moved the fog drawing to the earlier DrawWorldPreUnit callin. This allows the CEGs to render on top of the fog correctly, but causes units to be rendered on top of the fog as well. You can see this in dwpu-not_obscured.png; the fog is obscuring the terrain (making it harder to see the further away it is) but the Commander is not obscured at all, even though he is within the fog and as far away from the camera as the very-obscured terrain.

This is why I believe that in order to allow fog to be drawn at the correct time, we need a new callin which triggers after all opaque objects are drawn but before the alpha (translucent) particle effects are drawn.


The_Yak (reporter)

This is still an issue, and has been discussed recently on Zero-K Discord and here: http://zero-k.info/Maps/Detail/55956

Example screenshot: http://i.imgur.com/Ngs7L6f.jpg

I could add more but don't really know what to say that CrazyEddie hasn't already outlined.


Kloot (developer)

There is a DrawWorldPreParticles event now.

NB: you do not get an entirely free lunch, which will become obvious when migrating dualfog to this callin.


gajop (developer)

So what's the drawback?

-Issue History
Date Modified Username Field Change
2016-04-24 20:10 CrazyEddie New Issue
2016-04-24 20:17 CrazyEddie Tag Attached: callins
2016-04-24 20:18 CrazyEddie Tag Attached: particle
2016-04-24 20:19 CrazyEddie Tag Attached: CEG
2016-05-06 06:59 gajop Note Added: 0016272
2016-05-08 03:16 CrazyEddie File Added: dw-visible.png
2016-05-08 03:16 CrazyEddie File Added: dw-obscured_top.png
2016-05-08 03:16 CrazyEddie File Added: dw-obscured_bottom.png
2016-05-08 03:17 CrazyEddie File Added: dwpu-not_obscured.png
2016-05-08 03:28 CrazyEddie Note Added: 0016279
2017-05-23 12:14 The_Yak Note Added: 0017676
2017-05-23 14:12 Kloot Assigned To => Kloot
2017-05-23 14:12 Kloot Status new => assigned
2017-06-08 23:42 Kloot Status assigned => resolved
2017-06-08 23:42 Kloot Resolution open => fixed
2017-06-08 23:42 Kloot Fixed in Version => 103.0 +git
2017-06-08 23:42 Kloot Note Added: 0017801
2017-06-09 00:15 gajop Note Added: 0017802
2017-09-24 19:12 Kloot Tag Detached: callins
+Issue History