Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


Overlapping sprites with 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
3 replies to this topic

#1 MasterEvilAce   Members   -  Reputation: 124

Like
0Likes
Like

Posted 18 February 2012 - 10:22 AM

Posted Image

Using XNA 4.
I'm rendering a bunch of overlapping sprites to the screen based on a calculated layerDepth.
Any sprites that might conceal the player I draw with a transparent color in the draw function.
Is there a way to prevent visible overlapping edges in this scenario? (See corner block sides "doubling up" against the other transparent pieces)
Basically, I'd like the three partially-transparent walls to look like one object, without seeing the sides of the walls that you wouldn't normally see, if they were fully opaque.

Sponsor:

#2 Watermelon Chris   Members   -  Reputation: 104

Like
0Likes
Like

Posted 18 February 2012 - 11:24 AM

Nice graphics!

Anyway. One possible solution, you generate another 3 'blocks' yet the places where the overlap now you make half the opacity. You could then check when this situation occurs and hence replace the images with the 'half opacity' areas.

That's something I quickly thought up. But having it overlap doesn't look bad at all in my oppinion.

#3 ClassicThunder   Members   -  Reputation: 134

Like
0Likes
Like

Posted 19 February 2012 - 06:44 PM

If you are fine with rendering the sprites in a separate SpriteBatch or your RenderMode is Immediate you could alter the alpha blend function. I would suggest min instead of add.

http://msdn.microsoft.com/en-us/library/bb976070.aspx

#4 MasterEvilAce   Members   -  Reputation: 124

Like
0Likes
Like

Posted 01 March 2012 - 02:34 PM

I need to be able to do this all within one sprite batch, due to render order and performance issues.
I've been looking into BlendStates trying to figure this out, but there is a severe lack of tutorials / understanding on my part. I have to use the XNA "Reach" profile which seems to have some limitations on BlendState settings (unsure if this should affect what i'm trying to achieve.)

Basically, the objective (I believe) is basically to only draw the latest partially-transparent, if there are multiple transparent pixels at the same location. But figuring this out is tough without a good understanding.




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