Can get the vertex data from ModelData?

Mar 17, 2010 at 6:40 AM


I tried Picking Sample on Xen. (

This sample used triangle data from model data. Can get the vertex data from ModelData on Xen?


More question. I tried Shadow mapping on Tutorial 25. but shadow drawer on my game, light is too bright.

this is capture shot

Wall on background is too bright. Stone walls are almost white. I want shadow, but too bright light does not require.


Mar 17, 2010 at 11:29 AM

The XNA content pipeline only provides a raw data array for your model, which makes extracting triangles (etc) quite tricky.

Currently, the raw data isn't exposed. What I'd suggest, is modify the GeometryData class in it's internal ContentReader constructor. If you look in there (approx line 1060 in ModelContent.cs) you can see at one point it does:

byte[] data = reader.ReadBytes(count);
this.vertices = Vertices<byte>.CreateRawDataVertices(data, vertexElements);

If you store the raw byte data in the GeometryData class then you can access it later. The same for the indices (although they are a bit more complex, as they are stored in 8, 16 or 32 bit.

Mar 17, 2010 at 2:24 PM

I edited GeometryData class, and it works fine.

Thanks StatusUnknown.