Dice and collsion
Re: Dice and collsion
Hi The_Glitch,
I posted the link on the first page, but to save you looking here it is
http://www.asimoventerprises.co.uk/test/grenade.zip
I posted the link on the first page, but to save you looking here it is
http://www.asimoventerprises.co.uk/test/grenade.zip
Re: Dice and collsion
Hi All,
I just emailed the guy who wrote the plugin I was using to export x files. His name is Alin. Anyway here is what he said, and I will be attempting to get the new version of this plugin tonight when I go home.
I just emailed the guy who wrote the plugin I was using to export x files. His name is Alin. Anyway here is what he said, and I will be attempting to get the new version of this plugin tonight when I go home.
This bug is fix in version 2.1.1, now it can export all textures in a standard material. Some needs to pay attention:
1. Normal mapping needs tangents but the current Irrlicht engine cannot load tangents directlly from x file even you export it with option "Tangent" and "Binormal" , you need this code to generate tangents for a mesh:
((scene::ISkinnedMesh*)mesh)->convertMeshToTangents();
2. The Irrlicht loader will simply set the material type to video::EMT_LIGHTMAP when it parse 2 textures in a material, so you need correct it,
for example:
scene::IMeshBuffer* mb = mesh->getMeshBuffer(0);
if (mb)
{
video::SMaterial& mt = mb->getMaterial();
mt.MaterialType = video::EMT_NORMAL_MAP_SOLID;
}
3. The Irrlicht engine use left-handed system, so you shoud uncheck this option "Right-handed"
IF your project can work with this new version please notify me so I can rebuild the final version.
Re: Dice and collsion
Thanks for the info. First 2 points are stuff I tried in my example (the outcommented lines). But I think createMeshWithTangents just doesn't create the correct tangents - which is why I switched to using the obj file. I'm not sure if it can do that automatically or if the x-loader has to be adapted. Fixing x-loader would be the correct way to go if we can find someone to code it...
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Dice and collsion
Are you saying that createMeshWithTangents doesn't work? Or is it not given the right information? I can attest that the function performs correctly. Maybe you need to set the flag to enable it to create normals as well.
Re: Dice and collsion
I say that with the given model and the code I posted above it looks wrong. I'm not much familiar with normalmaps, so I can't tell what's wrong by looking at it.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Dice and collsion
Hi all,
My normalmap problems are over. I have solved it, with a little bit of help heh heh.
There are no seams and it looks as good as it will under the current shader. Obviously a shader could make it look better, as I could add specular colour too, which would make it more realistic, but it is good enough for me to carry on with the game.
Here is the answer. Well the main answer is the new exporter that Lalin sent me. Although that didn't do it on it's own. The little bit of code he sent me helped as well. I put that in my LoadManager class and it worked. The great thing is. I don't have to load the textures. It is in the x file now eg Below is a small snippet from inside the x file
Ok here is my function from my LoadManager class to load my model. Obvioiusly I would use a different function for animation.
Ignore the camera bit, that isn't needed except in my game.
And here is a screenshot. showing many different angles.
Sorry they are small, but I can guarantee the model is perfect
Now the problem with the shadows still occur, but I believe this is a separate problem. Sometimes if you move the grenade under the light in a certain position you get strange squares, but apart from that it works.
Now I have another question. Seeing an x file is just text. Would it be possible to put that said text inside the program, and load the model from that?
I don't need to do this yet, but this way the model would be embedded in the exe. I mean if it can read it from a file, it should be possible.
My game is only small and will have very few models, so it would be a bonus to keep them in the exe itself.
Anyway I hope another beginner like myself finds this post and is able to get their models to load in, and thanks for the all the help CuteAlien.
PS. You can get the Lalin Axe exporter from here, but I would wait a bit as the bugfixed version isn't available yet.
http://www.cgdev.net/download.php
PPS. You may have noticed I have now finished the Tomopoly board. Everything you see on that board I have drawn in illustrator.
My normalmap problems are over. I have solved it, with a little bit of help heh heh.
There are no seams and it looks as good as it will under the current shader. Obviously a shader could make it look better, as I could add specular colour too, which would make it more realistic, but it is good enough for me to carry on with the game.
Here is the answer. Well the main answer is the new exporter that Lalin sent me. Although that didn't do it on it's own. The little bit of code he sent me helped as well. I put that in my LoadManager class and it worked. The great thing is. I don't have to load the textures. It is in the x file now eg Below is a small snippet from inside the x file
Code: Select all
TextureFilename {
"Diffuse.tga";
}
TextureFilename {
"nrm.tga";
}
Code: Select all
void LoadManager::loadPiece(ISceneManager* smgr,IVideoDriver* driver,const wchar_t* modelname)
{
mesh = smgr->getMesh(modelname);
((scene::ISkinnedMesh*)mesh)->convertMeshToTangents();
scene::IMeshBuffer* mb = mesh->getMeshBuffer(0);
if (mb)
{
video::SMaterial& mt = mb->getMaterial();
mt.MaterialType = video::EMT_NORMAL_MAP_SOLID;
}
node = smgr->addMeshSceneNode(mesh);
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, true);
node->addShadowVolumeSceneNode();
}
camera = smgr->addCameraSceneNode(node,vector3df(0, 60, 0));
camera->bindTargetAndRotation(true);
camera->setTarget(node->getPosition());
}
And here is a screenshot. showing many different angles.
Sorry they are small, but I can guarantee the model is perfect
Now the problem with the shadows still occur, but I believe this is a separate problem. Sometimes if you move the grenade under the light in a certain position you get strange squares, but apart from that it works.
Now I have another question. Seeing an x file is just text. Would it be possible to put that said text inside the program, and load the model from that?
I don't need to do this yet, but this way the model would be embedded in the exe. I mean if it can read it from a file, it should be possible.
My game is only small and will have very few models, so it would be a bonus to keep them in the exe itself.
Anyway I hope another beginner like myself finds this post and is able to get their models to load in, and thanks for the all the help CuteAlien.
PS. You can get the Lalin Axe exporter from here, but I would wait a bit as the bugfixed version isn't available yet.
http://www.cgdev.net/download.php
PPS. You may have noticed I have now finished the Tomopoly board. Everything you see on that board I have drawn in illustrator.
Re: Dice and collsion
It's possible to load meshes from memory - so you can put it into the source. If you check the ISceneManager::getMesh() function you'll see it has an overload which takes a irr::io::IReadFile*and IFileSystem has a function createMemoryReadFile. In theory the same can be used for textures by appending them to the exe, but probably some work.
The problem with shadows and lights might be when the camera is between the light-origin and the model. I think the shadow calculations have a problem with that.
And glad you found a solution :-) It would be nice if you could put the new exported model also online (not having 3DMax I can't test the exporter myself, but it's always nice to have more test-models - maybe we can fix the loader with it at some point so people don't have to fix the mesh after loading anymore one day).
The problem with shadows and lights might be when the camera is between the light-origin and the model. I think the shadow calculations have a problem with that.
And glad you found a solution :-) It would be nice if you could put the new exported model also online (not having 3DMax I can't test the exporter myself, but it's always nice to have more test-models - maybe we can fix the loader with it at some point so people don't have to fix the mesh after loading anymore one day).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Dice and collsion
Hi CuteAlien,
I don't finish work until 5pm though
When I get home from work I will put a link to the model.It would be nice if you could put the new exported model also online (not having 3DMax I can't test the exporter myself, but it's always nice to have more test-models - maybe we can fix the loader with it at some point so people don't have to fix the mesh after loading anymore one day).
I don't finish work until 5pm though
-
- Competition winner
- Posts: 523
- Joined: Tue Jan 15, 2013 6:36 pm
Re: Dice and collsion
Okay after my test I exported the model with my exporter in max. Redid the uvs to be on the safe side. I loaded the DirectX file format model and applied one of my shaders and it seems to be working fine to me. So I have to agree with mongoose7 above:
@Asimov
I also noticed in your file when you load it in max you have a normal map applied in the bump slot. If your going to do export for Irrlicht only have the diffuse map applied. You just load your normal map separate in Irrlicht like any other texture, the exporter does not need it.
@Asimov
I also noticed in your file when you load it in max you have a normal map applied in the bump slot. If your going to do export for Irrlicht only have the diffuse map applied. You just load your normal map separate in Irrlicht like any other texture, the exporter does not need it.
Re: Dice and collsion
Hi The_Glitch,
Nice specular on the grenade. I believe your glow effect is post processed. Looks like the tv camera shader in max. Sometimes you get glows which are not meant to glow, based on the brightness of the material heh heh.
I really must find the time to learn shaders LOL.
Been to busy to do much with irrlicht the last week, cos I had my head buries in php and jquery programming doh.
PS. Here is the new model export CuteAlien
http://www.asimoventerprises.co.uk/test/grenade_nrm.zip
Nice specular on the grenade. I believe your glow effect is post processed. Looks like the tv camera shader in max. Sometimes you get glows which are not meant to glow, based on the brightness of the material heh heh.
I really must find the time to learn shaders LOL.
Been to busy to do much with irrlicht the last week, cos I had my head buries in php and jquery programming doh.
PS. Here is the new model export CuteAlien
http://www.asimoventerprises.co.uk/test/grenade_nrm.zip
Re: Dice and collsion
Hi CuteAlien,
Just a question. Yes I got an X file to work with normalmaps so I thought I would try an obj.
My whole scene is loaded as one obj(apart from the grenade and houses, and pieces), and I thought I would try the same code that worked with the x file.
Strangely when I use the following line on an obj it crashes.
but works fine with the x file eg the grenade.
Is there an alternative to the above line that will work with an obj?
I know I could load my whole scene as an x file but here is the problem. The scaling of x files are different to obj, and I have my scene all set up like I want.
I know how to scale, but the chances of me getting it exactly the same size is remote heh heh.
Just a question. Yes I got an X file to work with normalmaps so I thought I would try an obj.
My whole scene is loaded as one obj(apart from the grenade and houses, and pieces), and I thought I would try the same code that worked with the x file.
Strangely when I use the following line on an obj it crashes.
Code: Select all
((scene::ISkinnedMesh*)mesh)->convertMeshToTangents();
Is there an alternative to the above line that will work with an obj?
I know I could load my whole scene as an x file but here is the problem. The scaling of x files are different to obj, and I have my scene all set up like I want.
I know how to scale, but the chances of me getting it exactly the same size is remote heh heh.
-
- Competition winner
- Posts: 523
- Joined: Tue Jan 15, 2013 6:36 pm
Re: Dice and collsion
Actually the glow effect is controlled by my materials alpha channel. I just did a quick test for the normal mapping test. You can fine tune any materials in my setup.
If you want a normal mapping shader let me know?
Also did you get the simple shader and setup I posted before up and going?
Also an obj file is not a skin mesh type that's why it crashes.
If you want a normal mapping shader let me know?
Also did you get the simple shader and setup I posted before up and going?
Also an obj file is not a skin mesh type that's why it crashes.
Re: Dice and collsion
Hi The_Glitch,
Yes I would love to try your normalmap shader, but I am having trouble with a simple shader at the moment.
It is all go here heh heh.
Ahh Unity loads it's lightmaps by using the alpha channel also. Which is great until you want to use the alpha channel for tranparency.Actually the glow effect is controlled by my materials alpha channel. I just did a quick test for the normal mapping test. You can fine tune any materials in my setup.
I replied to your post in the other thread. It crashed in a big way and I posted my code. I have a sneaking suspicion I have done something wrong LOL.If you want a normal mapping shader let me know?
Also did you get the simple shader and setup I posted before up and going?
Yes I would love to try your normalmap shader, but I am having trouble with a simple shader at the moment.
I didn't know what a skin mesh was heh heh. So I have two optons. Not bother with normalmaps in my room, which is a shame, or re-export it as an x file and spend ages scaling it so that it is the same size as my obj LOL.Also an obj file is not a skin mesh type that's why it crashes.
It is all go here heh heh.
-
- Competition winner
- Posts: 523
- Joined: Tue Jan 15, 2013 6:36 pm
Re: Dice and collsion
If you are use to 3ds max then you shouldn't have no problem with scale at all.
I'll check that other thread.
I'll check that other thread.
Re: Dice and collsion
Hi Glitch,
I am not saying it is impossible to match the scale, but pretty damn hard.
You mis-understand. I could easily scale it in max, but I already have my scene set up in irrlicht with an obj. I could scale it in max to match the x file, or scale it in irrlicht to match the x file. The problem is how much to scale it? It would be by trial and error at best, and I have all my houses setup on the board already, and coordinates noted. So the getting the scale to match my x file would be extremely hard, and I also have my cameras joined to the room node also for rotation.If you are use to 3ds max then you shouldn't have no problem with scale at all.
I am not saying it is impossible to match the scale, but pretty damn hard.