Post Process Water Custom Shape(Rectangle)

Is it possible to make the Post Process Water(The Limited one) Be rectangle instead of a perfect square? or make it oval?
It would be great other wise if we could shape it(Basic shape).

It could help me with my water problem haha… xD

Well, it’s not possible with the built in Filter. You can modify the shader though and have your own.

1 Like

Ok thank you, again xD

Somebody was already working on this, I believe… I hunted down the post for you

Hopefully that helps

Hi. I made this a while ago that lets you send an array of vertices to the shader so that you can have exactly the shape you want: http://hub.jmonkeyengine.org/forum/topic/jme3-water-effect-on-arbitrary-shapes-polygons-diy-version-d/

2 Likes
@.Ben. said: Hi. I made this a while ago that lets you send an array of vertices to the shader so that you can have exactly the shape you want: http://hub.jmonkeyengine.org/forum/topic/jme3-water-effect-on-arbitrary-shapes-polygons-diy-version-d/

Wow thank you :smiley:

No problem. BTW, try not to put more than 2-3 lakes per scene, because remember that every lake you put is multiplied by 2 different render passes and the reflection REALLY kills the FPS. Like a scene without any lake let’s say runs at 200fps, if you put 1 lake, it drops to 150fps, if you put 2 lakes, it drops to like 50fps and 3 lakes kills it completely down to like 10fps. So make sure you do not abuse this! :smiley:

It depend is it the same fps drop as the normal WaterPostProcess? If so i shouldnt have any problem with the fps. (The waterpostprocess doesnt seem to be my problem of fps lol) xD

@.Ben. said: No problem. BTW, try not to put more than 2-3 lakes per scene, because remember that every lake you put is multiplied by 2 different render passes and the reflection REALLY kills the FPS. Like a scene without any lake let's say runs at 200fps, if you put 1 lake, it drops to 150fps, if you put 2 lakes, it drops to like 50fps and 3 lakes kills it completely down to like 10fps. So make sure you do not abuse this! :D
mhhh... this could be optimized... You don't need one reflection map for each lake... Maybe I should extract the reflection render and find a way to mutualize it for several pools...
2 Likes

Yes obviously, we could pass an array of arrays of vertices (no compatible way of doing this out of the box for all graphics card I think) or something similar (for instance, maybe pass a huge array [!] containing all the vertices arrays merged together and another array containing the array lengths, much like VBO indices I guess) to the shader so that there is only 1 reflection / 1 pass. I did this modification a long time ago and didn’t want to heavily modify the filter because (even today! lol) I didn’t know what I was doing :stuck_out_tongue:

Now that I face the situation, I think it wouldn’t be that hard to do actually.

Do you want to take a shot at it Rémy or should I try?


[!] : The SAFE maximum array length for most graphics cards is 1024 items tough. But that leaves a lot of room to play with. A lake should not exceed what… maybe 8-16 vertices… so you could have like 64 lakes for 1 scene, not too bad actually!

@n3cr0 said: It depend is it the same fps drop as the normal WaterPostProcess? If so i shouldnt have any problem with the fps. (The waterpostprocess doesnt seem to be my problem of fps lol) xD

Same fps drop but multiplied by the number of lakes you have on the scene. On both my nVidia GTX 660 card and Radeon R9 270x card, the fps drops substentially for each lake. It IS one of the most time consuming shader in JME3… but also the most beautiful one IMO! Also, I think it also depends on the number of lights and objects count you have. For instance, 5 lakes with 1 light and 2 cubes on the scene should not take a long time to draw, thus there should be a very high fps compared to 2 lights, 4000 trees, 8000 grass blades, 16 full vertices models, fog filter enabled lol… you get the point :stuck_out_tongue:

@.Ben. said: Yes obviously, we could pass an array of arrays of vertices (no compatible way of doing this out of the box for all graphics card I think) or something similar (for instance, maybe pass a huge array [*!*] containing all the vertices arrays merged together and another array containing the array lengths, much like VBO indices I guess) to the shader so that there is only 1 reflection / 1 pass. I did this modification a long time ago and didn't want to heavily modify the filter because (even today! lol) I didn't know what I was doing :P

Now that I face the situation, I think it wouldn’t be that hard to do actually.

Do you want to take a shot at it Rémy or should I try?


[!] : The SAFE maximum array length for most graphics cards is 1024 items tough. But that leaves a lot of room to play with. A lake should not exceed what… maybe 8-16 vertices… so you could have like 64 lakes for 1 scene, not too bad actually!
--------


I was more thinking the other way around, having a ReflectionFilter in the filter stack before water filters and that any water filter could get a reference to the rendered reflection map of the ReflectionFilter.

@.Ben. said: Same fps drop but multiplied by the number of lakes you have on the scene. On both my nVidia GTX 660 card and Radeon R9 270x card, the fps drops substentially for each lake. It *IS* one of the most time consuming shader in JME3... but also the most beautiful one IMO! Also, I think it also depends on the number of lights and objects count you have. For instance, 5 lakes with 1 light and 2 cubes on the scene should not take a long time to draw, thus there should be a very high fps compared to 2 lights, 4000 trees, 8000 grass blades, 16 full vertices models, fog filter enabled lol... you get the point :P

I will specify, I don’t use reflection haha
I know it’s resource consuming so i just lets it on the side, i don’t think my graphic really need a reflection map.
Anyway I can’t use the actual shader/material you made at the moment, I did try it but I was unable to make it work properly…
I know it s probably me the problem but my waterFilter wasn’t the same as your s when you asked to change some stuff it wasn’t fitting at all on my side. Then the only thing i could see was a circle lake :S. But thank you anyway for the help!