Search Unity

How do you create an Infinite Ocean effect?

Discussion in 'General Graphics' started by EuanHollidge, Oct 21, 2017.

  1. EuanHollidge

    EuanHollidge

    Joined:
    Nov 3, 2014
    Posts:
    69
    Hey guys, I've been looking around and I can't seem to find any info on how to create an infinite Ocean. I've got the water tiles following the player around but there's only so far one can go with that without it bring the performance down. So how do you do it?
    Thanks
    Euan
     
  2. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    What view does the player have? Is it top down or first person?
     
  3. EuanHollidge

    EuanHollidge

    Joined:
    Nov 3, 2014
    Posts:
    69
    First person, Basically I'm making an infinite stranded deep type thing for myself.
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    What is causing the performance issue and where, CPU or GPU?
     
    Martin_H likes this.
  5. ShilohGames

    ShilohGames

    Joined:
    Mar 24, 2014
    Posts:
    3,023
    First thing to do is decide if "infinite" is really a constraint. If it truly needs to be infinite, then you need to keep the player at the origin and move everything else around relative to the player. That is the only way to achieve "infinite" distances in a video game.
     
    Arowx and Martin_H like this.
  6. EuanHollidge

    EuanHollidge

    Joined:
    Nov 3, 2014
    Posts:
    69
    I have a system like that down, it lets the player move around in an x by z space than once the player exits that space it centres him and offsets the rest of the world. The issue is that the islands I'm making are quite a bit bigger than stranded deep's so when you reach the top of an island you can see the end of the water.
     
  7. EuanHollidge

    EuanHollidge

    Joined:
    Nov 3, 2014
    Posts:
    69
    It's the CPU. It is the unity water tiles which are causing the issue.
     
  8. EuanHollidge

    EuanHollidge

    Joined:
    Nov 3, 2014
    Posts:
    69

    With 16 by 16 water tiles I get 43 fps, and they've been scaled by 4. So the ideal for me would be that I can have normal sized unity water arround the player, then maybe some sort of graphical trick to make it look like it goes on for ever, any ideas?
     
  9. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    I would look into using vertex shader for animating water.

    It would also help if you uploaded a minimal stripped down example that demonstrates the problem.
     
    Martin_H likes this.
  10. EuanHollidge

    EuanHollidge

    Joined:
    Nov 3, 2014
    Posts:
    69
    The problem isn't necessarily the performance, it's how to create an infinite ocean effect
     
  11. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,573
    In your case the problem is performance. Infinite ocean effect is done the way you're doing it. You have an ocean plane and you tile it, animate it, etc. However, your project can't handle the number of animated ocean planes you have, and that is a performance problem. The approach looks correct to me.
     
  12. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Fog and a good Skybox, the default Unity one always seems to have the ground plane too high (above 0).

    If you can get the Fog and Skybox to work together you can have a nice effect. Even bringing in the Fog a lot closer adds to the mystery of the game (reducing the focal length of the camera can massively reduce draw load).

    Also you can make a fractional scale model of the world in a different layer and move a camera around in it that generates the skybox textures in your game, so distant islands or dynamic clouds (particle fx) can be shown in your games skybox.

    Remember it's all smoke and mirrors in games you only have a small simulation sandbox to play in as your CPU and GPU power are limited.
     
    ShilohGames and Martin_H like this.