Object without texture (like in Solid Works etc)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Cyberdrill
Posts: 18
Joined: Wed Feb 27, 2008 2:32 pm
Location: Russia, Moscow

Object without texture (like in Solid Works etc)

Post by Cyberdrill »

What's the right way in Irrlicht to get picture like this:

Image

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?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

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.
Image Image Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I think most formats do support vertex colors. At least 3ds, x, and obj should. I'm not sure about b3d and ms3d.
Cyberdrill
Posts: 18
Joined: Wed Feb 27, 2008 2:32 pm
Location: Russia, Moscow

Post by Cyberdrill »

Thanks! But if it'll be custom Irrlicht 3D object (Mesh)? (I try to create CAD application, and I think ready models - is not what I need, because I need to control shape and size of objects, and I can't find method to manipulate ready model this way, so I'll use custom Meshes...)
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

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.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Vertex colors and lighting should work. At least with OpenGL it showed up correctly.
For the custom meshes you simply have to set the S3DVertex attribute Color to the desired value.
Cyberdrill
Posts: 18
Joined: Wed Feb 27, 2008 2:32 pm
Location: Russia, Moscow

Solved

Post by Cyberdrill »

Great! Thanks a lot :shock: :shock:
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Vertex colors and lighting should work. At least with OpenGL it showed up correctly.
Where did it showed 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...
ssexton
Posts: 54
Joined: Wed Oct 25, 2006 7:46 am
Location: South Florida
Contact:

Post by ssexton »

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

Code: Select all

node->setMaterialFlag(irr::video::EMF_LIGHTING, false)
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.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

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.
Post Reply