Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#908 closed defect (fixed)

CCmpVision's AlwaysVisible is broken

Reported by: vts Owned by: philip
Priority: Should Have Milestone: Alpha 10
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by vts)

For the rally points, it is necessary to be able to render their marker flags inside the SoD. This can be specified by setting the AlwaysVisible property of the Vision component to true. However, this currently has no effect, and entities with this property remain invisible in the SoD.

To reproduce:

  • Edit templates/special/actor.xml and edit the AlwaysVisible property to true.
  • Observe that no actors are visible in the SoD.

After a discussion with Philip on IRC it became clear that this is a feature that didn't get implemented when the LOS rendering code was rewritten, and that it will probably involve non-trivial changes to rendering code.

Change History (6)

comment:1 by vts, 13 years ago

Update after some investigation: CCmpVision checks AlwaysVisible correctly and does in fact pass the models to the renderer. You can verify this by enabling the wireframe view using Alt+W.

The issue is that the model is rendered using the normal model fragment shader (ps/trunk/binaries/data/mods/public/shaders/model_common.fp), which reads from the LOS texture and scales the color intensities accordingly:

TEX tex.a, fragment.texcoord[2], texture[2], 2D;
MUL color.rgb, color, tex.a;

I.e., if you're in the FoW where the LOS texture is all black (tex.a == 0), then the color will end up as entirely black and hence invisible under the FoW.

CRenderer.cpp maintains shaders that are used in various rendering passes, so I guess what we need is to add instantiate a version of the model_common.fp shader where LOS projection is not performed and somehow tell the renderer to use that one instead of the regular one for objects that should be always visible.

comment:2 by vts, 13 years ago

Sorry, I have my terminology mixed up; I meant the Shroud of Darkness, not the Fog of War. The rally points are currently visible in the FoW, but not the SoD.

comment:3 by vts, 12 years ago

Note: this ticket is related to #657. The <AlwaysVisible> element is already in place in the XML for the rally point marker entity, so as soon as this issue is fixed then the second property mentioned in #657 will be completed as well.

comment:4 by vts, 12 years ago

Description: modified (diff)

comment:5 by philip, 12 years ago

Owner: set to philip
Resolution: fixed
Status: newclosed

In 11454:

Make AlwaysVisible objects always visible in shader mode. Fixes #908.

comment:6 by leper, 12 years ago

Milestone: BacklogAlpha 10
Note: See TracTickets for help on using tickets.