Search Unity

Triton Oceans and 3D Water for Unity Pro / Windows [DEPRECATED]

Discussion in 'Assets and Asset Store' started by sundog, Sep 20, 2012.

  1. gamedeveloper512

    gamedeveloper512

    Joined:
    Jun 14, 2013
    Posts:
    16
    Hello. How is it going with Oculus Rift integration?
     
  2. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Pretty good so far - everything's working within the editor, and we're moving on to getting standalone deployments for the Oculus Rift working properly.
     
  3. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Hi gang, just to whet your appetite for our new release:



    This was taken using the latest version of Triton for Unity Pro - we're still waiting for asset store approval, but if you want early access, the free trial at our website is up to date.

    Be sure to read our documentation, especially before deploying a standalone app that includes Triton. We've added editor scripts to make this process easier, but you still need to be aware of them!

    Also, remember Triton only supports Windows and MacOS desktop projects, as it consists primarily of native code.
     
    John-G likes this.
  4. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    One more question while awaiting the unity 5 version of shader, is it easy to add foam effects that linger behind the waves.
    It seems to be one part of your wave system that I haven't seen in any of the videos that will really make the waves stands out.
     
  5. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    There is foam, but you're right, it seems hard to see in Unity for some reason. If you edit the Triton.config file included in our TritonResources folder, you'll find a setting for foam-blend - you might want to just increase that to 1.0 to make it more noticable.
     
    John-G likes this.
  6. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    John, looks like our latest update is up on the asset store now, so feel free to check out the free trial - it represents our latest.

    Note that the Unity version of Triton is configured to favor speed over quality, since it's often evaluated on low-end systems. If you want to tune it to the same level as the demo video that originally caught your interest, you can do the following from a script (an Update function would be a good place, in order to ensure Triton is already initialized)

    TritonUnity triton = (TritonUnity)(GameObject.FindObjectOfType(typeof(TritonUnity)));
    triton.GetOcean().SetQuality(Triton.OceanQuality.BEST);


    This will increase both the water mesh resolution and the number of waves simulated.
     
    John-G likes this.
  7. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Nice one, look forward to trying it out.
     
  8. KarelA

    KarelA

    Joined:
    Dec 30, 2008
    Posts:
    422
    Hi.

    Is the newest version compatible with Oculus?
     
  9. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    It'll work in the editor with Oculus, but we're still testing standalone deployments (and direct mode, in particular - that's been problematic in the past.) Feel free to grab the current trial package if you'd like to start playing with it - we hope to offer official Oculus Rift support soon.
     
  10. evehal

    evehal

    Joined:
    Oct 18, 2014
    Posts:
    6
    hi i have a question ,can i change the color of water itself,instead of changing the color of directional light.
    for example,how can i change the color of water to red or yellow?
     
    Last edited: Nov 1, 2014
  11. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Yes, this can be done from a script. For example:

    TritonUnity triton = (TritonUnity)(GameObject.FindObjectOfType(typeof(TritonUnity)));
    triton.GetOcean().SetRefractionColor(new Triton.Vector3(1,0,0));


    .. will make the water red.
     
  12. evehal

    evehal

    Joined:
    Oct 18, 2014
    Posts:
    6
    cool,it works!thank you,i have another question
    in the demo,the city_light_xx on the brige will be blocked by the ocean
    before play:
    before play.jpg
    after play:
    34.jpg
    how to fix this?
     
  13. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    This is a general issue with native plugins in Unity and objects that are tagged as transparent. A workaround is discussed in our documentation, in the section "Triton and Transparent Effects".
     
  14. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Hey,

    I've just updated Triton in my project to the latest one from the Asset Store. I have also replaced the prefab in the hierarchy.
    When I run the scene I get this error:
    EntryPointNotFoundException: CSharp_Environment_AddWindFetch
    Triton.Environment.AddWindFetch (Triton.WindFetch fetch)
    TritonUnity.SetWind () (at Assets/Triton/TritonUnity.cs:574)
    TritonUnity.Update () (at Assets/Triton/TritonUnity.cs:274)

    Any ideas?

    Thanks
     
  15. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    It sounds like Triton's C# DLL (TritonClassLibrary.dll) is out of sync with its Triton's C# scripts, or perhaps Unity is caching old resources somehow. Updating from the asset store can sometimes go awry that way.

    My recommendation would be to download the latest trial asset from our website, and confirm its included demo scene works. Make a note of your license info (user name and license code) in your current Triton prefab. Then, delete Triton's assets from your project entirely, (after first backing it up,) and re-import them from the demo package. Punch in your license info into the new prefab, and that should work.
     
  16. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Thanks for the help but unfortunately after removing the asset from the hierarchy and project folder then downloading the trial it still kicks out the same errors:
    MissingMethodException: Method not found: 'Triton.Ocean.EnableGodRays'.
    TritonUnity.Update () (at Assets/Triton/TritonUnity.cs:278)

    EntryPointNotFoundException: CSharp_Environment_AddWindFetch
    Triton.Environment.AddWindFetch (Triton.WindFetch fetch)
    TritonUnity.SetWind () (at Assets/Triton/TritonUnity.cs:574)
    TritonUnity.Update () (at Assets/Triton/TritonUnity.cs:274)

    The odd thing is that the demo works. Do you know if there is a way to manually point it to the right place or refresh the caching?

    Here is another error:
    Assets/Triton/TritonUnity.cs(350,31): error CS1061: Type `Triton.Ocean' does not contain a definition for `EnableGodRays' and no extension method `EnableGodRays' of type `Triton.Ocean' could be found (are you missing a using directive or an assembly reference?)

    My version of Unity: Version 4.5.5f1 (7684ad0c5a44)
     
    Last edited: Nov 13, 2014
  17. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    It definitely sounds like you have some sort of mixture of newer and older versions of Triton going on there. EnableGodRays was recently introduced - do you have a TritonDLL.dll that stuck around after deleting the older version perhaps?

    As a sanity check you might try importing the trial asset into a clean project. I'll ask our devs to see if they can reproduce this at all as well.
     
  18. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Veddycent, do you know what version of Triton for Unity you were updating from? That might be important in our efforts to replicate what you're seeing (everything seems to work fine in our tests here so far, so we're missing a piece of the puzzle to replicate this.)
     
  19. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    To be honest I'm not entirely sure. It was an old project that I had revisited, but from what I remember it was last updated around March time.

    Thanks for your help.
     
  20. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thanks veddycent, that was helpful. The guys who maintain our Unity version were able to reproduce your problem, and found a couple of ways around it. Bottom line, updating over an older version is problematic, and you need to clear out every trace of the older version of Triton first. Otherwise Unity seems to want to cache old resources that are out of date. Here's their report:

    Was able to reproduce the error:
    1. Created a new project in Unity 4.5.5f
    2. Imported an old copy of Triton built on Mar 27, 2014
    3. Ran it to make sure it works
    4. Directly imported the latest build of Triton on top of it
    This produced an error during import, as well as an error when trying to run the scene:

    Error while importing package: Couldn't replace asset Assets/Plugins/TritonDLL.dll
    Failed to move asset from Temp/Export Package/b8d2f417044b04f4fa7dea71bf2c6a35/d05b5ac994465c145a7bc38bbb9bc227/asset to Assets/Plugins/TritonDLL.dll
    Assets/Triton/TritonUnity.cs(350,31): error CS1061: Type `Triton.Ocean' does not contain a definition for `EnableGodRays' and no extension method `EnableGodRays' of type `Triton.Ocean' could be found (are you missing a using directive or an assembly reference?)

    This seems to match the customer.

    Solution A
    1. Create a new, empty project
    2. Import the latest and greatest Triton into it
    3. Copy the new Triton's "Plugins" folder
    4. Replace the old project's "Plugins" folder with this new one
    (If he tries Solution A, he will also need to make sure to remove the 'Plugins' folder from the Unity Editor, and then re-add it. Else Unity will not realize it has a new DLL to try and use.)

    Solution B
    1. Completely remove Triton assets in the existing project from the following folders:
      1. Plugins
      2. Resources
      3. Triton
      4. TritonDemo
    2. Import the latest and greatest Triton
     
    Last edited: Nov 14, 2014
  21. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Ah, I totally missed the Plugins folder, Deleting that and importing again fixed the problem.

    Hopefully this will be of use to others.

    Thanks for the help, much appreciated!
     
  22. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    699
    Do you have any ETA for proper VR support? Are you working with the guys at Oculus and Unity to resolve this? I've done a few projects with DK1 and I'm in desperate need for Trition to work on DK2 too!
     
  23. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    We do have Triton working on a DK2 here. The main thing is to use the latest beta version of the Oculus SDK. We will be releasing a sample project for the DK2 with Triton very soon; we're just working on putting together a demo scene before we package it up.
     
  24. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    Does the latest version work correctly with Unity 5 beta 14
     
  25. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    It should, apart from the issues in Unity 5 where imported scripts sometimes don't properly compile at first. We can't officially support beta versions of Unity, so feel free to try our free trial of Triton with it, but it's at your own risk.
     
  26. web76

    web76

    Joined:
    Nov 4, 2009
    Posts:
    150
    [QUOTE="sundog, post: 1870490, member: 139]It should, apart from the issues in Unity 5 where imported scripts sometimes don't properly compile at first. We can't officially support beta versions of Unity, so feel free to try our free trial of Triton with it, but it's at your own risk.[/QUOTE]
    I have bought it but it seems there are a orientation problem.. That it renders the sea upside down and weird camera movment also..
     
  27. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    I am on the road at the moment, but please refer to the documentation. The orientation problem is addressed there along with a simple workaround.
     
    Last edited: Dec 3, 2014
  28. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    I'm happy to announce support for the Oculus Rift DK2 with Triton 3D Water and Oceans for Unity Pro! Our latest update includes a sample scene for the Oculus Rift, bringing real 3D waves to your VR environments. Get our free trial so you can try before you buy. Screenshot:



    There are some caveats to be aware of with Unity and Oculus; The Oculus SDK and the device itself are still in beta status, so there are some quirks you need to know about. We have a new section in our documentation on this topic, copied below:

    Oculus Support
    Triton now supports Oculus SDK 0.4.3.1 using the DK2. To see how integration works, refer to the TritonOculusDemo scene.

    There are a few important things to note when using the Oculus with Triton in the Unity Editor:
    • Make sure to have the latest Oculus Runtime and Oculus SDK installed for version 0.4.3.
    • Open up the Triton folder in your project view, and find the TritonOVRCameraRigPrefab. Drag this into your scene. This should be designated as your main camera.
    • In the TritonPrefab, check the "Using Oculus" option and drag the TritonOVRCameraRigPrefab object into the "Game Camera" option.
    • Go to Edit->Project Settings->Player. Go into the Other Settings and uncheck "Use Direct 3D 11". This will ensure that the scene runs in Editor mode.
    • When using the Oculus in the Unity editor, make sure to have the Rift Display Mode (set through the Oculus VR Configuration Utility) set to Extended mode. Direct Mode will not have head tracking on while running in the editor.
    • When running in editor mode, the camera will not view as the Oculus would view, so controls with head tracking will not visually be seen (though it will indeed be tracking). To move around the scene in the editor, go to the TritonOVRCameraRigPrefab and uncheck "Use Oculus Controls" in the FreeflightCamera script attached. This will not be the case when building a standalone executable; the Oculus will behave appropriately.
     
    e_marchenko likes this.
  29. sszukala

    sszukala

    Joined:
    Nov 26, 2013
    Posts:
    9
    All I have to say from reading the post the support reply of this asset managers is well informed. All very informational. Nice asset. Will be good to consider for later time.
     
  30. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Hey,

    I've finally had a chance to test out Triton with the Oculus, thanks for the release!
    Unfortunately after building and running the demo scene (with fully licensed Triton) using your deployment script, the .exe crashes, after pressing any key to exit the pop up menu. It also instantly crashes as well.
    Do you need to actually install the full SDK?
    I'm using runtime 0.4.4.
    Also the Oculus is connected via a display port to hdmi, probably not any use to you but maybe worth mentioning.
    Is there any logs you guys need to help with?

    I'm going to try runtime 0.4.3, but will post this before I have to restart my machine.
    Thanks
     
  31. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Yes, it would be good to see your log files following the issue. I assume you followed the other deployment guidelines for Triton to ensure the proper TritonResources and DLL's are in the right place for your standalone build.

    At a minimum it would be good to know what version of Unity you're using. There are some issues with Triton on the latest Unity 5 beta that we resolved with an update that went live just yesterday.
     
  32. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Unity version: 4.6.1f1

    Published using the 64bit deployment script. The two logs are from running the two exe's created, probably irrelevant but no harm in adding both.

    Runtime 0.4.3 also doesn't work.

    I'm going to try this on a different machine.
    Let me know if there is anything else you need.
    Thanks
     

    Attached Files:

  33. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Well, the logs indicate the crash happened while using DirectX 11's FFT compute shader functions.

    My first bit of advice would be to make sure graphics drivers are up to date, but if so switching to DX9 should clear this up if that's an option for you. Or, you could also edit the Triton.config file in the TritonResources folder - look for the disable-compute-shader option in there, and set it to "yes".
     
  34. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    Disabling DX11 allows it to run, but I'm not sure if the Oculus set-up works as it should.
    There are a couple of odd bugs:
    The lighthouse is not visible but the reflection is.
    The sky box does not render on either eye
    The menu is not there.
    Neither is the buoyancy object.
    Basically the only thing that renders is Triton.

    I have also created a brand new project but still get these problems.
    I downloaded the trial directly from your website imported into a blank project but still get the same results.

    I'm not sure if this was released before the latest Unity version but hopefully this is an easy fix for use guys.
    I hope this isn't me just doing something stupid.

    Thanks for the support!
     
  35. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    I asked the guys who did the Oculus Rift work on Triton about what you're seeing - here's what they came back with:

    Triton with Oculus currently supports 0.4.3.1 and the user must have the Oculus Runtime and Oculus SDK version 0.4.3 fully installed located here:

    https://developer.oculus.com/downloads/#version=0.4.3-beta

    The user should also be running TritonOculus_DirectToRift.exe when building the Oculus demo if they using DirectMode; otherwise, TritonOculus.exe won't work since it isn't built for DirectMode.


    If that doesn't help get you up and running, let me know and we'll investigate further.
     
  36. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    We spent some more time looking into what you're experiencing.

    First of all, direct mode only works in Oculus with DX11. So, if you're trying to use direct mode with a DX9 build that's probably the cause of your most recent problems.

    The crash you're experiencing when using DX11 appears to be a known bug with the Oculus SDK. See https://forums.oculus.com/viewtopic.php?f=20&t=13501

    This problem will only affect Triton on AMD cards when DX11 is in use, which describes your setup perfectly. In this case, Triton tries to use DX11 compute shaders to accelerate its wave simulations, and apparently compute shaders and the Oculus SDK don't coexist well.

    We will issue another update to Triton to automatically disable the use of compute shaders when the Oculus is in use, but for now my advice is to go back to DX11, and set the disable-compute-shader option in TritonResources/Triton.config to "yes" in order to get back in business. That will let you use DX11 with Triton and the Oculus Rift, but without using compute shaders, which appear to be problematic when used with the Rift.
     
  37. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    109
    I did try it on another machine that used a Nvidia card and it still crashed. Ill try it all again with the necessary program installed. I'm a bit busy at the moment so will have to have to look at some other time.
    Thanks for your time.
     
  38. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    It's possible the same issue could occur on an NVidia system if CUDA failed to initialize for some reason. Either way disable-compute-shader = yes should clear it up. If not, send along your log after the crash when you get back to it and we'll have a look.
     
  39. Trollvahkiin

    Trollvahkiin

    Joined:
    Aug 3, 2013
    Posts:
    15
    Hey, is there any way to add foam to the edge blend? Also is there a way to get the edge blend to be a close to the shore without seeing the line where the ocean ends: http://prntscr.com/5y9h9e and finally how could I make it so from the outside you can't see very far into the water, so like it gets darker to the point where you cant see when you're standing on the sore because when Is set the water visibility to 10 (to get rid of the horrible line where you can see where ocean ends) you can see through the whole ocean. http://prntscr.com/5y9j45
     
  40. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    You'll have to either use a higher underwater visibility as in your second shot to eliminate the boundary completely, or a lower one as in your first - all you can do is find a trade-off that's acceptable to you. Fundamentally the water transparency is a function of water depth and the underwater visibility you've set. I suppose you could play games with the contour of your underwater terrain to make it fall off more sharply just beyond the coastline, or increase the resolution of the height map Triton uses to compute water depth via decreasing the "height map area" setting, which might help a little. Increasing your terrain geometry resolution at the coast could also help the waterline look more natural.

    In real life, the water would be very reflective from the angle in your images instead of transparent (refractive.) So for realism, I think you should err on the side of lower underwater visibility and work on smoothing the geometry at the coastline. Some of what you're seeing might also be "z-fighting" between our water and your terrain - if so, pushing out your camera's near clip distance or pulling in its far clip distance can help a lot.

    There are some very basic foam effects near the shore that can be enabled with the "breaking wave direction" and "breaking wave amplitude" settings, but they're intended mostly for views from the air. There are some improvements to this effect in the pipeline, but for now you'd have to add your own spray particle system near your coastline if you need to augment what we provide.

    Hope this helps.
     
  41. Trollvahkiin

    Trollvahkiin

    Joined:
    Aug 3, 2013
    Posts:
    15
    Ah great, thanks for the fast response. Now I've tried to build the project but the water isn't there. I'v enabled the debug log and it says the path to the Triton resources folder cant be found. I put in "Assets/Triton/TritonResources" because that's where it is and it works in the editor however it still gives me that error when using a build.
     
  42. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Due to Triton's native assets, there are procedures that need to be followed when deploying a standalone project. Please refer to the section "Distributing your Application with Triton" in the documentation for details.

    Worst case you can copy the TritonResources folder to the path you entered relative to the deployed executable and it should find it.
     
  43. Trollvahkiin

    Trollvahkiin

    Joined:
    Aug 3, 2013
    Posts:
    15
    Great, thanks for help. One last thing, is there a way to directly change the color of the water? Make it less dark blue and more tropical light blue.
     
  44. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Yes, the overall color of the water may be adjusted from a script. There is a TritonUnity.GetOcean().SetRefractionColor(Triton.Vector3) that can be used for this purpose.
     
  45. Trollvahkiin

    Trollvahkiin

    Joined:
    Aug 3, 2013
    Posts:
    15
    Hey, so I tried it and what exactly goes in the Triton.Vector3? I checked the reference which told me "the RGB color value of the deep water color; each component should be in the range 0-1."
     
  46. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Well, for example if you wanted the water to be red, you could add this inside the TritonUnity.Update function:

    ocean.SetRefractionColor(new Triton.Vector3(1.0, 0.0, 0.0));
     
  47. Trollvahkiin

    Trollvahkiin

    Joined:
    Aug 3, 2013
    Posts:
    15
    Now would this be better done in the TritonUNity.cs or a script I create?
     
  48. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    It's probably better to do it from another script, so you won't lose it if you update Triton to a new version in the future.

    So, from a different script, you'd first have to find the TritonUnity object so you could set this. Something like:

    TritonUnity triton = (TritonUnity)(GameObject.FindObjectOfType(typeof(TritonUnity)));
    if (triton != null)
    {
    triton.GetOcean().SetRefractionColor(new Triton.Vector3( red, green, blue ));
    }

    should do the job.

    In the end either way will work though.
     
  49. Trollvahkiin

    Trollvahkiin

    Joined:
    Aug 3, 2013
    Posts:
    15
    Right, so I did try and do this but I get a an error

    NullReferenceException: Object reference not set to an instance of an object
    WavesAndTime.Update () (at Assets/Scripts/WavesAndTime.cs:41)

    Line 41 is: triton.GetOcean().SetRefractionColor(new Triton.Vector3( red, green, blue ));

    This is strange as I thought "if (triton != null)" would stop the code ever executing if it couldn't find the script.
     
  50. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Maybe you are calling this code before Triton has been initialized, and so GetOcean() might be returning null for the ocean object.

    So maybe do if (triton != null && triton.GetOcean() != null)