So Crystal Space had a Ocean system in which Ocean was made by combining little ocean cells(20x20). These ocean cells would have different Level of Details(LOD) Governed by distance from camera. This distribution of LOD wasn't quite working as distance computed between camera and the cell was actually a *squared* distance and comparison was made with actual distance. Also cells re-positions themselves as camera move parallel to ocean. This re-positioning was causing a jerk. Well, both these bugs are fixed now. :)
Now comes the major issue *aaahhhh*. LOD distribution was working fine but the problem was with adjoining ocean cells of different LOD. for example one cell has LOD 5 and adjoining cell had LOD 4. Now LOD5 has double the vertices at boundaries than LOD4. and since the vertices are moving in waves like patterns so the ocean cells looks unconnected and Thus looked Ugly.
Thanks to Nvidia's ocean demo(and of course my mentor res) I was successfully able to replicate their implementation to rectify this problem. Checkout the wireframe rendering of ocean.
Here's what's happening.
Now have a look at this
Yellow color represents an oceancell.
Blue color represents inner mesh.
Green color represents the division line of outer meshes for a single cell.
there are four outer meshes for each cell.
Red color represents how LOD levels are connected using low res boundaries in higher LOD cell.
The vertices for a cells are computed as usual. The real magic happens in computing the triangle(tris). tris for inner meshes are computed as usual. then 2^4=16 different cells are created for one LOD level and stored in an array.
2^4 where 2 is the resolution ie low/high and 4 are edges Top/right/bottom/left. That's how we got the number 16. Desired cell(out of 16) selection depends upon LOD level adjoining cell.
No Comments/Trackbacks/Pingbacks for this post yet...
This post has 11 feedbacks awaiting moderation...
Comments are not allowed from anonymous visitors.
|<< <||> >>|