Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / $50 for answer. Shader experts...need your help

Author
Message
DanW
21
Years of Service
User Offline
Joined: 6th Jul 2003
Location: Boston, MA
Posted: 16th Feb 2010 20:31
I have a program which has a 9 cameras.

One or two can be visible at any one time.
(top half and bottom half of screen, or maybe 1 full screen)

If anyone can tell me how to show a camera on top half of screen
with greyscale shader applied & bottom camera (bottom half of screen)
with no shader, same shader or different shader applied.

Or one camera full screen with a shader applied.

I will send $50 to a paypal account (or any other account)
Quick $50 for someone!

Thanks!
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 16th Feb 2010 20:56
It's not really that hard, what you want is a 'quad.fx' shader(one that transforms a plane into the camera view so it fits exactly). Except create 2 extra vertex shaders, one would force the quad to the top half of the screen, the other would force it to the bottom. Thus when rendering split screen you'd create 2 planes, load up the shader twice with the 2 new techniques, render the game or whatever from 2 cameras and apply their render targets to each of the planes and render the main camera(this will then draw the split screen). You can then apply greyscale or whatever effects you like by creating variants of this quad.fx shader that do different things, this doesn't really require a shader expert.

Anyway here's a quad.fx that does this(untested):



However I'd ask you raise your prize for an answer by: -$50

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 16th Feb 2010 21:10 Edited at: 16th Feb 2010 21:10
Dark coder, if it's not too much to ask, where did you learn about shaders from? i can't find any tutorial around...

dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 16th Feb 2010 21:16 Edited at: 16th Feb 2010 21:19
From reading other people's shaders, editing them, clawing my eyes out at the errors that made no sense(at the time) and gradually learning all of the syntax. You can find a list of HLSL functions here: http://msdn.microsoft.com/en-us/library/ee418317%28VS.85%29.aspx but as for tutorials, no idea, I didn't follow any. But yea once I learned HLSL I went to C++ because the syntax is practically the same and thus I learned it rather quickly.

Oh and Green Gandalf helped me a bit when I was stuck, on the 'Learning to write Shaders' thread, but for the most part just trial and error.

DanW
21
Years of Service
User Offline
Joined: 6th Jul 2003
Location: Boston, MA
Posted: 16th Feb 2010 21:20
how do you choose the technique are from within DarkGDK?

What if I wanted to choose the percentage out at runtime?

like 10%/90%
all the way down to 90%/10% and finally 100%

I have a DarkGDK app that does this now with cameras and views.

It can display two cameras onscreen with any horizontal split.
What I'm trying to do, is make the top or bottom or both any shaders that I apply.
DanW
21
Years of Service
User Offline
Joined: 6th Jul 2003
Location: Boston, MA
Posted: 16th Feb 2010 21:21
Oh, and I take a look at that link. thanks.
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 16th Feb 2010 21:32
If you need a variable split amount then this should work(again, untested):



Set 'screenRes' to {800.0, 600.0} or something via GDK, and 'splitPerc' to {0.0, 0.5} (top half) etc. I assume your split screen currently uses dbSetCameraView, if so, don't do this. It means you can't efficiently apply other camera effects like bloom across both cameras.

To change the technique just call dbSetEffectTechnique, but if you don't know that then maybe you do need a shader expert to help you implement this and write the various pixel shaders your game will no doubt require.

DanW
21
Years of Service
User Offline
Joined: 6th Jul 2003
Location: Boston, MA
Posted: 16th Feb 2010 21:49
Yes, I am new to shaders on DarkSDK, DarkGDK.
Complete newbie. But quick learner.
Have about 6 months experience with DarkSDK.

(Although haven't used it since 2005.)

I'll try that today and let you know how it goes.

THANKS!

Dan.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 16th Feb 2010 21:51
thanks for the links dude, that thread's really helpful

DanW
21
Years of Service
User Offline
Joined: 6th Jul 2003
Location: Boston, MA
Posted: 17th Feb 2010 21:04
One more question... if I can't use dbSetCameraView, how can I see two cameras on screen at the same time?

That's what dbSetCameraView is for... (I thought)

Now maybe that's where all my shader problems come from, but I am currently using dbSetCameraView in a CCamera class.
uses dbSetCameraAspect and wraps all camera related functions.

Dan.
DanW
21
Years of Service
User Offline
Joined: 6th Jul 2003
Location: Boston, MA
Posted: 17th Feb 2010 23:11
should I create two off screen images and set the cameras to these image?
dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 18th Feb 2010 03:30
Quote: "One more question... if I can't use dbSetCameraView, how can I see two cameras on screen at the same time?"


As I said, you create 2 cameras and have them render to their own image. Once done, you no longer see anything, but you have 2 images with your split screens, you then draw these both using a shader such as the one I provided to the main camera. Where you create one plane that gets one half of the split camera image, and the other gets the other. The shader will handle their alignment provided you pass the correct values and thus you gain a lot of flexibility.

DanW
21
Years of Service
User Offline
Joined: 6th Jul 2003
Location: Boston, MA
Posted: 18th Feb 2010 17:05
Thanks for the reply.
I will look into this method of split screen shader rendering.
Big change from the dbSetView centric code I have now.

Thanks.
Dan.

Login to post a reply

Server time is: 2024-11-20 03:19:22
Your offset time is: 2024-11-20 03:19:22