   Batching morphing terrain and shaders.
  I want to batch my Chunked LOD terrain renderer. I was originally going to ask what methods I can use to pack chunks together. The reason it is not that simple is that the chunks have weight associated that blend between two actual vertex positions (the n-1 and n positions). The blending values are never stable at either 0 or 1, so they cannot be baked with a fixed weight value. But I have worked out a technique that I think could work really well: - pack sets of chunks together (in N by N grids).- add a packed weight mask to each vertex, that has only one bit turned on for each chunk in the pack.- pass a fixed N*N array of weights to the shader.- in the shader loop over the weights and multiply them by the mask bit for that weight, summing the results, giving the final weight.- also pack the N*N textures into a single texture, and re-map the UVsThis gives me a N*N batch. This could easily be pretty much any number of chunks per batch.The problem I have with this technique is that there doesn't appear to be an easy way to pack and unpack the weight masks. I am using the glsl profiles in CgFx, and the Cg specifications say that float values (as I would use to pack the weights in to) should be "as close to IEEE float standard" as possible. If the input float bit layout doesn't match the graphics card float layout then it would obviously not work. Also it appears that bit operations only work on ints in ps3.0 or ps4.0 (not sure which) and nothing else. Any ideas on how I can implement this method, or another method of batching geo-morphing chunked LOD terrain? Thanks!   
  Not really sure I understand the direction you're going in with batching chunks together. If you have blended textures on your terrain, won't this cause a few issues? Are you talking about hardware instancing your terrain patches?I think what usually happens with chunked LOD terrains (at least this is how I do it), the 'weight' for each chunk (which I assume is for geomorphing?) is calculated per frame and each chunk is then drawn individually - using the vertex shader to morph the vertices to the correct height.Could you explain a bit more about what you mean by batching your chunks?   ;  Basically I just want to reduce the number of draw calls and state changes I have to make. That always ends up being what kills my performance. Still I have read the same thing as you say else where, and after tweaking my chunk LOD grid resolution, and activation distance I have my fps up to 100+ at high detail. It is still limited by draw calls though.Thanks :)   ;  So how large are your chunks (vertices-wise)? I'm assuming that you're using one size for all (eg, 33x33 verts) and just scaling and transforming your patches depending on error metric/distance to the viewer? Doing it this way, you shouldn't have that many draw calls.   ;  Regardless of the geometry, I still need one draw call per visible chunk, as there is per-chunk state that needs to be set for each chunk (the blend-weight, the texture, the parent texture). Also I am not rendering a perfectly regular grid, as it is rendering on a planets surface, so is curved. I'm using a normalised sub-divided cube for the planet model, then each quad on the surface is a chunked-lod root. This means I can't reuse the same vertex set, and just modulate it by height values, I actually need to store two 3D vectors and a scalar for each vertex (along with two sets of UVs for the child and parent textures). I can still reuse the tri-sets though (which I am not actually doing at the moment, I didn't think of it until I read it somewhere).   