Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm creating application in XNA 4.0 and am trying to create a specialized background. I'm familiar with the creation of a parallax scrolling background but I'd like to create a background image that appears to be draining into a hole. The issue is that I'd like the drain/black hole to exist in a variable location on the screen so it would be nice to be able to adjust the location of the background. Is using a background for this even a good idea? Maybe it'd be easier another way? Is there a term for this sort of background or is it just a modified version of parallax? Thanks!

share|improve this question
    
This is nothing like a parallax background. Just wanted to point that out. –  Jon Dec 30 '11 at 23:26
2  
I actually can't see any connection between this and parallax scrolling. Could you try to find a video or something of the effect you want? The closest I can imagine is a particle system where the particles rotate in a spiral around a certain point, and are more dense near the center, but not at the very center area (which would be the hole itself). Also, do you want to apply this to any image, or you're trying to create a spacefield? –  David Gouveia Dec 30 '11 at 23:27
    
I don't believe it would be applied to a specific image, but it would be centered on an image. I could possible use a particle effect. I hadn't considered that. I was hoping for a collection of background images that I could overlay since I figured the processing requirements would be less intense. –  McArthey Dec 30 '11 at 23:37
    
I think the case can be made for a parallax background if you're viewing the black hole from its side. It is like being on a body of water with a big whirlpool in the distance, so you will see a lot of constant sideways moving in one direction. –  ChrisC Dec 31 '11 at 0:23

1 Answer 1

up vote 5 down vote accepted

Not sure what you are asking, if you could find a video or picture of something similar that would be great.

However, I'm assuming you want something to this. enter image description here

The easiest way to do this would be with post processing. You could create a shader that would you could pass a point each draw call. It would make any pixel within a certain distance black. I would then suggest a range in which the shader would "pull" the sampling from the original texture towards the point towards the point causing the texture to stretch as if its being sucked in. Out side of the outside edge of that range the shader wouldn't effect anything.

Edit to add in info from comments on how to implement the above idea:

MSDN Sprite Effect Sample

The useful GameDev thread David Gouveia found

share|improve this answer
    
Yes, this is similar to what I'm thinking. I'm not familiar with shaders so I will look into that. Obviously I am just learning and experimenting so I appreciate the guidance. –  McArthey Dec 31 '11 at 2:59
    
Glad to help. I know the sheer number of concepts can be overwhelming at first. I suggest you look at the sprite effects sample. The shimmer effect is implemented in a very similar way that the stretching should be if I remember correctly. create.msdn.com/en-US/education/catalog/sample/sprite_effects –  ClassicThunder Dec 31 '11 at 3:10
2  
I also recommend this. I googled a bit and found this. The guy figured it out, and posted his solution which should be helpful. –  David Gouveia Dec 31 '11 at 3:11
1  
Wow me and the OP of that thread have the same name and found the same picture. I've found my doppelganger. –  ClassicThunder Dec 31 '11 at 3:15
    
@ClassicThunder Or maybe it was you. Any severe memory loss in the past year? :-) Also, feel free to edit the link (and/or the shader) into your answer. It might pass unnoticed in the comments. –  David Gouveia Dec 31 '11 at 3:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.