Reminds me
. I wondered about generic instancing effect(s) support when I was tinkering a bit with shaders a while ago. It seemed conceptually useful for many things (?). One that accepts a generic model - which could be 2 quads for trees. It would create an arbitrary 2d grid of objects. A line of trees or windmills would be just a subset. It would also have some random variation in spacing and rotation, as well as object slots that are randomly empty.
The thought came from noticing airports have things like car parks full of simple car models that can hit frame rate disproportionately (maybe needs project3000 to show up?). Airports also tend to have manually placed trees, or various objects. Not sure if manually placed trees miss out on special lighting done by tree shader (season effects too).
Something conceptually along the lines of:
Input to shaders by engine might include: 1. some instance ID, 2. something to distinguish it from other of the effect in view, 3. # rows&columns, 4. location of two diagonally opposite corners of grid, 5. bounding radius/dimensions, 6. min&max spacing variation in both directions, 7. min&max rotation angles & variation, 8. a parameter 0-1 that tweaks the distribution in variation (how common the extremes are), 9. probability of an object slot being empty like , 10. some parameters for random color or texture variation for cars&similar.
1&2 - give a random PRNG seed for each object.
4-9 - supplied by the scenery maker in an XML(?) file distributed via terrasync. 9. can be done by shaders by if convenient (fragment discard statement or maybe collapsing vertices into a point?).
10 - may need variants of shaders unless there's a convenient way to specify masks for colour changes for everything without slow down - via spare mask channels, texture colour lookup tables, texture swaps, or something.
Edit: Random spacing away from airports in uneven terrain is harder, unless the general slope around each object position was also given by the engine, and variation in spacing (or slope) was small.
Grids with varying objects like objects like different vehicle models would be harder, and might be faked with 2-3 uses with different spacing.
Instancing support for manually specified position & rotation might also improve performance since airports often have duplicated objects(?).
Just a thought. Not sure if that's workable, fast, or easy to implement.
(Engine functionality to instance specified models without changing c++ may also be useful for objects bordering straight streets, like rows of streetlamps&road barriers&hedges.)
Kind regards