About Store Forum Documentation Contact



Post Reply 
Water/Ocean shader usage?
Author Message
Biga Offline
Member

Post: #1
Water/Ocean shader usage?
Hi Esenthel,

I would like to ask that can I use the EE built-in Water shader for my mesh surface, or it just allowed for water material/editor purposes? If so, should I code my own water/ocean shader and can I base on existing EE water shader source? I tried to use public/nvidia HLSL water shader sources for EE, but not easy task to make them work smile

I made a small shader skeleton where I have all pixels where water shader should be applied based on a black/white watermap finding. For that part I would like use some simple ocean shader.

and yes, you mentioned you are working on a shader editor. it will have the possibility to create water type shaders too?

thanks
06-13-2014 11:04 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Water/Ocean shader usage?
Hi,

The current water shader I think is aligned to a flat plane, controlled by water plane normal vector.

Yes the shader editor is on the roadmap to be developed sometime in the future. I'd like to make it to support all mesh, 2d, water shader effects, but please don't expect it anytime soon, I'm currently working on other things.

Thanks
06-14-2014 01:07 AM
Find all posts by this user Quote this message in a reply
SamerK Offline
Member

Post: #3
RE: Water/Ocean shader usage?
Hi Biga,

yes you can apply EE water material into any mesh you have, check the WaterMesh class in water.h
http://www.esenthel.com/?id=doc#API/Graphics/Water
Regards

I didn't notice Esenthel reply, I remember that I did a successful test few month back using different meshs but ofcourse water effect appears correct only on the top part of the mesh.
(This post was last modified: 06-14-2014 02:26 AM by SamerK.)
06-14-2014 01:17 AM
Find all posts by this user Quote this message in a reply
Biga Offline
Member

Post: #4
RE: Water/Ocean shader usage?
thanks, my problem is EE2 tutorial has no water chapter, at least I didnt find.

I tried to create these objects, but I assume I miss more things to display water... Created a water material as asset and created a watermesh:

PHP Code:
WaterMtrlPtr wt WaterMtrlPtr("2o-yf-_4jva6sabp#ovq1z3a");
   
WaterMesh water_mesh;
   
water_mesh.create(Earth.mesh->parts(0).basetrue3wt); 

I have to call sth to draw it anywhere? Or I must have WaterCtrl as my watermaterial? Im confused about usage.
I have no World object, only the mesh, and maybe World would make the drawing of waters in that case...

if I set Water.draw = true, my whole mesh is under water and waving, and not only the surface is water... (I assume Water is a "global" plane water, so not useful for me.)
(This post was last modified: 06-14-2014 11:44 AM by Biga.)
06-14-2014 11:14 AM
Find all posts by this user Quote this message in a reply
SamerK Offline
Member

Post: #5
RE: Water/Ocean shader usage?
I think you need to call RM_WATER in renderer i.e,
Code:
switch(Renderer())
      {
         .
         .
         case RM_WATER:
         {

            water_mesh.draw();
            Water.update(Vec2(0.001, 0.005));
            
         }  break;

         .
          .
(This post was last modified: 06-14-2014 03:49 PM by SamerK.)
06-14-2014 02:09 PM
Find all posts by this user Quote this message in a reply
Biga Offline
Member

Post: #6
RE: Water/Ocean shader usage?
yeah but Water is a large planar water surface, doesnt work for my sphere, I include a screenshot why it isnt useful for my purpose. I need the EE water shader working on my sphere surface representing a waving ocean. (The mesh is a earth globe with elevation).

attaching the water material to my mesh sounded good, but how I can render that, and not the planar Water...

   
06-14-2014 02:38 PM
Find all posts by this user Quote this message in a reply
SamerK Offline
Member

Post: #7
RE: Water/Ocean shader usage?
Ok, I missed to mention to draw your water mesh in RM_WATER ( I updated the above code).
For the appearing water plane check in your code if you created
Water.plane.set(...); because this might cause the issue.

however I don't think you will achieve the target effect you are seeking with the existing water shader.
(This post was last modified: 06-14-2014 06:49 PM by SamerK.)
06-14-2014 03:51 PM
Find all posts by this user Quote this message in a reply
Biga Offline
Member

Post: #8
RE: Water/Ocean shader usage?
hm unfortunately water_mesh.draw is uneffective in Render()...
if I use Water.draw = true and Water.update I get the situation above, a large water plane surrounds the planet.
Played also with the depth here, but no result.
water_mesh.create(Earth.mesh->parts(0).base, true, 3, wt);
06-14-2014 08:40 PM
Find all posts by this user Quote this message in a reply
SamerK Offline
Member

Post: #9
RE: Water/Ocean shader usage?
I just made a quick demo , it creates a sphere mesh and then applies water material to it.

download the attached file, create new application in EE tutorial, copy the code, and then add your water material to code

I'm unable to locate the issue of this unneeded plane, perhaps there is plane mesh created in the same Earth basemesh you have ( just an assumption ).

good luck


Attached File(s)
.txt  Watercode.txt (Size: 2.02 KB / Downloads: 26)
(This post was last modified: 06-14-2014 09:34 PM by SamerK.)
06-14-2014 09:30 PM
Find all posts by this user Quote this message in a reply
Biga Offline
Member

Post: #10
RE: Water/Ocean shader usage?
thank you, it works, though - of course - makes water the entire sphere. I need apply that only to oceans/seas.
we have the source license, so maybe I have to alter the source to allowing water only on certain areas identified for example with a watermask.
depends of course, if license permits that, that I could use the EE watershader for my purposes or it is not allowed, so would be fine if Esenthel can respond to this question.
thank you again,
Gabor

   
06-17-2014 08:03 PM
Find all posts by this user Quote this message in a reply
SamerK Offline
Member

Post: #11
RE: Water/Ocean shader usage?
I have an idea that might interest you, first make your sea material transparent in the earth mesh you have, then add same earth mesh size sphere(or little smaller to avoid overlapping) to be the last mesh-part of the main earth mesh, afterwards apply water material to it. while rendering, you can make the camera to view the top side of the earth, and then rotate the earth mesh part(s) only with out the sea sphere.
(This post was last modified: 06-17-2014 08:55 PM by SamerK.)
06-17-2014 08:50 PM
Find all posts by this user Quote this message in a reply
Post Reply