Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Android - Partial Transparency


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Shawn Greer   Members   -  Reputation: 148

Like
0Likes
Like

Posted 02 July 2012 - 02:03 PM

Hello all. I'm laying out the design for a game on the Android using openGL ES, and I've stumbled upon an issue that I can't seem to find a solution for. I'm looking to be able to draw something on the screen, like a wall, then have a character pass behind the wall. When the character is behind the wall, I'm looking to apply an auro of transparency on the wall in front of the character, enabling you to see the character behind, without making the entire wall transparent.

Any help anyone could offer any help, or at least point me in the right direction, I'd greatly appreciate it.

Shawn

Sponsor:

#2 SimonForsman   Crossbones+   -  Reputation: 6323

Like
1Likes
Like

Posted 02 July 2012 - 03:26 PM

There are a few ways you can do this.

You can first render the wall normally, then render the character without depthtesting (fairly simple but probably not quite the effect you're looking for)

you coukld also Render the wall twice, first at X% opacity without depthwrites, then render the character, then render the wall again at 100-X% opacity and additive blending.

Those two effects basically just make the character visible through the wall and might not be what you want.

You could also project the character onto the wall (in black or grey) (or the walls position rather) (towards the camera) and write that to a separate otherwise white texture, apply blur to the texture, render the character normally and finally render the wall using the greyscale characteroutline texture as the alpha channel. (There are probably faster ways to do this aswell).

Another option could be to render a scaled up version of the character to the stencil buffer and use that for a stencil test when you render the wall (works with fixed function), or render to a texture and process in the pixel shader (to get fancy edges for example), (With ES 1.1 the options are a bit limited, but with 2.0 you can do pretty much anything)
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#3 Shawn Greer   Members   -  Reputation: 148

Like
0Likes
Like

Posted 02 July 2012 - 10:24 PM

Simon,

I appreciate the quick response. I think your last idea is even better then what I was originally picturing. I think I'll give that a try and see how it works out.

Thank you!

Shawn




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS