The alpha ref material is hardcoded at 0.5

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: The alpha ref material is hardcoded at 0.5

Post by CuteAlien »

I've changed it now [r4569] using the simpler solution with just MaterialTypeParam and an exception for 0. So basically back to Irrlicht 1.4.The reason is that MaterialTypeParam2 is often abused by people (because there are no custom user parameters in material) and so using that at all could again break existing applications for no good reason. If someone needs this material without alpha at all then using a very small value near 0 should do the trick as well anyway.

Sorry, this took a while (run into some other problem while testing this which still confuses me. It seems uv's are not mapped the same way in opengl and d3d9 - I'm always getting some strange wrapping in d3d9 for the top and bottom lines - anyone knows something about that? I've not yet compared with older Irrlicht versions - will do that next. edit: Just checked 1.8 and it behaves the same there, so nothing new at least).
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
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: The alpha ref material is hardcoded at 0.5

Post by CuteAlien »

Aaaaand reverted. Real-life tests with BlindSide's shaders turned out to break by doing this. The problem here is that MaterialParam is used in different materials - which at one time in the past was no problem because one material had one material-type and that was it. But these days we have to use base-materials for our shaders and so suddenly same materials start sharing different different types. The concrete problem is that TRANSPARENT_ALPHA_CHANNEL_REF is typically needed by DepthPass shaders. While TRANSPARENT_ALPHA_CHANNEL is needed to render typical .obj files nicely (which do set MaterialTypeParam rather often). There are ways around that (like using own base-materials for example), but I guess as much as XEffects is used in the community I'll probably not be the only one to run into this.

So the real bug here is imho that MaterialTypeParam is used for 2 complete different things to save a little memory in SMaterial. So having 0.5 at least works in most cases - having it flexible again - my new proposal would be that if that is really needed then it should use a complete new parameter in SMaterial for that (which then has 0.5 as default). And which is then only used in TRANSPARENT_ALPHA_CHANNEL_REF.
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
Post Reply