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.

AppGameKit Classic Chat / Additive Sprite Shader

Author
Message
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 16th Apr 2015 18:18
Hi all, having a major headache with additive blending. Does anyone know how we do additive blending such as the in-built transparency option in AppGameKit?

I can create a sprite shader that will additive blend between 2 sprite images but I need to blend the single sprite texture with the background...

Basically the built in option only allows for sprites with a black background but I want to make a new shader that can use an image with alpha transparency instead. Also I want to create a bunch of other useful shaders but I just don't know how to get the current value of the pixel I am drawing over.

I've sent a request to Paul but it would be great if someone with more experience of shaders could assist?

HELP?!?!

Using AppGameKit V2 Tier 1
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 17th Apr 2015 13:07
Hi,

I can only think of: render the background into an image and then apply your blend shader to it and the other sprite.


Using AGKv2 Tier1
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 17th Apr 2015 13:15
Is it possible to render the full particle scene onto an image with depth data. Then use a full screen shader to add this image to the scene when you make up your final render?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Apr 2015 13:49
Quote: "I can only think of: render the background into an image and then apply your blend shader to it and the other sprite."

Thanks janbo but I'd really like to use depth for sprites and I'm not sure how that would work...

Quote: "Is it possible to render the full particle scene onto an image with depth data. Then use a full screen shader to add this image to the scene when you make up your final render?
"

That sounds more promising although I can't help thinking there has to be an easier way. The current transparency setting must be using some hidden varying value to do additive blending surely? If I could see the code for that shader I'd be set, I just need to edit it so that transparent sprites can be used for additive blending. As usual with shaders the internet provides you with lots of guides to learn using shaders but very few practical examples.

In this case I'm pretty sure I just need to know what the missing variable is. I'd like to avoid adding multiple renders to the scene (sprite draw, depth draw, then fullscreen shader to blend the three renders) if at all possible.

Using AppGameKit V2 Tier 1
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Apr 2015 19:01 Edited at: 17th Apr 2015 19:03
Paul has come through for us here guys. After a few emails he suggested this change to my shader to allow black background images use the alpha transparency setting to adjust the transparency. Using the standard shader we can't edit the transparency without changing the rgb values manually. Use this shader alongside SetTransparencyOn(spr, 2) to get proper alpha transparent additive blended sprites:

[/gobbledegook]
Example in my particle editor:


Using AppGameKit V2 Tier 1

Attachments

Login to view attachments
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 17th Apr 2015 19:16
Stop distracting Paul with all this fun cool stuff! He needs to get 2.0.13 finished!

Your particle editor is coming along nice. Can't wait to see it working with the overlap levels! Great work!

V2 T1 (Mostly)
Uzmadesign
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Apr 2015 22:11
I'm not using Overlap any more, I'm going to build something specifically for AppGameKit using Windows Forms. The particle editor is just a small part of the level editor I'm going to make.

Sorry for distracting Paul but this shader makes additive blending much easier to use.

Using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2024-03-29 11:35:22
Your offset time is: 2024-03-29 11:35:22