Ray casting and tiles

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!
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Ray casting and tiles

Post by CuteAlien »

SMaterial.Lighting stands for enable dynamic lights vs ignore dynamic lights.

Highlighting can actually be a bit tricky without writing your own shaders, thought there are some options which may work for you:
1. The simplest - replace the texture with a lighter one.
2. Modify the vertex-colors of your selected mesh. Note that by default it's full brighness so you can only go darker (so start with darker vertex colors and use a brighter textures as default, then you can increase brightness by going back to full brighness). You can modify those colors directly in your node or use a tool function like IMeshManipulator::setVertexColors.
3. Use EMT_LIGHTMAP_ADD or one of the EMT_LIGHTMAP_* as MaterialType instead of EMT_SOLID. Then second texture can be dark or light and be replaced for highlighting
4. Write your own shaders (check shader tutorial for how to do that).

Note you can experiment with example 22 to see what the default materials do when you enable/disable light and set the material or mesh-vertex colors or different textures.
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
tBane
Posts: 33
Joined: Wed Feb 21, 2024 2:25 pm
Location: Poland

Re: Ray casting and tiles

Post by tBane »

Thank you for your help :-)
I used MaterialType::EMT_TRANSPARENT_ADD_COLOR
Post Reply