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.

Author
Message
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 11th Jun 2010 16:06
Pretty much every 2D game nowadays uses pixel shaders, in XNA I believe you can apply shaders to sprites, and come to think of it, there sprite are draw via a SpriteBatch shader (I think). So basically how would we be able to replicate this in DBP, use of shaders with 2D that is.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
bergice
19
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 11th Jun 2010 17:12
I don't think that would be possible without using 3d planes?

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 11th Jun 2010 18:55
Yeah, that's what I thought. I was trying to work out how to scroll a level on a 3D plane so I could use shaders, but the drawing of level segments confused me ish. I came up with a few methods one being creating a 1 pixel width frame around all the pixel in the middle, so the edge of the scene, and using a cell system around the edge to check if something needed to be drawn (only when moving), if it did, that row or column of pixels from a tileset would be pasted around the scene. I improved upon this by adding a offset modifier to the drawing frame, so if the scene offsets more than 1 pixels between frames it would extend the drawing width or height.

At this point I was thinking, sure there a better way of doing this and looked at example of shader with non-3d. One being using an offscreen render target to render a number of sprites, then applies a pixel shader to the full scene. Obviously you couldn't do this in DBP, so I just, has someone asked the question before and here we are.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 11th Jun 2010 19:54
Quote: "Obviously you couldn't do this in DBP"


Couldn't you? I'm still exploring the shader world, but I bet there is a way.

create a flat plane and set it up in front of camera 0
set the shader effect on that object
create a new bitmap
render your background and sprites
grab the image
switch back to bitmap 0
texture your plane with the image

I may be off a little bit on the exact procedure, but that should be close.

Remember to use PASTE SPRITE or they wont show up on your grabbed image.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 11th Jun 2010 20:08 Edited at: 11th Jun 2010 20:08
Hmm...

1. Create a flat plane and set it up in front of camera 0
2. Set the shader effect on that object
3. Create a new bitmap
4. Render your background and sprites
5. Grab the image << this would be a framerate killer
6. Switch back to bitmap 0
7. Texture your plane with the image

Number 5 is the problem, way to intensive.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 11th Jun 2010 20:54
If 99% of the program is 2D, there shouldn't be a performance issue.

GET IMAGE really isn't that bad, and there are ways to compensate.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 11th Jun 2010 21:19
Quote: "GET IMAGE really isn't that bad"


Umm... you've used GET IMAGE right, it's incredible intensive. If you grabbed just 320x240 ever frame, you could possibly lose over 3000 fps. Now include the fact that you'd be grabbing a bigger area, pasting everything to the bitmap, possible transform collision checks (rotating collision stuff), AI, player input, shaders and tons of other stuff, it would be like committing suicide.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 11th Jun 2010 21:28
ImageKit has a faster get image command.

Rawwrr. Sig Fail.
Newcastle is awesome
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 11th Jun 2010 22:39
Quote: "ImageKit has a faster get image command."


It hasn't . ImageKit doesn't come with a replacement for get image. But it comes with quicker ways to manipulate images.

For the moment it uses pixel shaders to achieve several effects for render targets though. Perhaps I can include custom pixel shader support in a later update (yes I'm planning on updating it after the exams have ended). Pixel Shader support for images has been stuck in my mind for a while now.

Cheers!
Sven B

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 11th Jun 2010 23:05 Edited at: 11th Jun 2010 23:05
Quote: "For the moment it uses pixel shaders to achieve several effects for render targets though. Perhaps I can include custom pixel shader support in a later update (yes I'm planning on updating it after the exams have ended). Pixel Shader support for images has been stuck in my mind for a while now."


Sven, that would be Awesome, but for now... Good Luck on your exams

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Alfa x
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 12th Jun 2010 00:04
I look forward for it too.

I have a question Sasuke,
what uses have shaders on 2d images or sprites?.
Its is similar on doing a 2.5d with shaders?.

Cheers.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 12th Jun 2010 00:15
Quote: "It hasn't ."


Really? Haven't a clue what i'm on about then!

Rawwrr. Sig Fail.
Newcastle is awesome
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 12th Jun 2010 01:34 Edited at: 23rd Jun 2010 23:54
Alfa x, though the overall effect of the game is classed as 2.5D in which it use Parallax scrolling, it's only layers of 2D sprites. And I want the shader to either effect a sprite or a layer, so I'm technically only working with 2D when it come to the effect I want. As for uses, it would be post processing effects and image blending effect. If you seen the game Braid, the there's the kind of effects I'm taking about.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.

Login to post a reply

Server time is: 2026-07-25 16:22:00
Your offset time is: 2026-07-25 16:22:00