What is the correct way of rendering ocean chunks?

Hello!
I have been searching all over but there isn’t any good explanations I have found on chunk loading/chunk handling. I have made a wave system, but I want it to have chunks to make it feel more natural.

Most chunk rendering tutorials I have found just regenerate the chunks every time you move. I want to create something like the following:

  • I don’t know how I would go about rendering those chunks automatically without having to write a function call per each chunk (manually writing each call)

  • When I coded a movechunk() function the offsets are not in the right place, it checks it offset value from the main chunk but it doesn’t move to its location correctly.

  • I need to only focus on rendering chunks with waves (such as nearby chunks) but I don’t know how I would go about transitioning the chunk to being flat once you reach a far distance and not using resources on those far out chunks

If this approach is wrong or has flaws let me know so I can improve, I have been working on making waves for 4 days now and I feel like I can’t make any progress, any help is appreciated!

Update: I have finished the first step by going through each chunk and checking it’s neighbors if they are chunks or not (multiple iterations), though I still need help on second and last steps.