View Issue Details

IDProjectCategoryView StatusLast Update
0004045The Dark ModGraphicspublic30.12.2015 15:42
ReporterSteveL Assigned ToSteveL  
PrioritynormalSeveritynormalReproducibilityalways
Status closedResolutionnot fixable 
Product VersionTDM 2.03 
Target VersionTDM 2.04 
Summary0004045: Conflicting post-processing effects
DescriptionDistant water draws over nearby fire particles. The vp3 material heat haze effect used by torches draws over (wipes out) water effects, which is conspicuous when using coloured water.
Additional InformationFrom forum discussion: http://forums.thedarkmod.com/topic/16887-sorting-water-and-fire/

//
There are a few things going on with the "bad" torch:

• Water is a post-processing effect in TDM. After the scene has been drawn, water is drawn over the top and distorts anything that it draws over, optionally adding colour like in your example. Water won't draw over anything solid that's in front of it, but the fire isn't solid, so it's getting drawn over and distorted and coloured by the water.

• The torch comes with a post-processing effect of its own: HeatHaze, which works the same way as water, distorting the stuff that's already been drawn. The torch's HeatHaze distortion is much subtler than the water distortion, which is why the top of the flame looks ok, where it overlaps the HeatHaze effect.

• All post-processing effects that distort an image of the current scene have the same drawing sort order (100), so there's no way to control which gets drawn first. In your case, the water is being drawn first then the torch's HeatHaze effect is drawing over it, using the original scene image, and wiping out the water effect.


For the "fixed" torch on the right, I did a couple of things:

• Commented out the HeatHaze part of the particle effect (found in tdm_defs01.pk4 -> particles/tdm_fire.prt). That's the stage that uses textures/sfx/vp3. So the "fixed" torch doesn't do any HeatHaze.

• Made the fire draw after (over) any post-processing effects. There are 2 fire materials used in the torch: textures/particles/pfirebig2_sort10 and arcturus_fire, found in tdm_textures_base01.pk4 -> materials/tdm_particles_legacy.mtr and tdm_particles.mtr. I duplicated them and added "sort 101" to the global parameters. That makes them draw after, i.e. over, the post_processing effects,

NB that'll make them draw over glass too, so you should avoid letting a torch "fixed" by this method be seen through a glass window. (unless you add "sort 102" to the glass to fix it :) But it could quickly get messy! If you then saw the glass behind the torch, with the glass using "sort 102" it'd still draw over the torch!)

We can have a think about how to handle these better in 2.04. It would be good to allow materials to specify a draw sort order for post-processing effects too, and there might be general rules we can put in such as "fire always draws over water", because you don't tend to get underwater fire. And we might be able to use a distance check to influence the draw order. There's no way to do that perfectly, but it'd probably handle 99% of cases correctly.
//
TagsNo tags attached.

Activities

SteveL

SteveL

30.12.2015 15:34

reporter   ~0007938

Last edited: 30.12.2015 15:41

There is no general fix to this problem. There are no rules that will always apply: water isn't always further away than glass, and fire shouldn't always draw in front of water (e.g. player under water looking up through the surface and seeing a torch). Distance checks are no use: in the example pictures in the linked thread, the player is closer to the water surface than she or he is to the flame, but we need to draw the flame in front of the water to fix the bug. The distance check would have to be done for each pixel, not for whole triangles, but there are no depth buffers for translucent surfaces, so it can't be done. Adding those depth buffers would hurt performance in all maps, to fix a problem that happens in very few.

The materials need to be tweaked in individual spots where problems are found. Closed.

Issue History

Date Modified Username Field Change
17.01.2015 20:56 SteveL New Issue
17.01.2015 20:56 SteveL Status new => assigned
17.01.2015 20:56 SteveL Assigned To => SteveL
17.01.2015 20:57 SteveL Summary Draw order conflicts for post-processing effects => Conflicting post-processing effects
18.01.2015 00:19 SteveL Additional Information Updated
30.12.2015 15:34 SteveL Note Added: 0007938
30.12.2015 15:41 SteveL Note Edited: 0007938
30.12.2015 15:42 SteveL Status assigned => closed
30.12.2015 15:42 SteveL Resolution open => not fixable