Hello again. I am trying to modify the 1st tutorial to load an md2 model, then once the model is loaded change it from containing 1 set of texture coords to 2. I am just attempting to see if its possible, the second set of texture coords will just be a duplicate copy of the first (using a for loop to set them all), but I cant seem to locate a command to change the vertex type.
I have set the material type of the AnimatedMeshSceneNode to Lightmap, and loaded a secondary texture into the node. However when I check to see what the mesh buffers vertex type is, it is still not T2Coords, so I cant add the second set into the buffer. Any suggestions??
How to change a mesh buffers vertex type??
-
gamebeavis
- Posts: 12
- Joined: Mon Jun 25, 2007 11:45 pm
-
gamebeavis
- Posts: 12
- Joined: Mon Jun 25, 2007 11:45 pm
-
hybrid
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
.md2 has only one set of texture coords. When changing to LIGHTMAP materials there is no automatic conversion to a different meshbuffer. This has to be done explicitly. And finally, if the material is working then it is due to the texture coords being the same as the ones for the first texture. May work, but don't rely on that one.
-
gamebeavis
- Posts: 12
- Joined: Mon Jun 25, 2007 11:45 pm
Ok, so then I guess it might be a bug... You can test it for yourselves, just load the Sydney model that comes with the tutorials and add a light map texture to her (black and white strips works well enough).
So, back to my original question. How do you "explicitly" load a character with 2 sets of texture coords. Does it have to be a model format that already uses them (if so, what formats support that?), or can it simply be called to duplicate the 1st set and change them during runtime??
NOTE: I am not using pure irrlicht. I am using the irrlicht .netCP wrapper. But I dont think that would be the cause here. Since I dont have the ability to compile c++ at work, maybe someone would be willing to test and see if adding a second texture to the c++ tutorial does the same thing...
So, back to my original question. How do you "explicitly" load a character with 2 sets of texture coords. Does it have to be a model format that already uses them (if so, what formats support that?), or can it simply be called to duplicate the 1st set and change them during runtime??
NOTE: I am not using pure irrlicht. I am using the irrlicht .netCP wrapper. But I dont think that would be the cause here. Since I dont have the ability to compile c++ at work, maybe someone would be willing to test and see if adding a second texture to the c++ tutorial does the same thing...
-
hybrid
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
There are models which support lightmaps. These are loaded with the proper vertex structure chosen such that the second set of texture coords is available. Otherwise you have to copy the mesh by replacing all vertices with the S3DVertex2T structure. You can then put the proper coords into the new attributes. There is only a method for converting into tangent meshes, though, so you have to do it manually.
I think I added some confusion to the mix. I thought that beavis was saying that the 2nd set of tcoords were not getting read in. Obviously I was misreading what he was saying.
As hybrid is trying to say, you can allocate a new mesh buffer of the right type [SMeshBufferLightMap] and then copy the vertex data from the existing mesh buffer. Once you've got a replacement vertex buffer you just need to remove the old one from the mesh and add the new one in there.
Travis
As hybrid is trying to say, you can allocate a new mesh buffer of the right type [SMeshBufferLightMap] and then copy the vertex data from the existing mesh buffer. Once you've got a replacement vertex buffer you just need to remove the old one from the mesh and add the new one in there.
Travis
-
gamebeavis
- Posts: 12
- Joined: Mon Jun 25, 2007 11:45 pm
I cant seem to locate SMeshBufferLightMap in the API reference anywhere. Does that still exist??
Maybe the easiest course of action here is simply using a file format that loads into irrlicht natively with 2 sets of texture coords. I normally use milkshape, but I dont think it can generate 2 sets of coords. I think .x does?? Anyone know for sure?
Maybe the easiest course of action here is simply using a file format that loads into irrlicht natively with 2 sets of texture coords. I normally use milkshape, but I dont think it can generate 2 sets of coords. I think .x does?? Anyone know for sure?