Sky render performance, horrible!

Nov 10, 2007 at 5:25 AM
Seriously I had no idea how horrible it was.

Let me put it into perspective.....

Rendering a single skydome with a single texture and only a few hundred polys takes 4 times more time than a Medium LOD 1024x1024 terrain with multitexturing and normal mapping....


If anyone else would like to test this simply comment out all components other than input and camera, and then leave in the sky component, and then leave in only the terrain component....and compare.
Nov 10, 2007 at 5:30 AM
Seems part of this is setting 4 renderstates simply to allow for skydome layering (multiple skydomes).

Another part of this is that we're changing the projection matrix far plane and creating a new projection matrix, then were setting the far plane back.

Finally, we're setting the fog density renderstate lower for the sky (because of its distance), and then setting it back to default after rendering the sky.

Even after removing all of this the sky still takes up 30-50% longer to draw than terrain. The terrain should be costing much much more than the sky.
Nov 10, 2007 at 5:37 AM
If I limit it down to this, it draw time becomes close to the terrains. But again, these should not even be close...

WorldMatrix = Matrix.CreateScale(Scale)
* Matrix.CreateFromYawPitchRoll(Rotation.X, Rotation.Y, Rotation.Z)
* Matrix.CreateTranslation(CurrentCam.position - ElevationPosition);

foreach (ModelMesh mesh in this.Model.Meshes)
foreach (BasicEffect effect in mesh.Effects)
effect.View = ViewMatrix;
effect.Projection = ProjectionMatrix;
effect.World = WorldMatrix;
effect.Alpha = Opacity;
Nov 15, 2007 at 6:52 AM
I've setup the skydome to use HLSL rather than basiceffect and the performace difference is quite a bit, rendering time for the sky is less than 1/10th of what it was. Still working on getting the lighting of the dome to work nicely though.