Ok, unless it's PHP or mySQL related, I can't program worth shit. I've tried to learn how to create shaders, read tutorial after tutorial but it just ain't happening, they all seem to miss out the actual part where you want the shader to do something and instead focus on setting it up. Yeah no good.
So I'm making this request for someone to write an .fx shader for construct, using the following guidelines and information. It does nothing that shouldn't already be possible within the program, and even uses some known limitations to its advantage.
For someone experienced in writing .fx shaders, it should be childsplay. For someone like me, it's up there with reading C++ for dummies over the weekend and then writing an MMORPG from scratch - not gonna end well.
Credit and stuff like that, you wrote it, you get all the credit. I've just made this request is all, and really want to see one done, as I do have a great need for it lol. So anyone who cares about getting credit where it's due, don't worry on that score. Sell it as your idea afterwards and make millions all to yourself, lol.
Since a simplified version of this shader requires no depth, or 3D. I think it could work.
What it does/should do
Think of it (in this sense) as a self contained miniature parallax effect, because essentially that's what it is. But it must only work on the layer it's on, ignoring transparent area's of the layer (as is my understanding from what Ashley has said, a shader will not effect anything beyond their bounding box, which is perfect for this).
You have your image, for example a brick wall. This is the colorful pretty image the player sees. Above that you have a bog standard height map, black is the lowest point, white is the highest point, again nothing spectacular or never done before in construct. Set that one up to always follow the position of the brick wall.
The shader would then be applied to the height-map image, like with other available shaders. For it to work correctly, you would then have to tell it via an event, where the center point's X and Y is located in relation to the display window as well as the "imagined" depth of the height map.
This is where the fun begins - as the sprite moves away from the center point, the shader uses the grayscale height-map to push, drag and pull on the pixels below it. Each shade of gray moving slightly slower than the value above it. With the white 255,255,255 pixels moving the fastest, while the black ones don't move at all. This then in turn causes some pixels to be squashed (vanish to the eye) while others are stretched. If used carefully, this gives the impression of thinking you can see more of one side than the other.
Yeah, it's a down right dirty cheap trick, but it can work really well if it's not abused. Not only would you have your regular layers moving at different speeds with a nice parallax effect, but your chosen objects would also appear to have a kind of depth to them also.
Besides the usual on/off options, the shader should have the following available:
Center point X
Center point Y
These two options above tell the shader where the optimum point is for viewing the image with no distortion. Generally this would be the exact center of the display screen, but in many cases you might want it to follow the Y level of the player, or even control it by the mouse.
No, this isn't asking for depth in a 2D world. What this would do is basically tell the shader how fast to distort the white pixels in relation to the other shades of gray. A larger Depth Z would result in a faster distortion as the object moved away or toward the center point, while a lower depth would result in a more subtle distortion. Unfortunately I can't do the math for this bit, would be something like "move X pixels Y distance for every Z pixels away from the center point" ? I think, yeah something like that.
The user would have to fine tune the shader to their game, as screen size and sprite size would have a big part to play in getting it right. What depth Z setting would work for one game, could look terrible for another. Remember, the pixels are just being stretched and shrunk, so eventually at a certain distance, the entire sprites texture will be stretched beyond recognition by the shader.. Obviously you want this to happen off screen, so the player can't see it.
It wont make everything 3D, it's still a 2D trick and is only capable of creating a subtle effect which would be ruined by overdoing it (such as increasing the depth too high in the attempt to try make something look 3D). It'll break and result in badly stretched underlying sprite textures if the depth is too high. A rule of thumb would be the perceived distance between the pure black area's and the pure white area's should not be too great. Walls, deep surface textures etc. are fine, views from above a city with tall buildings are not.
It could bugger up collision detection in some cases (unless using containers and another object as the collision box), and IMO should just be used on background tiles and sprites for best effect.
It probably wont work on lower DirectX pixel shader versions. But as it's nothing more than a visual effect and not related to gameplay, I don't see that as a concern.
Like with using normal maps or shaders in general, it does practically double everything it's being used for. Though because the effect doesn't have to be pixel perfect, you can get away with using height-maps that are half or three quarters smaller than your sprites texture and still get a good result.
I'll note that it is similar to the sprite's distort options, however I've had little luck in finding useful tips on using distort maps, especially for creating something like this, and a shader would just do it all much more easily, at least that is my understanding of distort maps.. unless someone wants to make a cap doing exactly what my request for a shader would do *hint hint* lol. Though bare in mind, this shader effect would be usable on many, many, many different sprites of different shapes and sizes and appearance. Could a distort map also be used in such a way too, without it taking forever to create. While distort maps have their uses, I think this would be something best left to the proposed shader effect.