Just to clarify, by “line of sight” I mean a visual effect in 3rd person games that lets the player see only what the character can see. E.g. like in Nox:
As far as I know, in 3D this kind of effect can be done only via some sort of omnidirectional shadow technique. I’m considering two variants:
- Every “invisible” fragment is simply made black. Pros: the objects look whole. Cons: “invisible” parts can still occlude the “visible” ones.
- Every “invisible” fragment is discarded. Pros: visible information is actually limited to what character can see. Cons: a somewhat weird look, resembling the results of a 3D scan:
Either way, it would require to:
- render to a “visibility shadow cubemap” a certain subset of opaque objects (at least excluding the character herself), ignoring their shadow-cast flags;
- in every object’s fragment shader, sample the cubemap and either discard the fragment or modify the final color;
- not render the “visibility shadow” as a normal shadow.
However, it seems like JME’s default RenderManager and shadow system aren’t very suited for this kind of task. Would I have to create custom ones (likely duplicating lots of code), or can there be an easier way?