Disable alpha testing for transparent materials
- TaaTT4
- OGRE Contributor
- Posts: 267
- Joined: Wed Apr 23, 2014 3:49 pm
- Location: Bologna, Italy
- x 75
- Contact:
Disable alpha testing for transparent materials
Imagine to have a vertical plane with a fence texture on it. In this scenario, alpha testing is needed to let the plane be able to cast shadow. At the same time, alpha testing "destroys" how the plane is rendered in the color buffer (the fence tends to disappear at the distance, see here for explanation).
Senior programmer at 505 Games; former senior engine programmer at Sandbox Games
Worked on: Racecraft Esport — Racecraft Coin-Op, Victory: The Age of Racing
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Disable alpha testing for transparent materials
- TaaTT4
- OGRE Contributor
- Posts: 267
- Joined: Wed Apr 23, 2014 3:49 pm
- Location: Bologna, Italy
- x 75
- Contact:
Re: Disable alpha testing for transparent materials
What I need is transparency in color pass and alpha testing JUST in shadow caster pass.
Senior programmer at 505 Games; former senior engine programmer at Sandbox Games
Worked on: Racecraft Esport — Racecraft Coin-Op, Victory: The Age of Racing
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Disable alpha testing for transparent materials
Yeah, that would be a feature request. Probably not a hard one to get. Though we're thinking of doing a shader refactor, it may happen after that. I'm not sure.
It's all about introducing a new boolean to indicate this, and a new property
- TaaTT4
- OGRE Contributor
- Posts: 267
- Joined: Wed Apr 23, 2014 3:49 pm
- Location: Bologna, Italy
- x 75
- Contact:
Re: Disable alpha testing for transparent materials
Senior programmer at 505 Games; former senior engine programmer at Sandbox Games
Worked on: Racecraft Esport — Racecraft Coin-Op, Victory: The Age of Racing
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Disable alpha testing for transparent materials
I suggest you do a find in files for the following keywords in Samples/Media/Hlms and source/header files:
- "alpha_test"
- HlmsBaseProp::AlphaTest
- mAlphaTestCmp
- mAlphaTestThreshold
- setAlphaTest
- getAlphaTest
- setAlphaTestThreshold
As for JSON import/export, the old alpha_test keyword affects both, while alpha_test_receiver and alpha_test_caster affects them individually.
You can ignore the Hlms mobile implementations.
Cheers
- TaaTT4
- OGRE Contributor
- Posts: 267
- Joined: Wed Apr 23, 2014 3:49 pm
- Location: Bologna, Italy
- x 75
- Contact:
Re: Disable alpha testing for transparent materials
In the material JSON declaration:
Code: Select all
"alpha_test" : ["greater", 0.5, true]
In OgreHlmsDatablock replace
Code: Select all
void setAlphaTest( CompareFunction compareFunction );
Code: Select all
void setAlphaTest( CompareFunction compareFunction, bool shadowCasterOnly = false );
Senior programmer at 505 Games; former senior engine programmer at Sandbox Games
Worked on: Racecraft Esport — Racecraft Coin-Op, Victory: The Age of Racing
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact: