1
votes

I've been working on a project that helps create a virtual reality experience on the laptop and/or desktop. I am using XNA 4.0 on Visual Studio 2010. The current scenario looks like this. I have interfaced the movements of a persons head through kinect. So if the person moves his head right relative to the laptop, the scene seen in the image is rotated towards the left giving the effect of a virtual tour or like looking through the window experience.

To enhance the visual appeal, I want to add a darkness at the back plane. Like the box looks as if it was a tunnel.

The box was made using trianglestrips. The BasicEffect used for the planes of the box is called effect.

effect.VertexColorEnabled = true;
        effect.EnableDefaultLighting();
        effect.FogEnabled = true;
        effect.FogStart = 35.0f;
        effect.FogEnd = 100.0f;
        effect.FogColor = new Vector3(0.0f, 0.0f, 0.0f);
        effect.World = world;
        effect.View = cam.view;
        effect.Projection = cam.projection;

Scene

On compiling the error is regarding some normals. I have no clue what they mean by that. I have dug the internet hard enough. (I was first under the impression that ill put a black omnilight in the backside of the box).

The error is attached below: Error

'verts' is the VertexPositionColor [][] that is used to build the box.

How do I solve this error ? Is the method/approach correct ?

Any help shall be welcome. Thanks.

2

2 Answers

1
votes

Your Vertex has Position and Color channels, but is has no normals... so you have to provide vertex has it.

You can use VertexPostionNormalTexture if you don't need the color, or build a custom struct that provides the normal...

Here your are a custom implementation: VertexPositionNormalColor

0
votes

You need to add a normal (vector3) to your vertex type.

Also if you want Distance fog you will have to write your own shader as BasicEffect only implements depth fog (which while not looking as good is faster)