- Home /
Alternative method to grid projection for a quad-tile game?
Unity default package projector comes with a grid projection cookie. It achieves a very desirable visual effect for me. However, I would want to create grid system where each grid can contains game data (x-y,size, move cost, height, objects that are on this grid, etc.). If I use projection method, projection's grid size depends on distance between projection source and the terrain. I also want to be able to highlight grid (e.g. selecting grid would blend it with blue).
My thought-up method would be to have an thin, transparent grid overlay on top of the terrain. Each overlay would be corresponded to 1 grid, so if I have 1000x1000, I would have 1000x1000 grid objects. These grid overlay will only have border if unselected and will be highlighted with a blending color if selected.
However, this would mean 1000x1000 of "game objects" or shaders. I don't know if this is the way to approach this problem. Is there any other alternative?
You might take a look at Vectrosity for drawing the grid lines. Here is another gridline/terrain questions that you might find helpful:
http://answers.unity3d.com/questions/442581/how-to-draw-a-grid-over-parts-of-the-terrain.html
@robertbu Can Vectrosity draw a quad projection on a tile?
Can you add a mock screen shot of the final effect you want? Depending on your target, other solutions may be possible.
$$anonymous$$yself, I'll often draw a separate piece of geometry that uses a depth shader to overlay a grid on other content - it can be more efficient than projectors, particularly when using deferred rendering, because it doesn't require re-drawing every triangle of every object in the grid.
@robertbu Can Vectrosity draw a quad projection on a tile?
I'm not sure what you mean. Vectrosity is 'just' a line drawing package...but a very well written one that creates very efficient lines. If you had an arbitrary terrain that you wanted to draw lines on, you would need to supply the vertices for the lines, but it would handle a large number (32,000?) in a single draw call.
Answer by adriandevera · Jun 30, 2015 at 12:20 AM
Huh? Im lost what issues are you having with quads? Im not having any, I just programmed the proper height. But I am having issues making some colors appear more opaque like red.
Is this what youre trying to achieve?
Answer by Cherno · Jun 30, 2015 at 12:58 AM
Here's an old thread that has a script for drawing lines in game view using GL Lines.
yea but Im sure he wants textures not just openGL lines, so the solution for him would likely be projectors