Page 1 of 1

Adding Line Thickness? to Tutorial 3

Posted: Tue Mar 21, 2017 12:13 am
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?

Re: Adding Line Thickness? to Tutorial 3

Posted: Tue Mar 21, 2017 12:39 am
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.

Re: Adding Line Thickness? to Tutorial 3

Posted: Tue Mar 21, 2017 12:43 am
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

Re: Adding Line Thickness? to Tutorial 3

Posted: Tue Mar 21, 2017 12:53 am
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));
    }
 
}