What's the right way in Irrlicht to get picture like this:
Watch surfaces on this picture. Blue, orange and gray.
I need monocolored surfaces. Do I need to use textures, or there's some another way?
Object without texture (like in Solid Works etc)
-
- Posts: 18
- Joined: Wed Feb 27, 2008 2:32 pm
- Location: Russia, Moscow
I believe some model formats will support surface colours, so you shouldn't have to use textures, just pick the right model format. I don't know which do or don't support surface colours so you may have to do some trial and error.
Or if you do end up using textures for the face colours then you can just use a 1x1 pixel texture so it's nice and small and won't use up lots of memory.
Or if you do end up using textures for the face colours then you can just use a 1x1 pixel texture so it's nice and small and won't use up lots of memory.
-
- Posts: 18
- Joined: Wed Feb 27, 2008 2:32 pm
- Location: Russia, Moscow
There is no material in Irrlicht which can render vertex colors with lighting on. So even if you do succeed in importing your model in to irrlicht, or creating your mesh directly, you can't get picture like that one.
You can however render it without light.
Another option is to make your own shader material.
Thats because if lighting is off, vertex color is taken as diffuse color. If lighting is on, only material and light attributes are used to compute diffuse color.
You can however render it without light.
Another option is to make your own shader material.
Thats because if lighting is off, vertex color is taken as diffuse color. If lighting is on, only material and light attributes are used to compute diffuse color.
-
- Posts: 18
- Joined: Wed Feb 27, 2008 2:32 pm
- Location: Russia, Moscow
Solved
Great! Thanks a lot
Where did it showed correctly?Vertex colors and lighting should work. At least with OpenGL it showed up correctly.
Take example n. 03 CustomSceneNode and:
1. delete Material.Lighting = false; in node's constructor or set it to true.
2. add device->getSceneManager()->addLightSceneNode(0, core::vector3df(10,10,-10), video::SColorf(1.0f, 1.0f, 1.0f)); just before while(device->run()){} loop.
Node is plain white, no colors...
Thanks arras!!!
I've been trying to get this to work for awhile now. You are correct, setting only the vertex color (meaning, the .Color member of an S3DVertex) does *not* give you vertex color. You also have to turn off lighting for the material with
If you leave the lighting enabled (default), the vertex color doesn't get applied (at least, this is the case with the OpenGL driver in Irrlicht 1.4 release version) and you end up with just a plain white model. Sure I could have done it with a 1x1 solid color texture, but its nice to know that there is a way to do it right. Seems odd to have to turn off lighting to get vertex color though.
I've been trying to get this to work for awhile now. You are correct, setting only the vertex color (meaning, the .Color member of an S3DVertex) does *not* give you vertex color. You also have to turn off lighting for the material with
Code: Select all
node->setMaterialFlag(irr::video::EMF_LIGHTING, false)
ssexton >> well I am not sure if there is much to thank for ...mostly you want lighting to be on and that means you cant have vertex colors with standard Irrlicht materials. You certainly can do it with shader, where it is just matter of putting one more argument in to calculation. If it can be done with fixed pipeline rendering I don't know. If yes it should not be so difficult to add it in to existing Irrlicht material renderer's. Myself I have some experience with GLSL but no with OpenGl programing so I don't know. If it is possible, I would really please Irrlicht developers to put it in.