Add RasterizerState.DepthClipEnable #3706

Merged
merged 3 commits into from Apr 13, 2015

Conversation

Projects
None yet
3 participants
@tgjones
Contributor

tgjones commented Apr 5, 2015

with implementation for Direct3D and OpenGL, and a visual test (which passes on both Direct3D and OpenGL).

On Direct3D, this corresponds to RasterizerState.DepthClipEnable. On OpenGL, this corresponds to calling GL.Enable(DEPTH_CLAMP).

On Direct3D, this is not supported by level 9.x devices. On OpenGL, this is enabled by the ARB_depth_clamp extension. These restrictions are accounted for in GraphicsCapabilities.

(By the way, it was when running this visual test on OpenGL that I noticed that depth clipping wasn't working properly, even without these changes, which is what prompted the MojoShader fix.)

tgjones added some commits Mar 24, 2015

Add RasterizerState.DepthClipEnable
with implementation for Direct3D and OpenGL, and a visual test
Rebuild built-in effects
using new MojoShader with z-coordinate fixup

@tgjones tgjones changed the title from Depthclipenable to Add RasterizerState.DepthClipEnable Apr 5, 2015

@mgbot

This comment has been minimized.

Show comment
Hide comment
@mgbot

mgbot Apr 5, 2015

Member

TeamCity MonoGame :: Develop (Win) Build 3.4.0.155 outcome was FAILURE
Summary: Snapshot dependency failed: MonoGame :: Develop (Mac) Build time: 00:00:00

Member

mgbot commented on c089aa8 Apr 5, 2015

TeamCity MonoGame :: Develop (Win) Build 3.4.0.155 outcome was FAILURE
Summary: Snapshot dependency failed: MonoGame :: Develop (Mac) Build time: 00:00:00

@mgbot

This comment has been minimized.

Show comment
Hide comment
@mgbot

mgbot Apr 5, 2015

Member

TeamCity MonoGame :: Develop (Win) Build 3.4.0.156 is now running

Member

mgbot commented on 55a0210 Apr 5, 2015

TeamCity MonoGame :: Develop (Win) Build 3.4.0.156 is now running

This comment has been minimized.

Show comment
Hide comment
@mgbot

mgbot Apr 5, 2015

Member

TeamCity MonoGame :: Develop (Win) Build 3.4.0.156 outcome was SUCCESS
Summary: Tests passed: 476, ignored: 6 Build time: 00:14:32

Member

mgbot replied Apr 5, 2015

TeamCity MonoGame :: Develop (Win) Build 3.4.0.156 outcome was SUCCESS
Summary: Tests passed: 476, ignored: 6 Build time: 00:14:32

@tgjones

This comment has been minimized.

Show comment
Hide comment
@tgjones

tgjones Apr 6, 2015

Contributor

I forgot to mention why this is useful. One usage is to "pancake" depths when rendering shadow maps, so objects behind the light's near clip plane will still be rendered - which means you don't need to calculate a precise near clip plane distance. That's what I'm using it for.

(If this PR is accepted, then I will be able to publish a complete cascaded shadow maps sample that I've been working on - basically a MonoGame port of MJP's shadows sample - which brings together some of these new features: texture arrays, comparison samplers, and depth clamping.)

Contributor

tgjones commented Apr 6, 2015

I forgot to mention why this is useful. One usage is to "pancake" depths when rendering shadow maps, so objects behind the light's near clip plane will still be rendered - which means you don't need to calculate a precise near clip plane distance. That's what I'm using it for.

(If this PR is accepted, then I will be able to publish a complete cascaded shadow maps sample that I've been working on - basically a MonoGame port of MJP's shadows sample - which brings together some of these new features: texture arrays, comparison samplers, and depth clamping.)

@tgjones

This comment has been minimized.

Show comment
Hide comment
@tgjones

tgjones Apr 7, 2015

Contributor

@tomspilman @KonajuGames any thoughts on whether this would be a good fit for MonoGame?

Contributor

tgjones commented Apr 7, 2015

@tomspilman @KonajuGames any thoughts on whether this would be a good fit for MonoGame?

@tgjones

This comment has been minimized.

Show comment
Hide comment
@tgjones

tgjones Apr 10, 2015

Contributor

@tomspilman @KonajuGames Sorry to be annoying, but have you had a chance to look at this? I've got my shadows sample all ready to go, but it won't work (for anybody other than me) until this PR is merged. (No problem if you decide not to merge it, I can apply a workaround, although of course it would be great if it is merged.)

Here's the sample:
https://github.com/tgjones/monogame-samples/tree/master/CascadedShadowMaps

Contributor

tgjones commented Apr 10, 2015

@tomspilman @KonajuGames Sorry to be annoying, but have you had a chance to look at this? I've got my shadows sample all ready to go, but it won't work (for anybody other than me) until this PR is merged. (No problem if you decide not to merge it, I can apply a workaround, although of course it would be great if it is merged.)

Here's the sample:
https://github.com/tgjones/monogame-samples/tree/master/CascadedShadowMaps

@tomspilman

This comment has been minimized.

Show comment
Hide comment
@tomspilman

tomspilman Apr 10, 2015

Member

Sorry... it just has been crazy busy for me lately.

any thoughts on whether this would be a good fit for MonoGame?

I think so. Same concerns over making sure we eventually work out a "feature level" for this. But generally I think it would be good to support.

I'll look over the PR in more detail tomorrow.

Member

tomspilman commented Apr 10, 2015

Sorry... it just has been crazy busy for me lately.

any thoughts on whether this would be a good fit for MonoGame?

I think so. Same concerns over making sure we eventually work out a "feature level" for this. But generally I think it would be good to support.

I'll look over the PR in more detail tomorrow.

@tgjones

This comment has been minimized.

Show comment
Hide comment
@tgjones

tgjones Apr 10, 2015

Contributor

Same concerns over making sure we eventually work out a "feature level" for this

I did the same as for texture arrays and comparison samplers - I used GraphicsCapabilities to set a "supported" flag. On Direct3D, it's only enabled for the HiDef profile, and on OpenGL, it's enabled if the required extension is present. Which basically, I think, means it's enabled for desktop platforms only.

I'll look over the PR in more detail tomorrow.

Thanks!

Contributor

tgjones commented Apr 10, 2015

Same concerns over making sure we eventually work out a "feature level" for this

I did the same as for texture arrays and comparison samplers - I used GraphicsCapabilities to set a "supported" flag. On Direct3D, it's only enabled for the HiDef profile, and on OpenGL, it's enabled if the required extension is present. Which basically, I think, means it's enabled for desktop platforms only.

I'll look over the PR in more detail tomorrow.

Thanks!

@tomspilman

This comment has been minimized.

Show comment
Hide comment
@tomspilman

tomspilman Apr 13, 2015

Member

Ok... merging!

Member

tomspilman commented Apr 13, 2015

Ok... merging!

tomspilman added a commit that referenced this pull request Apr 13, 2015

Merge pull request #3706 from tgjones/depthclipenable
Add RasterizerState.DepthClipEnable

@tomspilman tomspilman merged commit 95d45e2 into MonoGame:develop Apr 13, 2015

1 check passed

default Finished TeamCity Build MonoGame :: Develop (Win) : Tests passed: 476, ignored: 6
Details
@tgjones

This comment has been minimized.

Show comment
Hide comment
@tgjones

tgjones Apr 13, 2015

Contributor

Great, thank you!

Contributor

tgjones commented Apr 13, 2015

Great, thank you!

@tgjones tgjones deleted the tgjones:depthclipenable branch Apr 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment