Jump to content

Multi-camera and WaterMaterial


Dad72
 Share

Recommended Posts

Ok is that the refractive create the problem.

1) Terrain without water =>  60 FPS

ground-no-water.thumb.jpg.07277d55c8b136bed12790390c3634bd.jpg

2) Water without terrain and no refraction => 60 FPS

water-reflexion.jpg.7689e5e8eb6c39437b601769abf159e1.jpg

3) Terrain with water and no reflexion. But with only refraction  => 9 FPS

water_refraction.thumb.jpg.41a81952d81fe3acd959d47bc599fb41.jpg

Link to comment
Share on other sites

Ok, I have put you in a zip everything I use.

I have not rebuilt the scene, but I've put the functions that create the terrain with the .babylon file, The function to create the water and sky. with all images.

I use ShaderBuilder CustomMaterial and also to generate the material on the ground. But I've put all in the zip. 

I tested with a single camera too, but the problem was the same. I thought maybe it was because I use two camera, but no, it is apparently not that.

Link: http://www.babylon.actifgames.com/Water_bug.zip

If you prefer me to build a complete scene, I can also make you if you wish.

Link to comment
Share on other sites

@Dad72 I'm trying to manipulate your code but I always get a black screen :(

Can you try to repro on the playground instead ? The problem should happen if you create a ground with the same number of vertices than your terrain

Or, can you share a link where the scene is working well ? I'll use SpectorJS to debug. Would be awsome if you can put the non-minified files too (I mean water material etc ^^)

Thanks!

Link to comment
Share on other sites

Sorry you receive a black screen. I'll recreate the stage and you provide the zip of the stage. while the files will not be minimifier.

I do not know if I can do it tonight, but promised, tomorrow morning I send you the zip.

Link to comment
Share on other sites

Ok, I recreate the scene. Today I turn to 1 FPS with this scene. I disable refraction, I am a 60 FPS.

I even try with a smaller amount of water by dividing by 2 and same thing. It does not come from the size of the water.

The ground is very large, I had to rescale. It is possible that this comes from too large a ground. But maybe the rescale is not taken into account by the refraction. I do not know what it is, I make only assumptions.

Thank you Luuacro

Link: http://www.babylon.actifgames.com/water.zip

 

Link to comment
Share on other sites

Ok I found, the reflection and refraction textures set a clip plane to save pixel performances. So, the terrain material is dirty (should be replaced by another one for the subMesh). With the standard material, the shader is already in cache. With Custom Material, the ShaderIndexer variable is changed then it is not found in shaders cache -> the material is re-created each frame

@NasimiAsl do you have a solution for that ?

Thanks!!!

Link to comment
Share on other sites

@NasimiAsl Ok, this is compiled. It does not change anything. The FPS are still very low and it seems that refraction is no longer taken into account for water. We should see the sand underwater in refraction. If I disable refraction with the inspector, nothing happens and the FPS does not increase either.

I have a version on PG that I managed to display with a can of difficulty :

You can test it on its links : 

http://www.babylonjs-playground.com/#ICIAGK#6

http://www.babylon.actifgames.com/ 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...