Search Unity

Wanted: Ocean shader

Discussion in 'Works In Progress - Archive' started by bigkahuna, Jan 8, 2009.

  1. o0S0o

    o0S0o

    Joined:
    May 7, 2010
    Posts:
    5
    I'm running into the scale issue. When I scale up my models, I get problems with them breaking up and flickering. (See the images.)

    Any thoughts on what I should to do to remedy this?
     

    Attached Files:

  2. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    The issue you're seeing is because in your model you have polygons sharing the same plane. To fix this you'll need to clean up your meshes a bit. This is a common problem, especially when using models not initially intended for use in a game engine. Not related to the ocean shader, at least not from what you've shown here.
     
  3. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    Not especially.

    We call that Z-Fight.

    Maybe polygons are to near.
    Then you just need to create a little more distance between the 2 objects.

    Or 2 second possibility is about the Near and Far clipping plane value.
    If the 2 values are to distant, camera will create a S***ty render when you are too far away from the geometry :wink:
     
  4. o0S0o

    o0S0o

    Joined:
    May 7, 2010
    Posts:
    5
    Thanks for the replies. Yes, these models came from an old ViewPoint library and were not built specifically for gaming.

    I posted it here because my 3d guy believes it to be a scaling issue (the ocean scene required me to scale models 100x), but maybe I should've posted a new topic. We tried putting these models into a different scene that didn't require us to scale the models and they were very clean.

    Just to clarify... should any model be able to scale cleanly at any size in Unity?

    Also, we tried changing the clipping plane values but the results were the same.

    Thanks again. We're new to gaming and have a lot to learn.


    EDIT: Nevermind. Changing the Near clipping plane from .1 to 10 completely fixed it. :D
     
  5. o0S0o

    o0S0o

    Joined:
    May 7, 2010
    Posts:
    5
    What is the latest build of this that includes the ability to go underwater? I'm a bit confused with all the various versions.
     
  6. mojojojo

    mojojojo

    Joined:
    Dec 16, 2009
    Posts:
    138
    I've downloaded all the Ocean V3 files and have them into my asset list but don't know what to do to actually get the files working. I'm extremely new to Unity 3D and I'm not nor have been a programmer so excuse me if my questions seem dumb. I'm looking to begin using Unity 3D to create visualizations of analyses but the workings of the program are not intuitive for me. Does anyone know?
     
  7. hostis

    hostis

    Joined:
    Jun 17, 2010
    Posts:
    7
    Hi!
    Great ocean!Is it possible to make the water of the ocean transparent, so that the parts of the objects which are underwater will be visible?
     
  8. mojojojo

    mojojojo

    Joined:
    Dec 16, 2009
    Posts:
    138
    Can I only use Ocean V w/ unity pro? I keep getting compiling errors looking for Image Effects.
     
  9. AFrisby

    AFrisby

    Joined:
    Apr 14, 2010
    Posts:
    223
    Is it possible to set the maximum wave height to a bitmap? I'd love to get this shader working so that the height of the waves lessens the closer it gets to the shore.
     
  10. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I wonder if you might be able to cheat and do that through script, ie. change wave height based on viewer's position? Maybe use a lerp to make the change smooth? Would be worth a try.
     
  11. AFrisby

    AFrisby

    Joined:
    Apr 14, 2010
    Posts:
    223
    Not a bad idea --

    My personal thought was maybe doing a orthographic depth render from above and building a coastline map from it (say anything depth >= 0y = Coast), then using that as a lookup table to attenuate the maximum height.
     
  12. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    Hi, used to work in quest3d, but WANT to use unity3d... Example pictures from my QUEST3D simulator, shader made by Viktor Kuropyatnik..The mesh tiles are seamless with no edges...

    Web76
     

    Attached Files:

  13. Kiraya

    Kiraya

    Joined:
    Jul 2, 2010
    Posts:
    1
    Hi, i tried to use the ocean v3 , but if you use a terrain (for example 2000px x 2000px), you can't scale it, so ocean is too big to be used.
    any Suggestion?

    ps: great work guys
     
  14. hostis

    hostis

    Joined:
    Jun 17, 2010
    Posts:
    7
    Hi, web76! Is it the ocean that's discussed above? And if it is, how did your make the water transparent?
    I want to achive similar results with my water and have been trying to do so for quite a time and have not found how to do it yet.

    I'd like to solve with problem too.
     
  15. blockimperium

    blockimperium

    Joined:
    Jan 21, 2008
    Posts:
    452
    Before I freak out, is that Unity that you're showing us screen shots of or Quest?
     
  16. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    Sadly it is quest3d... But I have the shader code for it, but need help porting it to unity!
     
  17. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    What? So what was the purpose of bloating this thread with your screenshots? There's no mention that they were done in another engine. :roll:
     
  18. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    Not Meaning to bloat, not to brag either, I can very little about shader programing, know a lot more about the physics and the simulator we are building...

    I know the ocsean looks okay but all credit for that goes to Viktor Kyropiantnic, who made it almost for a reguest...

    But I have bought unity pro version, because of faster developing and faster physics...we do a lot of prototyping for these cranes, so speed is essential..

    Just want this project to be at least as good also...
     
  19. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    The topic of this thread is the Ocean Shader, not crane physics. You've posted a number of pictures showing an ocean shader and touted it as a work in progress implying that the screen shots were done in Unity. Now we later learn that the screenshots were done in Quest3D. I think you used poor judgement and you should either edit your posts or remove them.
     
  20. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    If you feel affended I can remove them, just posted them as an example, and the quest3d ocean shader example was an early example of paid work quest did for the company I worked at, quite some years ago.. some of it anyways..

    It was meant as an inspiration, not as an insult, I really like Unity so much more ....

    Web76
     
  21. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I think your posts, as they are now, are misleading and off topic. No offense taken, but since this is a Unity3D forum and the topic is Ocean Shaders, let's please stay on topic. Thank you.
     
  22. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    I agree that it was a little misleading, but I didnt know it was off topic...
     
  23. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Just edit your posts so that you state that the screenshots were done in Quest3D. If you want to start a new thread on crane physics, go right ahead. That's all I ask.

    FWIW I've assembled an ocean shader from the bits posted in this thread that comes very close to what you've done in Quest3D. Unfortunately I can't post any screenshots yet. What it lacks is a "boat wake" which I haven't managed to work out yet. If anyone has sorted boat wakes on an ocean shader please feel free to jump in! ;)
     
  24. Crash

    Crash

    Joined:
    Jul 12, 2010
    Posts:
    3
    Don't worry, you're post is exactly what is needed. This topic has produced nothing to show in a year and a half.

    It begs the question, why isn't anyone in the Unity community stepping up to the plate and creating water and ocean shaders like they have for Quest and Silex?

    Any chance you can get Alexander Kulagin or Viktor Kyropiantnic to help implement an ocean shader in Unity?

    Kulagin did Azure Temple four years ago and there is still nothing in Unity that compares to it. And his Ocean_Shader_research Hybrid Properties GUI is way beyond anything for Unity.

    If Unity had water like Quest it would be unbeatable. Stop barking at web76 and you shader programmers do something about it. No offense intended.
     
  25. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @Crash - No activity in over a year? Have you even tried any of the samples that have been posted here? I have, and with a small bit of tweaking they work. If you search the past threads and invest a bit of time into it I'm sure you'll find the same to be true.

    My objection to web76's post was that I (and I'm sure others) thought the pictures he had posted were created in Unity 3D. To be honest, the ocean shader I've assembled from the pieces here comes close to his shots, but not quite that good. I thought then, and I still think now, he should edit the posts to indicate that (assuming he hasn't already).

    When I started this thread I really had hoped to generate enough interest in the topic so that someone at Unity Tech might give it a serious look because I agree that the lack of a great ocean shader is pretty much the only thing Unity lacks (when compared to Quest3D et al).

    So before you start criticizing me, Mr. First Time Poster, why don't you read my original post, give some of the samples others have so generously contributed a look and give it a try. No offense intended.
     
  26. Deleted User

    Deleted User

    Guest

    oh no! We're under attack by Quest3D fanboys!! :eek:
     
  27. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    :D
     
  28. vethoix

    vethoix

    Joined:
    Jul 11, 2010
    Posts:
    94
    best i got
     

    Attached Files:

  29. vethoix

    vethoix

    Joined:
    Jul 11, 2010
    Posts:
    94
    double post oops.
     
  30. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    I have edited my post long time ago now, I am no fanboy of quest3d, thats why I switched to unity. I think almost everything is easier and faster in unity...

    But I also want a better oscean, and since I also need this shader I thought I would share what I wanted as a result...
     
  31. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    This is the best I've managed to get so far. Hard to show in a static screenshot but there are whitecaps, sun reflections, and an animated sky. This was done in Pro, BTW. Still needs some tweaking but so far so good. No boat wakes though. Incidentally, if you're posting screenshots, please rescale them to 800 pixels wide, that way the thread doesn't get too w....i....d....e, which makes it harder to read.
     

    Attached Files:

  32. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    Looks great! So are you willing to share ;) can understand if you dont..

    Regarding wakes, I am not really sure how they solved it, but I was told that they used animated textures that was projected according to the camera on top on the ocean mesh... I might find an example somewhere...
     
  33. vethoix

    vethoix

    Joined:
    Jul 11, 2010
    Posts:
    94
    point taken...
    by the way...I just updated the shaders to what I thought was best, but i see your greenish water is way better.
    is there a source out there for a ocean that has waves though?
    rough waves to be exact. if so please post about it.
    I'm using PAID unity pro.
    and im talking to u,
    bigkahuna

    how did u guys get the ocean effect in the first place?
    I can only load the last 2 pages of this thread for some reason , as it just comes up as connection problem on the other pages.
    so i dont know how..hm
     
  34. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Everything you see was assembled from pieces found in the forums here. The ocean is fully editable so you can have huge waves if you want. The animated sky was from another thread. Just use the search button and invest a bit of time to find the pieces and put them together. I think I did have to edit some of the ocean code, but if I recall correctly it was a pretty simple little fix. I'm swamped at the moment but if I get time I'll try to re-assemble the bits and post them. The big problem is that I can't recall who created what and I don't want to post something without giving proper credit to its original creator(s).
     
  35. vethoix

    vethoix

    Joined:
    Jul 11, 2010
    Posts:
    94
    Your insolence shall be punished, sir.

    Na just kidding. I just found what I was looking for a while back :)
     
  36. inshane

    inshane

    Joined:
    Jul 13, 2010
    Posts:
    12
    I've been trying the ocean shader package but i noticed how heavy it was, just insane. And if you'd go up in the sky you would also lose the quality seen in most screenshots.

    But nevertheless I just used a sinus wave now with the pro water shader this works alright for the thing i'm currently doing. Still need to tweak it more.

    Regards.
     
  37. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    If you check out the video I posted on the first page of this thread, that's exactly how I did it. And you're right, the results aren't bad.

    There have been lots of different iterations of the ocean shader posted here and on pages linked to in this thread, some I thought had pretty good performance while others didn't. The one in my screenshots above gives me 50+ fps in the editor at 1024x768. You're also right about the "broken seam" issue, for a boat-type simulator it would work but not flight sim, at least not without some modifications.
     
  38. Crash

    Crash

    Joined:
    Jul 12, 2010
    Posts:
    3
    Second Time Poster now, but what does that have to do with anything? The work you are doing is producing some good results bigkahuna, but that is not the point.

    Where are the Unity developers responsible for the water shaders? What are they doing to catch up with these other tools?

    I have read this topic from page one, checked everything out, and also checked out other tools and their forums.

    What I found is that the Unity Community is sarcastic, not open source, and thin skinned. The other communities work together and share their code, that is why they are so far ahead.

    Ogre, Aquatica, Quest, all come off the shelf with better water shaders, that is obvious, and Unity could care less, water must not be a priority for them.

    Bioshock 2, Just Cause 2, Azure Temple, web76's pictures, all show what is possible with some descent shaders.

    I am not a Quest fanboy, just a fan of realistic ocean water effects, which I would like to see in Unity.

    Why should we pick and sort through hundreds of topics and pages just to maybe in the end piece together something Unity should have come with years ago.

    Anyways, from the tone of your post, you guys have this water/ocean shader thing covered, and don't need any help.
     
  39. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Lets keep to the topic at hand please. If you have something of substance that will contribute to producing an ocean shader for Unity, then please feel free to post it here. Otherwise, if you want to start a flame thread, please go elsewhere.
     
  40. Crash

    Crash

    Joined:
    Jul 12, 2010
    Posts:
    3
    You have got to be kidding. You are the flamer. And you have been off topic for a year and a half.

    I am taking this issue to my students at Cal Tec and Chico state. In a few weeks they should have something like what you see in web76's photo and Azure Temple.

    But I won't be posting the results here. Anyone that is interested in the source and GUI can contract me directly.

    Kahuna, the sandbox is all yours, play nice.
     
  41. MattFS

    MattFS

    Joined:
    Jul 14, 2009
    Posts:
    219
    I used to dev using Reality Engine way back in 2004 and the water used there was a slightly modified approach to this thesis project.
    http://fileadmin.cs.lth.se/graphics/theses/projects/projgrid/

    The results (that is, the mesh deformation) was very convincing and it's projected grid approach meant a uniform resolution for the water and any viewing angle and any height.

    Though - I think one of the main problems we'll have here is performance. I'm not convinced writing something as important and performance critical as a realistic ocean through a Java script will be the best idea.

    Perhaps, if taken seriously, this would need to be a C++ library that your scripts can hook into simply to construct and initialize the Water Surface class.

    I wish my C++ skills were strong enough to port this projgrid demo! :)

    I believe the key would be to get a strong, fast C++ library that generates your water mesh for you... after that, it is entirely up to the developers to stylize the water themselves through surface materials.
     
  42. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    That's an interesting approach. I started experimenting with particles before giving up on that idea.
     
  43. Eki

    Eki

    Joined:
    Feb 2, 2010
    Posts:
    7
    Hi ,


    I used particle emitters, and rendered them to textures.

    Then did the projections


    http://users.telenet.be/SurpriseMe/Lake/LakeWake.html

    This scene runs pretty slow though

    Up=r
    Down=f

    Forward= w or z
    Back= s
    Left= a or q
    Right= d

    Lookaround= rightmousedrag
    Zoom= mousescroll
     
  44. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @Eki - Well that's about 10 x better than mine came out! Nicely done!
     
  45. 3ddd

    3ddd

    Joined:
    Jul 15, 2010
    Posts:
    1
    In Wiki project is not present underwater shader, somebody can lay out it?
     
  46. mojojojo

    mojojojo

    Joined:
    Dec 16, 2009
    Posts:
    138
    Is anyone else having trouble w/ items acting erroneously when using ocean. If i add a box and attach a rigidbody it starts flying off into space but not everytime. The only consistency is the problems. I assume there's probably a quick fix but I don't know where to begin and Ocean is a rather large and complex script.
     
  47. mojojojo

    mojojojo

    Joined:
    Dec 16, 2009
    Posts:
    138
    @ Eki or Big Kahuna

    How did you deal w/ the scaling issues or did you just make a bunch of large objects. I need to reset gravity proportionally but I'm basically guessing.
     
  48. immFX

    immFX

    Joined:
    Mar 20, 2010
    Posts:
    110
    @Eki - this is the first attempt I see here that renders wake particles to the ocean texture.

    Would you share the code to show us how you did it?
     
  49. TwinFox

    TwinFox

    Joined:
    Jan 9, 2009
    Posts:
    66
    As I see it, the biggest hinderance to collaborative projects like this in Unity is the lack of proper VCS. It makes any coordination very hard: Nobody knows what is the latest version, who has it, or what changes have been made. I really hope this will be improved in the future. Maybe VCS should be added to the free version, but locked to a community-only repository that would replace the Wiki?

    As for the lower ocean quality than in other engines, I see a few reasons for that. First, we are restricted to coding in scripting languages if we are to remain compatible with the free version. This obviously impacts performance. Second, writing shaders in Unity is, at least in my experience, much harder than it should be. This makes it difficult to divert some of the more processing intesive tasks to the GPU.

    So anyone blaming poor community spirit for the lack of progress is IMHO quite wrong. If this was the case we would not have progressed past the first few pages of this thread.

    It is good to see that there is steady improvement with the ocean and some very nice looking results, but I'm afraid the original C# FFT-code will be the limiting factor until replaced by something much faster. A candidate for the next Summer of Code, if there ever will be one?
     
  50. tbarbe

    tbarbe

    Joined:
    Dec 22, 2008
    Posts:
    154
    Hi

    I just came across this thread so please excuse my lack of info if this has already been discussed.

    How much of this technique for ocean shaders can be ported into the iPhone versions? is there a lower rez or lessened technique that could be used to capture some of the ocean waves into an iphone version app?

    ?