This is kinda a, how can I solve this problem, question.
I’m using projectors to indicate what units are selected and that works fine, but I have flying units and the areas they can fly over does not contain any geomatry that a projector can be cast onto. The way this game works, flying units can move in an empty space/air between floating islands/terrain.
I tried using a tranlucent plane so there is some kind of geomatry to render a projector onto, but that did not work. Seems projectors can’t be rendered onto geometry that uses the “transparent/…” shaders in Unit.
So far I see my options being …
Create a projector shader that can render onto that tranparent plane. I would prefer this but my shader writing skills aren’t that hot. Can anyone help out with this?
or simulate the projector with a plane using the same/similar material and texture and offset at some position from the flying unit, and only use it when the unit is in these empty spaces. Problem is that there are edge cases where the unit is kinda over the edge of terrain and then it will look dumb when the simulated projector and real one shows up … any suggestions?
Any other ideas of how I could solve this problem?
I think I would try attaching a gameobject (for example, a plane with your image of the projection) to the flying units and then just enable/disable that gameobject when the unit is selected or deselected.
Problem is that projectors need something to be “projected onto”, so pulling them up do not solve the problem of seeing them sicne they will not apear where the transform is…
So far that seems to be my only solution but like I mentioned in the original post, it can be a bit strange near edges where the unit is near enough to terrain to have a partial projector visible and then this aditional plane might also be visible.
Could you have some kind of foggy area inbetween these floating islands where a hidden plane eixsts waiting to be projected onto?
Also another possibility is to not project in this case. It seems the only benefit to using a projector is for adapting to any terrain that is underneath the unit (so that you don’t have to manually bend polygons yourself).
Since the areas between islands are essentially flat planes, you might think of a different method of projecting their selection that mimics how the projection works on the terrain.
Yeah, for now it seems I’ll have to go with plane(s) that mimic the behaviour of the projectors.
I would if it worked Soon as I start using shaders that deals with transparency the projector stops working on that object. I created for example a plane with normal diffuse material on it and the projectors show up, but as soon as I select any of the shaders in “transparent” to make the plane invisible, like transparent/diffuse or transparent/vertexlit, the projector stops drawing on that plane , even if the plane is totally visible (alpha = 1).
I think the reason it doesn’t display may have something to do with the Projector shader itself. From what I understand with my limited knowledge is that it uses a Multiply effect, similar to photoshop’s layer effects. So it could be that it is taking into consideration the terrain’s “color” and using it to project its own color ontop of the terrain.
It may be possible to write your own shader that did not do this. I’m pretty bad at Shader’s though.