I have a problem that I know what is happening but I don’t know how to get Xenko to solve it. I am hoping someone may be able to point me in the right direction, it might requiring me pinging @xen2 or @Kryptos
I am in the middle of trying to generate terrain for an enhanced flowing water demo. To create the plane I did a literal copy / paste of GeometricPrimitive.Plane.New from the engine’s code itself, with the only change is that I am using the height map to set a Y-Coordinate of the vertex instead of 0.0f, and I calculated my own normals (though I tried using UnitY before posting this).
When the game first loaded I was excited because I got what I expected; a mesh that looks like the heightmap I used, along with simplistic height based texturing.
But then I move around the world and noticed that this is happening:
The water way on the other side is showing through. You can see shadows cast from hills close to the camera, but not the hills themselves. It’s basically rendering far things first, or far things are replacing close things, etc.
I implemented the terrain by:
- Creating an empty entity with a script attached to it,
- The script creates the terrain primitive, an empty model, and a model component.
- Calls primitive.ToMeshDraw() and adds the mesh to the model, and adds the model to the model component.
- Lastly, adds my texture shader to the model, and adds the model to the entity that the script was attached to.
I was hoping that adding it to an entity already in the scene would let me make use of default mesh rendering to handle this sort of thing. I had tried playing with my own custom effect before going this route and was having a hard time getting that working. Now I am sort of lost and frustrated.
Any help would be greatly appreciated!