The moral of my story was, what are shaders gonna do in 2d? Make sprites glow? And/or couldn't you already do it with alpha transparencies?
Firstly alpha transparency is very slow, also it doesn't look as good as shader ones, also to make exactly that with shader, you probably would need to modify rendering process. I think Jeff had in mind only postprocess shaders you only need to supply final frame to shader, so postprocess it, also some might need previous frame, but having all types of shaders would be very nice.
Possible post process uses:
With post process shaders it's possible to change colors, to black and white, sepia, negative or just dissort them randomly (like swap RGB channels to GRB). Could be used when player is drunk, stunned, confused, is wearing glasses and etc.
Also it's possible to add Bloom, HDR and other similar effects, they might look really good on games which use lightning, lights, shadows, reflections or just have scenes with high difference in scene lightness.
Blur, Motion Blur, Radian Blur and other Blur types are also post process, these mostly can use used to show speed or etc. It basically makes bright places even brighter, would look nice with some skills/spells (kamehame or etc XD)
Lens, Lens Flare and etc when looking at sun, also it can zoom in image with minimal quality loss. Lets say you are looking at sun, or near to the sun.
Also using edge detection, bloom and radial blur shaders, it's possible to make 'glow' around each wall/player/tree on players screen, like it's some magical stuff, mysticism or etc.
lol if peoples computers have trouble processing alpha transparencies you think they'll be able to handle advanced shaders?
There's probably a reason I haven't seen any of these shaders until the current gen of gaming...
lol if peoples computers have trouble processing alpha transparencies you think they'll be able to handle advanced shaders?
There's probably a reason I haven't seen any of these shaders until the current gen of gaming...
BYOND seems to use GDI/CPU rendering, not GPU, making whole screen alpha makes it lag =/
Actually, shaders nearly always were used, shadows are made using shaders, and nearly all games have shadows. Unless you could tell specific game, if you know any particular.
Edit:
Maybe it's only me, but I always have problems with BYONDs rendering performance, but I can run Crysis, Hellgate:London, Devil May Cry 4 and other games without any problems.
#8 Mar 15 2010, 7:57 am (Edited on Mar 15 2010, 8:02 am)
Actually, shaders nearly always were used, shadows are made using shaders, and nearly all games have shadows. Unless you could tell specific game, if you know any particular.
Any games on the ps1, 90% of the games on the ps2? Probably some crapily graphiced ps3 games...
Not to mention in all comparison I would put BYOND below the SNES, which obviously doesn't have any of these effects.
Most of these effects didn't come into play until the PS3 era, and the earliest game I can really remember them on was Oblivion. http://www.gamedev.net/community/forums/ topic.asp?topic_id=256746
Most of these effects didn't come into play until the PS3 era, and the earliest game I can really remember them on was Oblivion.
Are you trying to tell games before Oblivion didn't had shadows? That's false for sure. Not to mention Bump Mapping and other similar things.
Shadows are made using shaders, and even before Oblivion games had bloom, HDR, (motion) blur and other effects, which all are made using shaders.
There are Vertex Shaders and Pixel Shaders, they both are GPU specification, and all GPUs always had them even Pixel Shader 1 is shader, yes it's isn't as good as Pixel Shader 3 or even 5, but that's still shader, and it was used for shadows or other effects.
Shadows can be made using CPU, not only Shaders, but it's slower, and less possibilities, but shaders can be ran on CPU too, all the difference, Shader has direct access to memory, and current GPUs have many microprocessors, so they perform way better than CPU, which has to use motherboard to get one pixel on texture, and etc.
As I'm not familiar with the use of shaders outside of the context of 3D, you'll have to clarify that. Without 3D support I don't see how this would be feasible.
#13 Mar 15 2010, 8:51 am (Edited on Mar 15 2010, 9:05 am)
I think what may be getting requested here is more "filters" than "shaders"
Which just happen to be reffered to as "next-gen filters". Several PS3 games have options for them (which is partially what I was referring to when you posted "With post process shaders it's possible to change colors, to black and white, sepia, negative or just dissort them randomly") like RE5 and Uncharted 2 for example.
Depth of field and bloom exist in a few ps2 games, MGS3 for example, which was pretty much a highpoint of ps2 graphics.
How does that relate to BYOND though?
Dynamic lighting/shadows in 2d would be... confusing to work with, to say the least. Though maybe more applicable in ISO.
Not sure about the shadows there. They could just be pre-rendered textures that are cast off the models for the quality they're at. But they could be dynamic *shrug*. As you can see though, they don't exactly look like it.
As for that light saber "glow" that's nothing you couldn't already duplicate with alpha trans. That light saber isn't exactly casting the shadows like it should be, nor is it casting a green glow on the characters or surrounding area.
Anyway, wouldn't all of this require full client-sided graphic processing?
No, client side already does most of needed for this - draw everything. Post process takes final image (like screenshot) sends it to shader, and executes supplied code. If BYOND uses default render target, then you might need to create extra surface and texture, then copy backbuffer to this surface, so you get final image on the texture variable, then send it to shader.
//I'll use my Radial Blur post process as example, done using DirectX 9
//this I do only once, variable is global ID3DXEffect *fxRadialBlur; //define variable to store shader D3DXCreateEffectFromFile( device, "data/fx Radial Blur.fx", NULL, NULL, 0, NULL, &fxRadialBlur, NULL ); //load and compile shader from file to variable fxRadialBlur->SetFloat("Distortion",0.2f); //set parameters if needed fxRadialBlur->SetFloat("Strength",0.0f); //set parameters if needed
//this doing only once too, variables global too IDirect3DSurface9 *backBuffer, *tempSurface; //define variable to hold backbuffer pointer and our own surface LPDIRECT3DTEXTURE9 renderTex; //define variable for texture device->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&backBuffer); //get backbuffer D3DXCreateTexture(device,(unsigned int)WIDTH,(unsigned int)HEIGHT,1,D3DUSAGE_RENDERTARGET,D3DFMT_A8R8G8B8,D3DPOOL_DEFAULT,&renderTex); //create empty texture (reserves memory) renderTex->GetSurfaceLevel(0, &tempSurface); //append texture to surface
//this I do after all rendering, it copies rendered image onto texture device->StretchRect(backBuffer, NULL, tempSurface, NULL, D3DTEXF_LINEAR);
//setting up square, so it will have what to draw ScreenVertex svQuad[4]; svQuad[0].p = D3DXVECTOR4( -0.5f, -0.5f, 0.5f, 1.0f ); svQuad[0].t = D3DXVECTOR2( 0, 0 ); svQuad[1].p = D3DXVECTOR4( WIDTH-0.5f, -0.5f, 0.5f, 1.0f ); svQuad[1].t = D3DXVECTOR2( 1, 0 ); svQuad[2].p = D3DXVECTOR4( -0.5f, HEIGHT-0.5f, 0.5f, 1.0f ); svQuad[2].t = D3DXVECTOR2( 0, 1 ); svQuad[3].p = D3DXVECTOR4( WIDTH-0.5f, HEIGHT-0.5f, 0.5f, 1.0f ); svQuad[3].t = D3DXVECTOR2( 1, 1 );
//after calling StretchRect, backbuffer was copied into our defined surface, since it has texture appended, we can use that texture fxRadialBlur->SetTexture("Input",renderTex); //setting texture to shader
//render it fxRadialBlur->Begin(&cPasses,0); for( unsigned int iPass = 0; iPass < cPasses; iPass++ ){ fxRadialBlur->BeginPass(iPass); device->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, 2, svQuad, sizeof( ScreenVertex ) ); //this renders our square, texture onto it is applied by shader fxRadialBlur->EndPass(); } fxRadialBlur->End();
Only difference, you'd probably need to make array to hold shaders on clients side, then use them when needed, not all the time.
I think that's all the code you will need to make it work (except loading it from .rsc, and handling new packets as well as coding in DM).
As I'm not familiar with the use of shaders outside of the context of 3D, you'll have to clarify that. Without 3D support I don't see how this would be feasible.
SFML is a free, opensource 2D library that uses OpenGL and makes use of post processed shaders (they're called post effects in the library).
BYOND only needs few extra commands in it's language, so we can load Shaders, and run our own Techniques, instead of need to match them to specific pattern.
Edit: Lummox JR wrote:
As I'm not familiar with the use of shaders outside of the context of 3D, you'll have to clarify that. Without 3D support I don't see how this would be feasible.
Shaders such as Shadows, Pixel Motion Blur, Bump Mapping and others apply to 3D objects in space, while Post Processing effects take only 2D image, the final scene, BYOND has it, so it won't be any problem to add support just to that.