Author Topic: water in a custom mesh  (Read 9114 times)

abrasmelin

  • Newbie
  • *
  • Posts: 2
    • View Profile
water in a custom mesh
« on: March 19, 2014, 09:50:23 PM »
is it possible to put the water in a custom mesh. for example in a sink that is oval shaped. thanks!

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: water in a custom mesh
« Reply #1 on: March 19, 2014, 10:44:21 PM »
Sure you can.

The best way to do this is to drag a SUIMONO_Surface prefab into your scene, and then find the "Suimono_Object" game object which is a child object of the surface.  Here you can change the specific mesh and physics meshes that are used for this surface.... so if you go into the Plane MeshFilter component you can change the visual mesh, and on the Mesh Collider you can change the collision mesh (or remove this component completely if you don't need collision).

Finally, you just need to go back to the SUIMONO_Surface game object and change it's scaling back to (1,1,1), or scale it directly so it fits appropriately in your scene.

abrasmelin

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: water in a custom mesh
« Reply #2 on: March 20, 2014, 06:58:38 AM »
Sounds a little complicated. Is there a demo scene for this? Or can you provide a very basic demo scene for that? Thank you.

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: water in a custom mesh
« Reply #3 on: March 20, 2014, 07:10:06 AM »
It's not complicated at all, in fact it's pretty straight forward! :)  I don't have any demos or videos of using a custom mesh yet, but I'll probably have a few examples in the final version of 2.0 that should address this.

monks

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: water in a custom mesh
« Reply #4 on: September 03, 2014, 05:03:05 AM »
Hi, I'm also trying to add the Suimono water surface to a custom mesh. The mesh was an imported .obj. It is positioned correctly in the scene and I did have the Unity water shaders on it but I've had no luck so far attaching Suimono shaders to it.
 What I've tried to do is add the Suimono water object into the hierarchy, then drag the Suimono surface on top of that. Then. in the inspector, I've tried changing the mesh in the surface to my .obj mesh. Would I need to change the position x,y,z of the Suimono surface to match the .obj position as well? Are there any other changes I need to make?

//looks like I was reading the old documentation. Suimono 2.0 is a little different. I will take a look at that....

Thanks,
 monks
« Last Edit: September 03, 2014, 09:22:52 AM by monks »

monks

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: water in a custom mesh
« Reply #5 on: September 03, 2014, 12:20:30 PM »
Yep, still having trouble with this. A short tut would be really useful!  :(

monks

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: water in a custom mesh
« Reply #6 on: September 03, 2014, 12:24:59 PM »
Hi Monks, sorry I missed this.  I'll post a breakdown of how to use your custom meshes later today.

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: water in a custom mesh
« Reply #7 on: September 03, 2014, 07:40:21 PM »
Hi Monks,

Below are some instructions on using a custom mesh with suimono.  Technically you can use this on any type of mesh, but certain features of suimono such as the wave distortion and interaction really assume you are using some kind of planar horizontal-ish object.  Int he example below I'm using a small round plane that I imported as an .fbx object.

The best way to do this is to simply add your SUIMONO_surface object to your scene as normal, and then go back to this object and change the mesh that it's using.  Don't try bringing your custom object into the scene and then add suimono components to it as it probably won't work properly.

Let me know if you have any questions!


monks

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: water in a custom mesh
« Reply #8 on: September 09, 2014, 09:49:03 AM »
Hi, thanks for this...will take a look! :)

Do I need to change the x,y,z position of the Suimono surface to match the the mesh pos? Do I change the Suimono_Surface or Suimono_object pos, or both?
Also, do I need the Suimono_Module in the heirarchy at all? 2.0 is different to previous versions I know.

monks
« Last Edit: September 09, 2014, 10:06:22 AM by monks »

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: water in a custom mesh
« Reply #9 on: September 09, 2014, 10:16:36 AM »
Hi Monks,

First you should position the SUIMONO_Surface in the correct XYZ location.  The position of Suimono_Object should almost always stay at 0,0,0 as it inherits from the surface object.  If you need to rotate your custom mesh however, you should do that on the suimono_object  NOT on the SUIMONO_Surface. (though ideally the mesh should be rotated correctly before you bring it into Unity).

Yes you still always need the SUIMONO_Module somewhere in your scene, this is what drives a lot of the suimono functions.

monks

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: water in a custom mesh
« Reply #10 on: September 09, 2014, 10:32:35 AM »
Ah, that's why the shaders are messed up because I don't have the module in the heirarchy.. Yes, I have the surface placed correctly now, thanks!

monks

monks

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: water in a custom mesh
« Reply #11 on: October 29, 2014, 07:43:31 AM »
I've been trying to add Suimono 2.0 again to my custom meshes. I have 3 scenes all using Suimono. I'm getting really low frame rates in the setup I want to use.

1. The first uses Water4 example on a imported .obj. I get something like 93 fps. But I think Suimono will be much better once I have it set right.
2. The second uses a Suiomono Surface not using the custom mesh and I get around 65 fps.
3. The setup I want to use. The third is a Suimono surface using my imported mesh set up as you described above. In that I'm getting 16 fps. I don't seem to be able to fix this.

 At first I thought it was the size of the mesh in 3, but I increased the size the size of the Suimono surface in 2 to be equivalent, and I still get 65 fps there.
 Then I thought it might be the vegetation on the shoreline in 3. I tried adding lots of trees in 2, and it only reduces the fps by 10 or so fps to around 55. Which is what you'd expect- nothing drastic.
 So I'm left wondering if it's my mesh itself in 3 which is causing the problem. Tesselation is set to auto btw and I'm using Dx 11. Do you think it could be the mesh?

A couple more related things please...

I need to some help in setting up Suiomono 2.0 to use the flowmap that I generated with your Photoshop Action in your tut. I posted in that thread asking about which shader to use since Suimono 2.0 no longer has the waves shader you used in that tut.

Also, did anyone ever get river flow working? I have meshes good to go, but I haven't seen any useful discussions about it other than what is on your Unity thread. For example, is triangulation of river meshes on import to Unity a problem?

 There's a lot here I know! But, I'm spending hours and hours going into days with no improvements. :)

Thanks,

monks
« Last Edit: October 29, 2014, 07:46:58 AM by monks »

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: water in a custom mesh
« Reply #12 on: October 30, 2014, 09:15:44 AM »
Hi monks,

The Auto Tesellation setting could be a factor in the performance.  I recommend turning it off for your custom mesh, and then setting the "spread" and "factor" attributes yourself, until you get a balance between the visuals and the performance.

The other performance hit with suimono is usually the dynamic reflections, though if it's working ok in your other 2 examples it shouldn't be too much of an issue in the third.

If you want to send me an example scene I can look into it myself directly.  feel free to send any files to konnichiwa[at]tanukidigital.com

I'll go answer your flowmap question over in that thread as it may help other people as well...
http://tanukidigital.com/forum/index.php?topic=297.msg929#msg929

For river meshes, I'm working on an example of rivers that should give some insights on setting them up.  The main factor for rivers is the uv setup on the mesh should be as square as possible... for example if you have a river with lots of curves in it the uvs on the mesh should be setup as a straight rectangle WITHOUT the curves.  the "flow" function simply progresses the uv coordinates in a specific direction over time, so if you have curved uvs you're going to see weird results.  I haven't noticed any issues with triangulation in unity import, but I could double check.  Ideally you'd want to import the uvs instead of having unity create them.

Also feel free to send a specific river mesh over to me and I can make some recommendations.

-Justin

monks

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: water in a custom mesh
« Reply #13 on: December 27, 2014, 03:33:00 PM »
I've not got around to river yet. Sticking with the sea for now. I noticed that the default setting for Suimono Module > effect_refract_plane is set to mesh filter"plane", and mesh renderer set to off. I looked in the docs but I couldn't find an entry for this. Do I need to change this is f I'm using a custom mesh?
 I set my surface object to my custom mesh (sea) and performance is much better now so far (~75 fps)....but I'm getting a constant flickering in game mode on the water surface. It's going between the correct shader and a grey colour.

 Also, when I've set the surface object to my custom mesh, is it ok to deactivate the custom mesh in the inspector? When I do it doesn't seem to make any difference to anything.

monks

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: water in a custom mesh
« Reply #14 on: December 27, 2014, 04:43:48 PM »
Hi Monks,

the effect_refract_plane isn't the custom mesh you should worry about for the water surface.... this object is used to render underwater effects on your main camera, which is why it's set to off while it's in editor mode.  It only turns on when you're playing and actually under the water surface.

I should have a more updated version of the docs up soon, sorry for the confusion!

As for the flickering... hmmm... can you double check on your suimono_surface object that you only have these sub-objects...
-Suimono object
- Suimono_ObjectScale
- Suimono_reflectionObject
- Suimono_shorelineObject

I used to have a couple other objects in there for some advanced features I was planning, but I've removed them for now as they were interfering with some functionality.  If you have any other objects you can delete them, which might help the flickering.  If you don't then can you send me a screenshot showing the flickering as best you can?

For the custom mesh, as long as you have the meshed saved in your project folderr, and it's hooked up to the suimono_object, then you don't need to have it elsehwere in your scene.