Hi,
i am using Irrlicht for a visualisation tool for CAD data (believe it or not, but besides OpenSceneGraph no other library could load or even handle these data - with Irrlicht i made some small changes to the STL-loader and all was fine).
Now i would like to display my objects with different colors (or white intensity) on the front and backside.
How could i do that?
colors for front / backside
Re: colors for front / backside
Easiest solution I can think of is to make a copy of the meshbuffer. Then loop over all the indices and flip the 1st and 3rd index for each triangle. Give that meshbuffer another material (or the vertices in it another vertex-color). Keep backface culling enabled.
Unless someone knows a trick avoid the copy...
Unless someone knows a trick avoid the copy...
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: colors for front / backside
I'd use a shader. You have access to whether it's front or back via a built-in variable, then you can color as you wish.
Re: colors for front / backside
Aha - good idea. I would say it's the OBVIOUS idea, but i wanted to avoid shaders as much as possible. This would be a good reason to start with it.