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.

Author
Message
Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 24th Apr 2011 20:13
Hi. I'm hoping for a little guidance of shaders which, I must confess, I've never really understood. I'm trying to achieve a bloom shader across my 2D game. At the moment, I have a system set up where the sprites are all pasted onto an image that is, in turn, used as a texture on a plane. This works OK but is very slow so I was hoping to use ImageKit's pixel shader commands to shade and then paste the image instead. However in my initial experiments, I've had no luck. I've attached the full project with dba, dbpro, shader and image. I'm using a random png I made for testing and Bond1's bloom shader. The code I'm using is this:



The result I get is the image pasted as normal with no shader applied. I'm fairly sure I've got something wrong as this code is much simpler than the code I use for the 3D shader, but as that is mostly copied from these forums, I've not been able to figure out what's missing. Any help with getting this shading would be greatly appreciated. Thanks in advance.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Apr 2011 22:28
The obvious thing that is missing is that the shader needs to be applied to something, i.e. something analogous to the DBP set object effect command.

I'm not familiar with the way ImageKit works so this could be completely wrong.
Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 24th Apr 2011 22:47
Thanks for the thought but I think that should be covered by the ik paste image command. The first parameter is the image number, the second and third the x and y coords and the fourth the effect number. Thus it should be applying the bloom shader when it pastes the image.
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 25th Apr 2011 00:34 Edited at: 25th Apr 2011 00:35
Hi Lucas,

Image Kit has that kind of functionality, but it can't do the same things DBP can do (only the bare basic semantics work right now) like it can't specify texture files inside of the shader itself. And to be honest, I don't have a thorough knowledge of shader files either - enough to get pixel shaders working I found/created.

In any case, you can't expect DBP shaders to work just like that in Image Kit. Textures need to be set manually, and I have not tested with enough shaders to be able to clearly tell you the limits of Image Kit.

Perhaps it's time to continue the development of Image Kit with a more experienced shader-artist like Green Gandalf (if he agrees).

Sven B

Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 25th Apr 2011 09:36
Hi Sven,

Ty for the explanation. IK is still a really great plugin though so thanks anyway!

Whilst you may well be right about the limitations of IK, there is still the factor that the code seems quite different to the 3D code. Having gone through it more closely, I wondered anyone would be able to explain to me what it is doing.

It seems that, with the 3D plane system I use at the moment, I have to make two planes. One of these I texture, the other I apply the quad.fx effect to. I then have to make a second camera (id 1) and apply the bloom shader to that. Then, when I want to sync the screen, I have to run these lines:



This would seem to be different to what I'm doing with IK where I'm applying the bloom-shader to the image I want shaded. I've been looking into trying something more like this with IK but I've found that IK crashes with the following error when I try and apply quad.fx to the image.



So could anyone enlighten me as to what is going on? Ty
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 25th Apr 2011 11:27
Hi Lucas,

I can't really help you with the first question, but I know that the error means that you pretty much have to change the lines

PixelShader = compile ps_1_* func(); (where * and func can be anything)
to:
PixelShader = compile ps_2_0 func();

Cheers!
Sven B

Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 25th Apr 2011 20:18
Hi again. You're quite right about the shader, that fixed the error nicely, although I've never really been sure what quad does exactly. I've not yet been able to get the bloom effect without using 3D planes but I'll post here if I figure anything out. Thanks again for all the help

Login to post a reply

Server time is: 2026-07-11 13:57:59
Your offset time is: 2026-07-11 13:57:59