Dad72
March 27, 2020, 12:45am
1
Hello,
If I add the ground (CreateGroundFromHeightMap() ) that has been optimized with ground.optimize() then added to the reflection of the water (addToRenderList(ground) ), it creates this problem : Error property ‘0’ of undefined. I get a black screen
In this PG and uncomment line 77 :
https://www.babylonjs-playground.com/#1DFTDT#11
Thanks
inteja
March 27, 2020, 2:01am
2
@Dad72 I wasn’t seeing any console error when running your PG?
But that ground has 20 submeshes so I do get a different result with:
ground.getChildMeshes(true).forEach(m => waterMaterial.addToRenderList(m));
See: https://www.babylonjs-playground.com/#1DFTDT#15
Is this result what you intended?
1 Like
Dad72
March 27, 2020, 12:07pm
3
Yes, that seems to solve the problem. I did not think about this solution. Thank you
I don’t quite understand, the ground has no child meshes: sub meshes of a mesh are not children of this mesh (they are “part” of it).
So ground.getChildMeshes() returns an empty array…
Dad72
March 27, 2020, 4:06pm
5
I think it’s due to the use of ground.optimize (20)
In any case, that solved the problem with that :
ground.getChildMeshes(true).forEach((m) => waterMaterial.addToRenderList(m));
Dad72
March 27, 2020, 4:08pm
6
In fact you are right, that did not solve it, but just that does not add the world to the reflection of water.
@Deltakosh So the bug is still there
https://www.babylonjs-playground.com/#1DFTDT#11
Piniging @julien-moreau who is the Watermaterial author
Dad72
March 27, 2020, 5:06pm
9
Yes, that solves the problem, Thanks @Evgeni_Popov .
For the fog, it work in part, but I have a problem with the shadows afterwards.