Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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

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

  1. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
    Last edited: Jan 31, 2014
  2. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    OK, that's something else then.

    It is difficult to predict when Unity will choose to render to an upside-down texture internally. However, a simple script modification should allow you to compensate for this. Around line 605 of TritonUnity.cs you'll find this code block:

    #if UNITY_STANDALONE_WIN
    if (camera.actualRenderingPath == RenderingPath.DeferredLighting || camera.targetTexture != null)
    {
    Matrix4x4 pflip = Matrix4x4.Scale (new UnityEngine.Vector3(1.0f, -1.0f, 1.0f));
    P = pflip * P;
    }
    #endif

    This represents our attempt to flip the ocean rendering when needed to match Unity's flipped render texture. Try commenting the whole thing out - if that doesn't work, try just commenting out the if(..) line.

    I don't see the red color you're referring to in your screenshot, but hopefully this will resolve whatever is going on with your effect.
     
  3. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Oh, also try commenting out the #if / #endif lines as well if you are testing this within the editor.
     
  4. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
    Exactly the same !

    the effect is the bloom.
    The red is done by sunshaft
    and It doesn't work !

    My render seting is forward rendering
     
    Last edited: Jan 31, 2014
  5. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Let me be more clear. Try replacing that entire block, including the #if / #endif lines, with just the following:

    Matrix4x4 pflip = Matrix4x4.Scale (new UnityEngine.Vector3(1.0f, -1.0f, 1.0f));
    P = pflip * P;

    Save it, and start your project. If that doesn't work, try removing that entire block of code entirely.

    One or the other will have the effect of flipping the orientation of the water.

    The original suggestion of using a second camera for your post effects would probably also work.
     
  6. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
    thanks you it work now !

    I have a little question do you plane to implemente post effect like camera under water blur, or could you provide a tool to use with !

    Thanks
     
  7. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    No plans at this time, but I do expect we will turn our attention to underwater effects later in the year.
     
  8. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
    Hi,

    I just tried to make an exe but the ocean seem to not render at all, we used the prefab.
    Must we have an activation from you ?

    Thanks
     
  9. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Please refer to the documentation where it talks about building standalone deployments. You need to ensure the TritonDLL.dll file is copied alongside your executable, among other things.
     
  10. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
    oups sorry !
     
  11. Redtail87

    Redtail87

    Joined:
    Jul 17, 2013
    Posts:
    122
    Hey,

    This ocean system looks awesome!
    I have been messing around with it and had a question, is it possible to assign a manual hightmap to the coastal effects?

    Thanks.
     
  12. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thanks!

    There is no built in way to provide your own height map instead of the automatically generated one, but if you've got enough C# and matrix kung-fu, it's something you could add in on your own at the C# layer without needing to recompile the native Triton libraries.

    Basically, you would just rip out most of what's in the TritonHeightMap.cs script, and instead just call UnityBindings.SetHeightMapFromPtr() with the native texture pointer to your own texture, and a matrix that transforms world coordinates into texture coordinates in your height map. The latter is the tricky part; you need to have a pretty good understanding of matrix transforms to pull that off.

    Out of curiosity, what are you trying to achieve by using a manual height map? Perhaps there's an easier way.
     
  13. Redtail87

    Redtail87

    Joined:
    Jul 17, 2013
    Posts:
    122
    That was fast!

    Cool to see that it is possible but I haven't messed with matrix transforms yet so if there is another way it would be better.

    So I am trying to combine world composer editor extension and the triton ocean, but there is no data for the floor of the ocean and rivers in the source area I am testing out. So there is no actual height difference from the water to the beaches. I was thinking I could make a heightmap with the water in it as an alpha type thing for the water.
     
  14. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Oh, I see. Yeah, it's probably easier to figure out how to extend the coastlines in your source data underwater a bit than to hack Triton to take a hand-crafted height map.

    As long as you aren't dealing with cliffs, just raising Triton's sea level a bit (adjust its Y position) might be good enough. Think of it as "high tide", and the edges of your existing beaches might end up becoming bathymetry to some extent.
     
  15. Redtail87

    Redtail87

    Joined:
    Jul 17, 2013
    Posts:
    122
    Ok, I will see if I can get it working with that method, thanks!
     
  16. rahul007

    rahul007

    Joined:
    Jul 9, 2013
    Posts:
    45
    If you people could just get underwater rendering and effects like suimono and shoreline foam, this would be like cryengine 3 water or even better.I know i am asking too much an it would be very difficult.But if you can do that it would just be super awesome!!!
     
  17. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    One of our military customers is actually funding development of more shoreline effects, so we're on the way there. Triton's always being improved upon on a full time basis. Thanks for the feedback!
     
  18. rahul007

    rahul007

    Joined:
    Jul 9, 2013
    Posts:
    45
    The only thing with triton that I need is underwater rendering stuff. Everything else just rocks! Hope you are working on it. By the way thanks for your reply.
     
  19. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    The new 3.0 version of Triton for Unity now includes a decal texture feature! This allows you to overlay your own textures on top of Triton's 3D water surface, and they will float on top of the water, matching the motion of Triton's thousands of waves.

    $kelp.jpg

    This example shows a bed of kelp created using this technique, but you could apply this to things like small floating debris, oil slicks, or whatever you can dream up...

    Using decal textures with Triton is easy. Just use the included Decal script, assign your texture to it, and give it a location and a size. Triton takes care of the rest.

    Applying decal textures to Triton's dynamic water surface involved a good amount of work on our end, but it's something the Unity community has been asking for from day one. We used techniques from volumetric rendering and deferred decals to pull it off, all with a minimal performance impact.

    I look forward to seeing what you guys do with it!
     
  20. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    A heads-up for MacOS users: Unity 4.3 appears to have a bug that prevents native plugins such as Triton from working at all in MacOS standalone deployments. We've contacted Unity about this, they agree it is a bug, and we've filed a bug report on it.

    In response, we've re-packaged Triton for Unity under Unity 4.2. You can get the new 4.2-friendly package at our website. It also works fine with Unity 4.3 if you're using Windows, or are only using it with the editor on Mac.

    Our advice for customers targeting MacOS is to not update to Unity 4.3 until Unity fixes this problem.

    We've also heard concerns from our Windows customers about general performance issues with Unity 4.3 that are unrelated to Triton; making this 4.2-compatible package available will also give you the option to stick with Unity 4.2 for now. Triton itself appears to perform well on 4.3/Windows however.
     
  21. NavpointSoftware

    NavpointSoftware

    Joined:
    Apr 30, 2011
    Posts:
    102
    Amazing stuff Sundog!

    I threw the decal suggestion up awhile ago when I first stumbled on this software, can't believe you actually managed to implement it! Incredible! Sadly im in no position financially or Project wise to take the plunge with it but you've pretty much sold me for when i am.....maybe by then you might have got some kind of underwater rendering implemented as well ;).

    Anyway just wanted to say this is an awesome addition!
     
  22. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thanks Bronco78th - you did put that idea in our heads :) Triton by the way does have basic underwater visibility effects, it's things like caustics and crepuscular rays we're thinking of adding later in the year.
     
  23. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    252
    That would be really sweet to have.
     
  24. kabir

    kabir

    Joined:
    Nov 15, 2013
    Posts:
    6
    Yeah really if you coul do underwater rendering you will get another customer here. Underwater rendering like suimono 2.0.
    Have a look at this video-http://www.youtube.com/watch?v=6VVMxshFSFg
     
  25. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    205
    I think all it needs to be a complete solution is underwater, hope they implement it.
     
  26. tynew

    tynew

    Joined:
    Sep 25, 2013
    Posts:
    122
    That would be amazing. Do you plan any other features?
     
  27. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Can't really think of much else! Some people ask us how to change the overall color of the water, or how to more directly control the transparency. Both are possible now if you know how to do it, but these seems like good capabilities to expose as properties on the prefab.
     
  28. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    104
    Hey,

    We are experimenting with the Oculus Rift and one of our demos using Triton.
    It all works how its supposed to but that is a bit of a problem.

    The Oculus works in Unity by adding two offset cameras that correspond to the left and right eye.

    To make the sea visible on both eyes I found the option in TritonUnity.cs to render to all cameras. This worked but because the two cameras are offset, to mimic real eyes, it causes the middle of the sea to overlap because your eyes merge the two camera outputs. Hope that bit made sense. I would add an image but I unfortunately cant capture what I can see :(

    Currently, as far as I'm aware, there is nothing in Triton that can fix this because Triton will project to one camera at a time. I was thinking of having one camera that's positioned in the middle of the two but I don't think this would work.

    Is there a work around that anyone has found or can think of?

    Thanks in advance.
     
  29. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Not totally sure I understand what you're seeing, but I do know several customers are using Triton successfully with the Rift and Unity. Hopefully one of them will chime in here.

    You can have Triton render to multiple cameras in the same frame with different projections, so perhaps you're just not going about setting up Triton with your multiple cameras quite right. Here's the section from the docs which may be relevant:

    Using Multiple Cameras
    If your scene contains multiple cameras, associate your primary camera with the TritonPrefab's "game camera" property. Then, pass any additional cameras to the TritonUnity.AddCamera() method. Each camera will have water rendered relative to its location, but Triton's physics update will only run once per frame.
    If you have multiple cameras, but only one is active at a time, you may use TritonUnity.SwitchCamera() to switch between them at runtime.
     
  30. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    104
    Thanks for the quick reply.

    The problem is that each camera has its own projection which causes the sea to have a slight difference in its orientation/position.
    Then when using the Rift you get a ghosting effect in the centre as your eyes merge the two together.

    Its probably exaggerated with the low quality screen.

    Regards
     
  31. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    I see. Wouldn't that be an issue with any large objects in the scene with fairly detailed geometry that crosses the two cameras, and not just Triton though?

    I'll have to step back and let some Oculus Rift users weigh in, as I don't have one myself I'm afraid.
     
  32. veddycent

    veddycent

    Joined:
    Jul 22, 2013
    Posts:
    104
    There are a few post processing effects that combat the problem of the distortion between the two cameras (these are all provided by the Oculus team and work very well).

    This isn't the case with Triton because it depends on the camera position, orientation etc to render whereas all the other geometry doesn't.

    I'm curious to see how others have incorporated the two together.

    Regards
     
  33. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    I don't understand how any geometry wouldn't require the camera position and orientation in order to render properly, but since I'm not an Oculus developer, I probably just don't get it.

    Could the issue be instead that your post-processing effect from Oculus to correct the problem isn't getting applied to Triton? If you've split off Triton into its own camera in order to handle transparency, perhaps those post-processors aren't being applied to the camera Triton is in?

    Failing that, you'll find a few Oculus-related questions earlier in this thread. Perhaps you could reach out to some of the other users known to use Triton + Oculus to see how they've resolved this.
     
  34. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    692
    What exactly do I have to do to make the ocean show up in a Mac build?

    Which exact files do I have to put where? It feels like I have tried to put everything everywhere. (All working well in the Mac Editor)
    @sundog please update the documentation with some better info on how to make this work on Mac!
     
  35. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    If you are using Unity 4.3+, you are probably encountering a known bug in Unity where native plugins (such as Triton) do not work in standalone deployments under MacOS. We've reported this bug to Unity and they have acknowledged it, but all we can do is wait for the next release and hope it is fixed.

    Meanwhile, our recommendation is to build Mac deployments under Unity 4.2. If you are using the latest version of Triton for Unity, it should automatically move any dependencies into place at startup as needed under MacOS.

    If problems persist, you might want to compare your layout to the one in the demo app for MacOS on our website.
     
    Last edited: Apr 3, 2014
  36. Lord-Simpson

    Lord-Simpson

    Joined:
    Mar 24, 2011
    Posts:
    10
    Hi

    Few questions.
    In a number of demo videos display water impacts which seam to display height and dissipation, are these customisable and if so how far can they scale,do they effect a buoyant object e.g. can a large enough impact re-direct ship ?

    Do ship wakes effect buoyant objects?

    What is the advised number of buoyant objects (ships) if your targeting mid-range PC's?

    Finally does Triton for unity support Linux (should I want to port to it later) as well as mac and pc.
     
  37. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Hi,

    1. Yes, the mass and velocity of the impactor may be customized leading to larger or smaller impact effects. Waves from impacts will affect buoyant objects.

    2. Wake waves also affect buoyant objects.

    3. Triton has a maximum number of wake effects and LOD scheme that it enforces to keep performance up, but the physics behind buoyancy can still add up if you have too many buoyant objects with too many "voxel slices" on each. Generally I wouldn't go more than 5 or 10 at once on a mid-range PC but your mileage may vary.

    4. We do not support Linux with Unity due to issues with native plugins on Linux. We do support PC on Unity 4.2 and newer, and Mac on Unity 4.2 only (there is a bug with native plugins in Unity 4.3 that affects MacOS.)

    I'd encourage you to download the trial asset from our website and see if it meets your needs before committing to a purchase.
     
  38. OrekaIngenierie

    OrekaIngenierie

    Joined:
    Jul 6, 2012
    Posts:
    67
    Hi,
    I need to remove the reflection of different Gameoject in the Triton water, do you have any solution for this ?

    Thanks.
     
  39. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    There is nothing built in for this, but what you could do is create a new layer for objects you don't want reflected. Then, modify our reflection camera to use a culling mask to exclude the objects in this layer. The reflection camera is created in the TritonReflection.cs script in the CreateObjects() method.

    Setting up culling masks can be a little tricky, but this thread is helpful: http://forum.unity3d.com/threads/28661-Selective-Camera-Culling-Mask
     
  40. kannan21

    kannan21

    Joined:
    Jan 29, 2013
    Posts:
    5
    For me the trinton water is visible in unity editor. But when i take a build, It's not visible. Even turned on the directx 11 check box while taking build.
     
  41. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thank you for having a look at Triton! There are a couple of things that might be going on.

    1. You might not have the TritonDLL.dll file deployed to the correct location, or you may be deploying to a system that does not have the required system dependencies installed. Please refer to the documentation for detailed instructions on how to distribute an application that includes Triton; since it has native components there are some extra steps involved.

    2. You may be running into a known issue that appears to be specific to MacOS and Unity 4.3, but since you mentioned DirectX11 that's not likely you. Still, it is possible this issue could be affecting some Windows systems unbeknownst to us until now. The good news is that we are testing a workaround for this problem today, and I would expect a new release very soon that addresses it. Subscribe to this thread to make sure you get the announcement...
     
  42. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    As long as I'm here, I wanted to share some information on using Triton with linear color space and HDR. We recently had a customer using the Rust physical shaders, which require linear color space to be enabled in the project. But, since Unity doesn't know about Triton's shading and texturing, it's unable to adjust Triton's water to remove gamma correction in the same way as the rest of the scene.

    There is however a workaround, so here's the new section in our documentation on the topic:

    Using Triton with Linear Color Space and HDR

    Some popular shader packages require your project to be set to linear color space instead of gamma. However, Unity has no visibility into Triton's shaders and so this will result in Triton's water being too bright if your camera has HDR enabled as well.

    As a workaround, you can modify Triton's shaders to remove the effect of gamma correction. You will need to edit both the TritonResources/flat-fft-patch.fx and TritonResources/flat-fft.fx files in a text editor.

    At the bottom of the PS() function in these shaders, you'll see the following lines:

    #ifndef HDR
    finalColor = clamp(finalColor, 0.0f, 1.0f);
    #endif
    return finalColor;


    Replace this code with:

    return float4(pow(finalColor.xyz, 2.2), 1.0);

    And, that should provide correct results with linear color space.
     
  43. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    New version!

    I'm happy to announce a new revision of Triton 3D Water for Unity Pro has been accepted on the asset store. As always, a free trial version is available at our website as well.

    This contains a lot of improvements:

    • Much faster performance overall
    • MacOS issue with standalone deployments with Unity 4.3+ is resolved - Mac is now fully supported again.
    • CUDA acceleration now supported on Mac when proper drivers from NVidia are installed
    • Improved appearance of wake waves
    • Improved spray effects
    • Improved rotor wash effect

    Enjoy!
     
  44. mayonedomeo

    mayonedomeo

    Joined:
    May 13, 2014
    Posts:
    2

    Hey sundog, same problem here... I'm running demo version on Unity 4.3, DirectX11 checked before build, and I'm testing on same system box. VC is installed as DirectX11 and referring to documentation:

    1. Copied TritonDLL.dll file from the Assets/Plugins folder next to my game executable, same directory
    2. Copied the whole TritonResources folder as is it from Assets/Triton folder and dropped in the Resource directory of the build.
     
    Last edited: May 13, 2014
  45. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Any chance you are building a x86_64 build of your project instead of x86? If so, you'll need to copy out the 64-bit version of TritonDLL.dll instead as described in the docs.

    Just tried doing exactly what you described here and it seemed to work OK. We do have a new update of Triton for Unity expected to go out tomorrow, so you may want to try re-downloading it once we've announced its launch just in case we inadvertently fixed some issue that was affecting you.
     
  46. mayonedomeo

    mayonedomeo

    Joined:
    May 13, 2014
    Posts:
    2
    I'm building x86, and I've also tried to use x64 version renaming the file as suggested in the docs... Anyway I'll wait for next version to be released, thanks...
     
    Last edited: May 13, 2014
  47. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    I'd appreciate seeing your log files from your standalone deployment if you could - please send it to support@sundog-soft.com. This isn't an issue I've seen before and I'd like to understand what's happening. Thanks.
     
  48. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Also, our developers surprised me and uploaded a new version of Triton for Unity to our website a few minutes ago. It should be available in the asset store within a few days.
     
  49. lobachevscki

    lobachevscki

    Joined:
    Apr 22, 2014
    Posts:
    9
    Hi,

    We were testing with a friend the plugin, and I must say it is awesome, our development team is interested in purchasing it for our project, but we have a couple of question:

    The shader seems to break when using postprocess effects in Unity, for example, we want to add a SSAO but the shader behaves seriously weird when we do so.

    The same occurs when using Occulus Rift. We want to add Occulus Rift support to our project, but the shader behaves insane when using it.

    We want to know if there is a way to repair these problems before purchasing. Other than that, the plugin is perfect.

    Thanks.

    (P.D.: the pricing is right, I think people is not appreciate the real scope of what you guys do)
     
  50. sundog

    sundog

    Joined:
    Dec 29, 2009
    Posts:
    429
    Thanks!

    SSAO in Unity seems to behave badly when the far clip plane is too far out. If what you are seeing is odd banding, it's probably a function of the near/far distance more than anything. There is also a separate problem in Unity where you can only apply SSAO to the last camera rendered in a scene. So, if you have multiple cameras on top of each other (which is sometimes necessary for proper sorting of Triton with transparent objects,) that could also be what's going on. Unfortunately I do not know of a solution to that latter problem.

    Triton used to work well with the Oculus Rift - it's been discussed in the thread a few times. The main trick is to make sure both cameras are given to Triton via the AddCamera() API in TritonUnity.cs, and to use the tweak described here: https://developer.oculusvr.com/forums/viewtopic.php?f=17&t=6978

    However, in the past month or so I've gotten a couple of reports of the area where the two cameras overlap in the middle not looking right with Triton. My understanding is that the Oculus Rift SDK for Unity applies some sort of postprocessing to this area which apparently isn't including Triton's ocean for some reason. It might be worth taking up on the Oculus forums as it may be a more general issue with plugins that do native rendering outside of Unity. I don't have an Oculus Rift myself so all I can do is speculate. We keep getting questions about it however, so it may be time to get one here.