Adding Line Thickness? to Tutorial 3

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
ppsychrite
Posts: 6
Joined: Tue Mar 21, 2017 12:05 am

Adding Line Thickness? to Tutorial 3

Post by ppsychrite »

(Excuse me for my ignorance as I'm just getting into 3d stuff and have no clue how shaders work)
So is it possible to add black thickness to the edges of the triangle in tutorial 3?
I've tried doing "Material.Thickness = 10;" after the "Material.Wireframe = false;" and "Material.Lighting = false;" but that doesn't seem to work?
Any tips?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Adding Line Thickness? to Tutorial 3

Post by CuteAlien »

Theory is - draw twice - once with Wireframe enabled and once disabled.
But... some troubles. First one is that Thickness is only used for lines on OpenGL. Direct3D doesn't have that feature.
Next problem is - you need different colors. Once solution is for example to use a black texture second time.
Or set all vertex-colors. Or copy vertices with new colors.

And... usually you could also work with ColorMask to set second render to black I guess. I wanted to try that right now, but found out it got broken in Irrlicht svn for OpenGL. Can't debug anymore today, but in Irrlicht 1.8 it still did something at least (I never worked with it and also will have to expirment a little bit).

edit: What I meant - in that example you would call setMaterial and drawVertexPrimitiveList a second time inside render() - and use line-drawing for the second try.
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
ppsychrite
Posts: 6
Joined: Tue Mar 21, 2017 12:05 am

Re: Adding Line Thickness? to Tutorial 3

Post by ppsychrite »

CuteAlien wrote:Theory is - draw twice - once with Wireframe enabled and once disabled.
But... some troubles. First one is that Thickness is only used for lines on OpenGL. Direct3D doesn't have that feature.
Next problem is - you need different colors. Once solution is for example to use a black texture second time.
Or set all vertex-colors. Or copy vertices with new colors.

And... usually you could also work with ColorMask to set second render to black I guess. I wanted to try that right now, but found out it got broken in Irrlicht svn for OpenGL. Can't debug anymore today, but in Irrlicht 1.8 it still did something at least (I never worked with it and also will have to expirment a little bit).

edit: What I meant - in that example you would call setMaterial and drawVertexPrimitiveList a second time inside render() - and use line-drawing for the second try.
Alright, thank you! :D
ppsychrite
Posts: 6
Joined: Tue Mar 21, 2017 12:05 am

Re: Adding Line Thickness? to Tutorial 3

Post by ppsychrite »

Incase anybody else wants to know how to do it here's what I did!

Code: Select all

 
virtual void render(){
    irr::u16 indices[] = { 0,2,3, 2,1,3, 1,0,3, 2,0,1 };
    irr::video::IVideoDriver* driver = SceneManager->getVideoDriver();
 
    driver->setMaterial(Material);
    driver->setTransform(irr::video::ETS_WORLD, AbsoluteTransformation);
    driver->drawVertexPrimitiveList(&Vertices[0], 4, &indices[0], 4, irr::video::EVT_STANDARD, irr::scene::EPT_TRIANGLES, irr::video::EIT_16BIT);
 
    
    for (irr::s32 i = 0; i < 10; ++i) {
        driver->draw3DLine(Vertices[indices[i]].Pos, Vertices[indices[i+1]].Pos, irr::video::SColor(255,0,0,0));
    }
 
}
 
Post Reply