[SOLVED] Same mesh with different color
[SOLVED] Same mesh with different color
Hi what is the best way to have the same mesh with different color. I create my mesh in blender but I need to create different instance of the same mesh with different color (for example I have a cube and I want to create a red cube a blue cube and so on)
What is the best and fast way?
Thanks a lot.
regards
Tranen
What is the best and fast way?
Thanks a lot.
regards
Tranen
Last edited by Tranen on Fri Feb 19, 2010 1:52 pm, edited 1 time in total.
I'm sorry if it's a stupid question, but i'm a bit confused.
I don't want to load the mesh n times.
I want to export my mesh from blender and load it then share the mesh definition (maybe SSharedMeshBuffer?)
It is possible to use the same Mesh to create multiple objects whit different colors?
How can I do that? using n texture, mofifying the vertex color?
Thanks
Tranen
I don't want to load the mesh n times.
I want to export my mesh from blender and load it then share the mesh definition (maybe SSharedMeshBuffer?)
It is possible to use the same Mesh to create multiple objects whit different colors?
How can I do that? using n texture, mofifying the vertex color?
Thanks
Tranen
-
- Posts: 237
- Joined: Mon Jan 16, 2006 1:18 pm
- Location: Odessa,Russian Federation
Hello there guys.
I got almost the same question.
Look at the shot.
It is a mesh with 3 different materials.There is no maps on them just colors.
How can i change each of the colors??
I've tried
getMaterial(0).DiffuseColor.set(0,255,0,0);
and
getMaterial(0).AmbientColor.set(0,255,0,0);
with all 3 materials and
meter->setMaterialFlag(EMF_LIGHTING, true\false);
The color in material is changing, i've checked... but the image stays the same....
I've also tried to set the vertex colors, it worked but it sets all the colors in the mesh, when i need to change 3 materials separate.
And BTW. I've checked the colors in the materials before the change... they 100% correspond to those we see on picture, but after the change the colors do not correspond to the picture.
Hi Hybrid, my problem is that I create an object in blender and import it into irrlicht (the format is obj):
and I want to make n instances of this objects with different color:
I'have done this in irredit cloning the object and setting different values of emissive color after enable the lighting on the object. I guess I can do this also changing vertex color or assigning a diffenent texture to every object.
There is another/better way to do this?
Is possible to store just once the vertex coordinates for all the objects since they are always the same?
Thanks for your patience and help.
Cheers
Tranen
and I want to make n instances of this objects with different color:
I'have done this in irredit cloning the object and setting different values of emissive color after enable the lighting on the object. I guess I can do this also changing vertex color or assigning a diffenent texture to every object.
There is another/better way to do this?
Is possible to store just once the vertex coordinates for all the objects since they are always the same?
Thanks for your patience and help.
Cheers
Tranen
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Tranen, if you do so in irrEdit, you should also be able to do so in Irrlicht. You can simply instantiate as many mesh scene nodes with the same mesh as you want. If you set the hardware mapping hint of that mesh to EHM_STATIC, it's also not uploaded to the GPU for each node, but only once. Using a color material for the coloring is pretty cheap, so it's a good idea.
-
- Posts: 237
- Joined: Mon Jan 16, 2006 1:18 pm
- Location: Odessa,Russian Federation
-
- Posts: 237
- Joined: Mon Jan 16, 2006 1:18 pm
- Location: Odessa,Russian Federation
Really? ))
irr::scene::IMeshManipulator::setVertexColors' : cannot convert parameter 1 from 'irr::scene::IMeshBuffer *' to 'irr::scene::IMesh *'
I'm doing it like this:
Doc says:
virtual void irr::scene::IMeshManipulator::setVertexColors ( IMesh * mesh,
video::SColor color ) There is only one method.... and it is for IMesh*
irr::scene::IMeshManipulator::setVertexColors' : cannot convert parameter 1 from 'irr::scene::IMeshBuffer *' to 'irr::scene::IMesh *'
I'm doing it like this:
Code: Select all
Core.smgr->getMeshManipulator()->setVertexColors(meter->getMesh()->getMeshBuffer(0),(0,255,0,0));
virtual void irr::scene::IMeshManipulator::setVertexColors ( IMesh * mesh,
video::SColor color ) There is only one method.... and it is for IMesh*
-
- Posts: 237
- Joined: Mon Jan 16, 2006 1:18 pm
- Location: Odessa,Russian Federation