help! obj model display not correct in irrlicht
help! obj model display not correct in irrlicht
The same obj file, it display perfect in Deep Exploration, but not correct in Irrlicht, I don't know what's the reason, someone can give me some advice? thanks.
In Deep Exploration
In Irrlicht
In Irrlicht by set material to EMT_TRANSPARENT_ALPHA_CHANNEL
[/img]
In Deep Exploration
In Irrlicht
In Irrlicht by set material to EMT_TRANSPARENT_ALPHA_CHANNEL
[/img]
yeah thats bc the meshbuffer of the books is drawn before the shelve...
u should not set material emt_transparent on the whole object.
u should not set material emt_transparent on the whole object.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
The whole transparent version used only to comparison, the transparent effect is perfect but not correct.
I uploaded the model, download here
http://www.soft5a.com/ym/files/Archive.zip
Here is a normal rendering, I marked the errors by red.
I uploaded the model, download here
http://www.soft5a.com/ym/files/Archive.zip
Here is a normal rendering, I marked the errors by red.
Last edited by ym1218 on Wed Jul 01, 2009 1:55 am, edited 1 time in total.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The chariot seems to lack back faces. Sinc .obj does not handle backface culling, you'll have holes instead of faces on the inside. You can disable backface culling on your mesh, which should help already. However, there seems to be some transparent materil on the chariot as well, which does not look correct. Don't know what would be intended and why it uses transparency at all, maybe some wrong material assignment?
I couldn't reproduce the problem with the drink glasses.
I couldn't reproduce the problem with the drink glasses.
I personally find that forcing ZWriteEnable does help in these cases.
You'll have to get the scene parameters using ISceneManager::getParameters(), and then set the Allow Z Write Enable on Transparent setting to true.
The issue with this is that you have to manually set this on all transparent materials that need to disable ZWrite to false.
What sudi was trying to say is that you should split the mesh into seperate meshbuffers, the transparent parts and solid parts, and this should save you a lot of trouble. You may still need to enable ZWrite in certain situations though.
You'll have to get the scene parameters using ISceneManager::getParameters(), and then set the Allow Z Write Enable on Transparent setting to true.
The issue with this is that you have to manually set this on all transparent materials that need to disable ZWrite to false.
What sudi was trying to say is that you should split the mesh into seperate meshbuffers, the transparent parts and solid parts, and this should save you a lot of trouble. You may still need to enable ZWrite in certain situations though.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Thanks for all replies.
I've disabled backculling, the chariot looks correct now, but the transparent effect is not good as I expect.
I need to get a similar render effect like Deep Exploration, but I donnot konw how to adjust irrlicht, I hope someone can give me some advices about this.
Here is the new snapshot.
I've disabled backculling, the chariot looks correct now, but the transparent effect is not good as I expect.
I need to get a similar render effect like Deep Exploration, but I donnot konw how to adjust irrlicht, I hope someone can give me some advices about this.
Here is the new snapshot.
Thanks for your reply, but disable ZWite doesnot work.
It's a obj file, I want to iterate all the children nodes but found it has no children nodes, do you have another method to split the mesh except using getChildren() method?
It's a obj file, I want to iterate all the children nodes but found it has no children nodes, do you have another method to split the mesh except using getChildren() method?
BlindSide wrote:I personally find that forcing ZWriteEnable does help in these cases.
You'll have to get the scene parameters using ISceneManager::getParameters(), and then set the Allow Z Write Enable on Transparent setting to true.
The issue with this is that you have to manually set this on all transparent materials that need to disable ZWrite to false.
What sudi was trying to say is that you should split the mesh into seperate meshbuffers, the transparent parts and solid parts, and this should save you a lot of trouble. You may still need to enable ZWrite in certain situations though.
na i meant that when the mesh is loaded their is a meshbuffer for every material. But when u use setMaterialType with the scenenode all meshbuffers use the same material. that is not good when the material is not transparent.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
The material difference is due to your bump mapping. Try to remove the bump settings in the material file. This should come in a later step, as there's currently no way to get a proper bumpmap import with the values you set in oyur modelling tool. Some values are simply fixed to a value which might be improper for the current mesh.
The glass seems to have a high specular value with very low shininess, such that the brightness is far too high. Try to set shininess to 0 (to disable it for now). Also make sure that you set normalize_normals when scaling your mesh, because all lighting equations depend on proper normals.
The glass seems to have a high specular value with very low shininess, such that the brightness is far too high. Try to set shininess to 0 (to disable it for now). Also make sure that you set normalize_normals when scaling your mesh, because all lighting equations depend on proper normals.
I just tried it and it helps (Btw I said to enable ZWrite, not disable...), see the difference (With all materials set to EMT_TRANSPARENT_ALPHA_CHANNEL):Thanks for your reply, but disable ZWite doesnot work.
The important thing to notice is that the books are not incorrectly behind the cabinet wood, and the cabinet glass is correctly behind the cabinet wood.
You have to do this:
Code: Select all
smgr->getParameters()->setAttribute(ALLOW_ZWRITE_ON_TRANSPARENT, true);
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Hybrid, thanks you for your help, but the render quality is more important than speed for me in this project.
All the objects displayed in screen is one whole model, I donnot know how to change the bull's material separately. My project is a 3D Viewer, this means I cannot modify the model.
I wanted using ISceneNode's getChildren method to get the childs nodes, but I found this model has no child.
All the objects displayed in screen is one whole model, I donnot know how to change the bull's material separately. My project is a 3D Viewer, this means I cannot modify the model.
I wanted using ISceneNode's getChildren method to get the childs nodes, but I found this model has no child.
hybrid wrote:Try to use a SOLID material for the bull, this will render this one first, and hence get the correct impression. Using a transparent material on things which are not using any transparent effect will only slow down the rendering.
Thanks for all.
Here is the core code:
Here is the newest snapshot, it seems better.
Here is the core code:
Code: Select all
m_smgr->getParameters()->setAttribute(ALLOW_ZWRITE_ON_TRANSPARENT, true);
m_scenenode->setMaterialFlag(EMF_BACK_FACE_CULLING,false);
for(u32 i = 0;i<m_scenenode->getMaterialCount(); i++)
{
switch(m_scenenode->getMaterial(i).MaterialType)
{
case EMT_TRANSPARENT_VERTEX_ALPHA:
m_scenenode->getMaterial(i).MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL;
break;
default:
break;
}
}