Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline matthijs  
#1 Posted : Tuesday, January 3, 2012 2:37:24 AM(UTC)
matthijs

Joined: 8/24/2011(UTC)
Posts: 6

Thanks: 1 times
Hi there,

I've started playing around with the Delta engine, I'm wondering wether it's possible to mimick this technique (http://www.sgtconker.com/2010/08/article-texture-modification-using-render-targets-with-some-stencil-buffer-action/) somewhat platform independend using the delta engine (on platforms where stencil buffer capabilities are available)? I found some documentation mentioning DepthStencilObject, but it was in the XNA rendering implementation.

I'd like to use this technique for a worms style of game, where I don't want to alter/copy bitmap data to the gpu each time...

Thanks in advance!

Matthijs

Wanna join the discussion?! Login to your forum accountregister a new account. Or Connect via Facebook Twitter Google

Offline Benjamin  
#2 Posted : Tuesday, January 3, 2012 3:31:42 AM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
It is possible in theory, but currently render targets (see RenderToTexture class und tests) are a bit broken, so it will be hard to setup everything correctly. It obviously can be fixed and stencil buffers can be enabled (we did so on Android and Windows for the SoulCraftTechDemo early last year), but it is a lot of work to make sure it runs correctly on all platforms. This is why you saw DepthStencilObject, which just mirrored XNA capabilities when we ported the SoulCraftTechDemo to WP7, but in the end we just used ShadowMaps, not stencil buffers. Did not matter for WP7 anyway since render targets with custom shaders are not possible and probably too slow anyway.

Since Delta.Graphics.OpenTK is in the public repository, you could help out by modifying it to allow stencil render targets and we could adapt and test for the other platforms. To be honest if you want to wait until we implement advanced rendering techniques, it will be a long time until we can focus on specific features like this one. It is quicker to just go ahead and implement it on your own and ask for help in the forum :)

Edited by user Tuesday, January 3, 2012 3:32:39 AM(UTC)  | Reason: Not specified

Offline matthijs  
#3 Posted : Tuesday, January 3, 2012 9:39:03 PM(UTC)
matthijs

Joined: 8/24/2011(UTC)
Posts: 6

Thanks: 1 times
Originally Posted by: Benjamin Nitschke (DeltaEngine) Go to Quoted Post
It is possible in theory, but currently render targets (see RenderToTexture class und tests) are a bit broken, so it will be hard to setup everything correctly. It obviously can be fixed and stencil buffers can be enabled (we did so on Android and Windows for the SoulCraftTechDemo early last year), but it is a lot of work to make sure it runs correctly on all platforms. This is why you saw DepthStencilObject, which just mirrored XNA capabilities when we ported the SoulCraftTechDemo to WP7, but in the end we just used ShadowMaps, not stencil buffers. Did not matter for WP7 anyway since render targets with custom shaders are not possible and probably too slow anyway.

Since Delta.Graphics.OpenTK is in the public repository, you could help out by modifying it to allow stencil render targets and we could adapt and test for the other platforms. To be honest if you want to wait until we implement advanced rendering techniques, it will be a long time until we can focus on specific features like this one. It is quicker to just go ahead and implement it on your own and ask for help in the forum :)


Thanks for the detailed answer!

I gave it a stab and made some modifications that *theoretically* should enable the OpenTKRenderToTexture class also to act as a stencil buffer. I cannot test the simple RenderToTexture example though (the DrawLineOnTexture example just shows a black rectangle on both pc's i've tested it on). With attached modifications & added test (MaskTexture) I get the same result. Besides that it probably won't work as it's the first try, it's impossible for me to test because it won't show anything. Do you have any idea what the problem might be?

Cheers!

Matthijs

Edited by user Tuesday, January 3, 2012 9:40:52 PM(UTC)  | Reason: Not specified

File Attachment(s):
delta.zip (16kb) downloaded 5 time(s).

You cannot view/download attachments. Try to login or register.
Offline Benjamin  
#4 Posted : Wednesday, January 4, 2012 12:41:37 AM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Hey Matthijs,

I added your code to the RenderToTexture classes and it compiles fine (I also did some code improvements).

However, when executing the MaskTexture unit test it fails for me with: "Warning: FBO: One or more attachment points are not framebuffer attachment complete."

The feature is still open and will be investigated when I have more time. You can check out the code yourself in the next nightly release.
Offline matthijs  
#5 Posted : Wednesday, January 4, 2012 4:23:59 PM(UTC)
matthijs

Joined: 8/24/2011(UTC)
Posts: 6

Thanks: 1 times
Hi Benjamin,

Thanks for the swift action, I'll check it out and give it another try!
Offline matthijs  
#6 Posted : Thursday, February 9, 2012 9:54:34 PM(UTC)
matthijs

Joined: 8/24/2011(UTC)
Posts: 6

Thanks: 1 times
Originally Posted by: Matthijs Go to Quoted Post
Hi Benjamin,

Thanks for the swift action, I'll check it out and give it another try!


So I was picking this up again to see if I can get things to work, but there seems to be another problem with the rendertotexture functionality; When I try to run MaterialTests.DrawLineOnTexture I get a black square... I tested this on two pc's (deltaengine v0.93, both pc's have an ATI card, different models though). Could you confirm if this test is currently broken, or am I missing something?

Thanks!

Matthijs
Offline matthijs  
#7 Posted : Wednesday, February 15, 2012 6:13:27 PM(UTC)
matthijs

Joined: 8/24/2011(UTC)
Posts: 6

Thanks: 1 times
Originally Posted by: Matthijs Go to Quoted Post
Originally Posted by: Matthijs Go to Quoted Post
Hi Benjamin,

Thanks for the swift action, I'll check it out and give it another try!


So I was picking this up again to see if I can get things to work, but there seems to be another problem with the rendertotexture functionality; When I try to run MaterialTests.DrawLineOnTexture I get a black square... I tested this on two pc's (deltaengine v0.93, both pc's have an ATI card, different models though). Could you confirm if this test is currently broken, or am I missing something?

Thanks!

Matthijs


Could anyone confirm? Tested this on another pc (with an nvidia card) and had the same problem...
Offline Benjamin  
#8 Posted : Wednesday, February 15, 2012 6:22:29 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Yes it is probably broken, some render to texture functionality works in special cases, but I have moved all RenderToTexture features and bugs to v0.9.5.
thanks 1 user thanked Benjamin for this useful post.
matthijs on 2/20/2012(UTC)
Offline matthijs  
#9 Posted : Monday, February 20, 2012 9:39:37 PM(UTC)
matthijs

Joined: 8/24/2011(UTC)
Posts: 6

Thanks: 1 times
Originally Posted by: Benjamin Nitschke (DeltaEngine) Go to Quoted Post
Yes it is probably broken, some render to texture functionality works in special cases, but I have moved all RenderToTexture features and bugs to v0.9.5.


Ok good to hear! Will the stenciltest be part of the rtt features and bugs?

I hope to setup a sample project soon, demonstrating the stencilbuffer in a small isolated project in the same fashion as deltaengine's opentk rendering setup.. This way we could easily verify where the bottleneck lies, and I can be sure it's not a deltaengine specific rtt bug thats bugging me.
Offline Benjamin  
#10 Posted : Tuesday, February 21, 2012 3:20:58 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Yes as I wrote above stencil testing was used to support shadows on platforms without custom shaders, but due slow performance we never actually used it in the Soulcraft Tech Demo on WP7. Enabling stencil yourself (e.g. in OpenTK) should not be hard (just enable stencil at creation time and add a few methods to enable drawing into it).
Rss Feed  Atom Feed
Users browsing this topic
OceanSpiders 2.0
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.121 seconds.