Newer
Older
Import / applications / HighwayDash / ports / Design / instancing idea.txt


Idea
    - instancing is no good because it needs to be the same mesh
    - but each instance can have changed variables
    - idea is the mesh is many cubes in a grid, and one of the per-instance variables is u/v coords to a texture
    - texture contains 3d information about color or transparent for each cube in the grid of cubes
    - then if transparent, the vertex can be rejected by means of making the resulting triangle it belongs to degenerate
    - assumes that each cube in the grid doesn't share vertexes with neighbours

    - other problem is textures might not be available to the vertex shader, so this probably can't work this way


vertex array:


         0,0,0  0,0,1  0,1,1   0,1,1  0,1,0  0,0,1    0,0,0  0,0,1  0,1,1    0,1,1  0,1,0  0,0,1   


        Then requires 8 texture reads per vertex to figure out if surrounded by transparency or not
        Not sure that is too expensive

        If possible to read textures in vertex shader, it probably isn't that expensive as fragment shaders can do as much texture reads,
        however it depends how well clipped and the depth complexity as the GPU can't reject vertexes until after vertex processing so depends how many verts