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.

Adding Line Thickness? to Tutorial 3

Postby ppsychrite » Tue Mar 21, 2017 12:13 am

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

Re: Adding Line Thickness? to Tutorial 3

Postby CuteAlien » Tue Mar 21, 2017 12:39 am

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.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8188
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Adding Line Thickness? to Tutorial 3

Postby ppsychrite » Tue Mar 21, 2017 12:43 am

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

Postby ppsychrite » Tue Mar 21, 2017 12:53 am

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

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


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest

cron