Horde3D http://horde3d.org/forums/ |
|
Shared Contexts, Alpha / Depth Test, and Alpha To Coverage http://horde3d.org/forums/viewtopic.php?f=8&t=500 |
Page 1 of 1 |
Author: | AcidFaucet [ 13.09.2008, 04:46 ] |
Post subject: | Shared Contexts, Alpha / Depth Test, and Alpha To Coverage |
Here's a patch. Attachment: Shared contexts Explanation: As I posted in the thread pertaining to these directly, the following is the XML usage. It has no problems with linking to a link that links to a link, but it can't handle loops at the moment (you really shouldn't be doing something that silly, but I'll add the safeguards). Code: <Context id="LIGHTING" link="shared.shader.xml" /> The alpha and depth testing and such is very different. Code: <RenderConfig ...valid render config contents /> <TestConfig alphaTest="true" alphaMode="greater" alphaValue="0.5" /> The <TestConfig /> tag is optional, and will default to DepthTest = true, DepthMode = GL_LEQUAL, AlphaTest = false, and AlphaToCoverage = false. Available attributes: depthTest="bool", turns depth test on or off depthMode="greater" or "less" decides whether to use GL_GEQUAL or GL_LEQUAL testing mode alphaTest="bool", turns alpha test on or off alphaMode="greater" or "less" decides whether to use GL_GREATER or GL_LESS testing mode alphaValue="float" the standard of measure that the test is compared against. alphaToCoverage="bool" enables alpha to coverage NOTE on alphaToCoverage: You must use Horde3D::setOption( EngineOptions::SampleCount, # ) to something greater than 0 for it to actually be used. Setting it to true won't do anything if alphaTest is enabled, the two aren't compatible. Everything has been tested fairly thoroughly with different combinations of settings, but not thoroughly enough in practice. The To-Do list includes exact specification of test modes, using "gequal" "equal" "lequal" "greater" "less" Open for review and discussion on both implementation and XML usage. |
Author: | AcidFaucet [ 14.09.2008, 02:57 ] |
Post subject: | Re: Shared Contexts, Alpha / Depth Test, and Alpha To Coverage |
Here's an updated and improved version, with significant changes. Attachment: <TestConfig /> does not exist anymore. It's been replaced with <AlphaTest enabled="bool" mode="modeCode" value="float" /> <DepthTest enabled="bool" mode="modeCode" /> <AlphaToCoverage enabled="bool /> The default results are identical. I think this is probably more intuitive than <TestConfig /> which honestly made no sense for Alpha To Coverage, because it isn't a test. It also makes the shader's test setup instantly comprehensible instead of being long winded in the event of combined alpha and depth testing. Valid test modes have been expanded to include "gequal" "lequal" and "equal" in addition to "less" and "greater" Context linking will now choke and return 0x0 if it loops. PLEASE suggest a different solution if one pops into your mind than what I implemented, an alteration to findContext(string, **string safety = ""**) |
Author: | marciano [ 14.09.2008, 23:03 ] |
Post subject: | Re: Shared Contexts, Alpha / Depth Test, and Alpha To Coverage |
Looks good at first sight....I will have a closer look when I have a bit more time... |
Author: | AcidFaucet [ 18.09.2008, 21:36 ] |
Post subject: | Re: Shared Contexts, Alpha / Depth Test, and Alpha To Coverage |
Update to Context linking: No longer calls getLink if there are no links present in the shader. Recursive check for looping reference optimized to use a vector<pair<string,string>*> *safety that is reserved for 3 (seemed like a realistic likely depth in complicated circumstances). Pointer == Pointer is alot faster than string.find(string). findContext(const string &name, vector<pair<string,string>*> *safety = 0x0) Hasn't been tested yet in cases where there's material data and expected shader data absences. Attachment:
|
Author: | marciano [ 05.10.2008, 16:33 ] |
Post subject: | Re: Shared Contexts, Alpha / Depth Test, and Alpha To Coverage |
I had a closer look at your code. The extended rendering state configuration is very good. The context linking will be really practical, although the "safety" part does not look so clean but I didn't have the time to think about a nicer solution. Good work, if you are happy with it yourself I think it can go to the community branch. |
Author: | AcidFaucet [ 07.10.2008, 18:41 ] |
Post subject: | Re: Shared Contexts, Alpha / Depth Test, and Alpha To Coverage |
Yeah, the safety is the part I don't like. I'm going to dig through some books for a few days before pushing it to see if I can find something else that will do the trick and make more sense. |
Author: | AcidFaucet [ 18.11.2008, 21:46 ] |
Post subject: | Re: Shared Contexts, Alpha / Depth Test, and Alpha To Coverage |
I've committed the rendering state related code to the community SVN, and updated the relevant documentation. I'll post a recent patch for context linking, but I don't think it should go into the SVN stock. |
Author: | marciano [ 28.01.2009, 23:51 ] |
Post subject: | Re: Shared Contexts, Alpha / Depth Test, and Alpha To Coverage |
AcidFaucet, thanks again for your patch! We have finally taken over your first suggestion in some modified form (e.g. depthTest is not necessary since you can set depthMode to ALWAYS which is the same as disabling depth test). Since that way the number of properties is quite small, we though it would be nicer to have them in a single xml node (btw, d3d also just has a single renderstate enum for these states). |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |