[SOLVED] how to blend two 3D object's color

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
wps20052002
Posts: 10
Joined: Thu Jul 17, 2014 6:40 am

[SOLVED] how to blend two 3D object's color

Post by wps20052002 »

for example:
i use "drawVertexPrimitiveList" to draw 2 object(triangle here), and i want the overlap area draw with blend color, how can i do that ? Thank you in advances

camera position : (5,5,20)
camera target: (5,5,0)
green triangle : (0,0,0), (5,5,0), (10,0,0)
blue triangle : (2,0,1), (7,5,1), (12,0,1)
Last edited by wps20052002 on Sun Jul 05, 2015 5:37 am, edited 1 time in total.
wps20052002
Posts: 10
Joined: Thu Jul 17, 2014 6:40 am

Re: how to blend two 3D object's color

Post by wps20052002 »

to be simple, i just want to a transparent objects, like "Tutorial 10. Shaders", but i want a easy to do this(without shaders, because i have no idea about shader programming)
Image
CuteAlien
Admin
Posts: 9846
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: how to blend two 3D object's color

Post by CuteAlien »

You can try setting the colors of each vertex. It should then interpolate between the vertex colors over the triangles.
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
Foaly
Posts: 142
Joined: Tue Apr 15, 2014 8:45 am
Location: Germany

Re: how to blend two 3D object's color

Post by Foaly »

Irrlicht has some built-in material types for transparency. (documentation: http://irrlicht.sourceforge.net/docu/na ... 0cbc5430f1)
If the background is black, then you can use the material type EMT_TRANSPARENT_ADD_COLOR.
So if you draw a red triangle on top of a green one (and vice versa) you will get yellow.
wps20052002
Posts: 10
Joined: Thu Jul 17, 2014 6:40 am

Re: how to blend two 3D object's color

Post by wps20052002 »

Foaly wrote:Irrlicht has some built-in material types for transparency. (documentation: http://irrlicht.sourceforge.net/docu/na ... 0cbc5430f1)
If the background is black, then you can use the material type EMT_TRANSPARENT_ADD_COLOR.
So if you draw a red triangle on top of a green one (and vice versa) you will get yellow.
Oh yes, it works!
Thank you very much, have a nice day.
wps20052002
Posts: 10
Joined: Thu Jul 17, 2014 6:40 am

Re: how to blend two 3D object's color

Post by wps20052002 »

CuteAlien wrote:You can try setting the colors of each vertex. It should then interpolate between the vertex colors over the triangles.
actually , i want to draw transparent objects, maybe i didn't express clearly, but thank you for your reply.
Post Reply