Soft filter?

Posted By: Orange Brat

Soft filter? - 02/18/04 22:50

Has anyone tried their hand at a shader that would soften up the view? Prince of Persia: The Sand of Time uses something like this to give it that storybook, wispy feel:

http://www.princeofpersiagame.com/

A comparable look, in film, would be from Sky Captain and the World of Tomorrow..it makes heavy use of it:

http://www.skycaptain.com/downloads/SkyCaptain07_1024x768.jpg

http://www.skycaptain.com/downloads/SkyCaptain03_1024x768.jpg
Posted By: Drew

Re: Soft filter? - 02/19/04 04:34

Yes please someone help!!!!
There is a great example from Render monkey (since allot have been converted from there) called Gold glow or something... WE NEED THIS
Also, Depth of field... the two combined would make stunning visuals...

Posted By: Orange Brat

Re: Soft filter? - 02/19/04 04:37

Yep, depth of field would be great, too. Some nice stuff can be achieved with that one.
Posted By: ello

Re: Soft filter? - 02/19/04 06:27

how about using the camera.transparence trick in a special way. maybe using a second view also transparent which moves fast to randompositions in a certain radius and set to lower alpha.
i just saw something like that yesterday when playing around. i used then the brightflag and got a very fast but smooth overdraw blending. looks like some kind of gaussianblur. add brightflag.

here are two shots of what i am talking about:


i think there are only slight modifications to be done. and it should also get tested on regular models,but...
however, if we get those shaders to the whole level, it .... stop.., here we go... render to texture(flat but highpoly(better in/output) model set proper to fill the whole screen..), and a pixelshader which performs the gaussian blur, or whatever. if we get this idea done, we can kick da ass*

but maybe this does not work lets have a look... and maybe you just have to use something like the fur shader onto everything

Posted By: Marco_Grubert

Re: Soft filter? - 02/19/04 08:21

There was an article in GameDevelopers magazine (www.gamasutra.com) a while back on rendering as done in the game Black&White. They used three different scene renderings with RenderToTexture using different sized textures, and then collated those three renderings into one if I remember correctly. This way you get a fuzzy image in the back, a moderately crisp one in the middle and a sharp one close to the camera.
My concern with this technique is that RenderToTexture is unpredictable, depending on graphics cards and used to be SLOOOW on some. With Radeon 9800s and FX5600s there shouldn't be any problems, but it might be a gamble with older ones. If you want to avoid this potential problem, then going with ello's recommendation is probably better: jitter the camera position slightly and render the scene full-screen with varying alpha transparencies. There is an introduction to this in the OpenGL red book.
Posted By: Drew

Re: Soft filter? - 02/19/04 13:32

Rendermonkey has an amazing depth trick...but it might be DX9.. are there dx8.1 depth shaders out there? I cant find one yet... I have a radeon9600 mobile, and its screaming fast,especially with the this, the "mother of all depth and glow" demos...

http://www.daionet.gr.jp/~masa/rthdribl/index.html#System





Here is a great glow example from the same demo...glow,depth of field, and refraction...wow




Posted By: ello

Re: Soft filter? - 02/19/04 18:00

hmm, what happend there. did someone change my post? i posted two different images. just curious.
here the second again:


yes, drew. those are impressive, and as i saw those at the 64k demos, i think its not dx9, as this wasnt available then..
Posted By: VoodooFactory

Re: Soft filter? - 02/21/04 04:35

To get back to topic, I think a combination of a toon shader and the fur shader would do the trick. In most render engines(maya for example) the softfilter as you call it, is called glow and is actually a post effect. What it does, is make every pixel a colored light, which produces a glow or lightfog effect.
Posted By: 3DM_SunsetDown

Re: Soft filter? - 02/24/04 03:37

Yeah,
some kind of effect would be great in GS!

Posted By: Drew

Re: Soft filter? - 04/03/04 09:58

PLEASE! PLEASE! PLEASE! PLEASE! PLEASE!

I cant do it myself, if ANYONE could please try a shot at a glow shader and/or depth of field, you will be my hero and get a major credit in any game I use it in!!!

PLEASE!

Posted By: Matt_Aufderheide

Re: Soft filter? - 04/03/04 18:59

the only way to make a glow shader is to use render to texture.... What you do is render the camera view to a flat view entity in front of the camera and then blur it with a pixel shader.. and then make the whole thing translucent. However as you do not have direct control over the frambuffer in gamestudio it may be hard to sync the images...I dont have a pixel blur shader offhand but an example should be available somewhere.
Posted By: Drew

Re: Soft filter? - 04/04/04 10:49

thank for the info
Theres no way for me to do it myself, All my skills are in art... I would happily trade assets with anyone that can do it... or maybe even pay... I really need it
Thx
Posted By: Homey

Re: Soft filter? - 04/10/04 16:01

I noticed over at blitz3d they have done a couple effects like this without shaders.

Sand of time effect by filax
Submitted: 1 month ago
No. of ratings: 37
Average rating: 4.54 / 5



This is the only info the Author gave about it.
Quote:

this technique use dynamic sprite blend
in front of camera.




And then theres this 1 which is really cool.



Authors quote:
Quote:

It's a special blend of motion blur, high dynamic range and depth of field to give a dreamy feel to the scene.




Unfortunatly none of the code for these is available so its hard to figure out what there doing exactly.

If anyone knows how to do any of these effects it would be greatly appreciated, and would be awesome if it could be done without using shaders so it work on all hardware.

Thanks in advance
Posted By: Orange Brat

Re: Soft filter? - 04/11/04 02:29

Those are pretty nice...I esp. like the light beams in the bottom. The only problem I've encountered placing sprites directly in front of the camera is that it can destroy the framrate if you run your monitor refresh at higher refresh rates.

If I have my monitor set at 1600x1200 with a refresh of 65 and run my game at 1024x768 and then put a sprite right in front of the screen, my fps dips from 75 to 30-45. If I run everything the same but the refresh is at 60, it will remain at 60. Likewise if I run the monitor at 1024x768 and use a higher refresh like 85 or up, and run the game at the same resolution, the fps will dip to similar numbers but remain maxed out without the sprite.

This is one reason why the two screens with the glowy fog in my newest screenshot update have been altered to no longer have that look.
Posted By: Joey

Re: Soft filter? - 04/11/04 06:03

You could add a glow filter by copying the current frame onto a sprite which is rendered in front of the camera and which has the bright-flag set. In static picture manipulation you use the same technique and you get great results.
Strength can be adjusted by the blur radius or the sprite's alpha value.

JOEY.
Posted By: Homey

Re: Soft filter? - 04/11/04 13:49

Hiya All,

Going off what Joey had said I thought I'd try the render to texture method abit.
Keep In mind that I have the effect turned up "full blast" and theres still a few kinks in it.

Heres a couple shots in a crummy test level,
when adjusting the alpha abit and set in a better indoor scene it doesnt look too bad.



Next im going to set up materials
for the sprites, this will allow for
alot more control over color and detail..
Posted By: Drew

Re: Soft filter? - 04/11/04 14:08

I beg you to share!!! !!!
Posted By: Julius

Re: Soft filter? - 04/11/04 20:14

Homey, PLEASE tell us exactly how you did your/Joey's blur effect!
It would like REALLY COOL added to in-game slow-motion effects, or when the player goes into some "special play mode" using "some special powerup."

Julian
Posted By: Nadester

Re: Soft filter? - 04/12/04 00:32

To get that effect in the 1st Blitz sample is not very difficult at all. The method I know requires you to render two camera views, 1 that is normal and 1 that is very very very blurred. Then make the blurred one 50% transparent (or less) on a layer on top of the regular camera. It gives that sort of dreamy blurry effect, although the shapes are still distinctly made. I don't know if this is possible with 3dgs, and if it is it I have no idea how to do it Try it out with a screenshot in photoshop, it looks really neat. (I'll post something here if I have the time later)
Posted By: Nagashi

Re: Soft filter? - 04/12/04 02:34

Is it possible to make a single blurred view in 3DGS? If not the method of two cameras is out of the question.
Posted By: Joey

Re: Soft filter? - 04/12/04 05:42

Joey's blur effect... sounds cool... I'm famous *gg*.

The problem with this technique is that you have to blur the sprite's bitmap with gaussian blur or a similar technique. Otherwise you'll see edges and blurry pixels like in the sample above (not that that'd be bad - I find it's great!).

If you invert the bitmap (without blurring it), you can adjust the level's contrast (by changing the alpha value).

If you invert and blur the bitmap, and then subtract it from the view, you get a dark-dream-like effect (as if you were dreaming of a dungeon).

If you blur the bitmap in direction of the camera movement and add it to the view you get a great motion-blur effect.

Many static image filters work with adding/subtracting/mixing (anyhow)manipulated copies to the pictures. I think that there can be taken out a lot for programming shaders.

JOEY.
Posted By: Orange Brat

Re: Soft filter? - 04/12/04 09:01

Are the light beams in the DreamFilter a result of the technique or are those simply a part of the scene.
Posted By: Nagashi

Re: Soft filter? - 04/12/04 12:33

There is a great executable demo of the Egypt scene posted by Homey above. here is the link egypt.zip there is no source with this and from the looks of things on the site the author is probably not willing to give this information up (but I didn’t ask so who knows) regardless, with the working demo you can see the idea “render to image, blur image, display image” and it runs very very well tested it on my 533mhz Cpu, 320 mb Ram, 64mb NVIDIA Geforce, with no speed loss.

P.S. the demo flickers a bit when you walk around, just ramp up the size, for the effect and it looks really nice, (and still runs well).
Posted By: ello

Re: Soft filter? - 04/12/04 17:53

anyone thought of using render to texture on a plane(aligned infront of the camera) and then applying the fur shader? this could do great jobs(but maybe a fps-killer??) i dont know;-)
Posted By: fuxerz

Re: Soft filter? - 04/13/04 00:45

hey i tried with sprites and here are the results:
glow:

w/o glow:
Well its not perfect but it gives the idea of glow
Posted By: Julius

Re: Soft filter? - 04/13/04 07:26

@ello and everyone else trying to use a render_to_view soft effect:

wouldn't there be render to view weaknesses when using render to view for a soft shader?

the view would be rendered onto the sprite, the sprite is transparent and softens it up however it does it, then (on the next frame), the view is rendered onto the sprite, but the view already includes that sprite, so it increases the effect, and this would continue and eventually lead to a fuzzy white view, right?

Julian
Posted By: ello

Re: Soft filter? - 04/13/04 15:29

not if u use a nontransparent plane model used directly before your eye
Posted By: Julius

Re: Soft filter? - 04/13/04 18:09

Your probably right, (you ARE the FX master) but could you please explain how that works?

Julian
Posted By: Joey

Re: Soft filter? - 04/13/04 19:04

i thought that you use a variable transparent sprite in front of the view. then you render the camera to the bitmap of the sprite while it is invisible. then you blur the picture (or transform it elsehow - described below) and turn it back to it's previous transparent value. by adjusting alpha and the blur radius, you can control strength of the effect.
with a shader (or by the 'bright'-flag) you can either set addive, subtractive or multiply to the sprite and maybe invert it, too. by combining those effects you get great effects.

examples:

  • addive + blur => glow
  • subtractive + invert + blur => negative glow, dreamy, dark effect
  • addive || subtractive + invert + glow => control over contrast and brighteness
  • subtractive + glow => ugly effect (looks like a bad painting ;-)
    ...


hope you now understood what i meant.

JOEY.
Posted By: ventilator

Re: Soft filter? - 04/13/04 19:10

hm... isn't this a recursive explanation?

to do a blur effect you have to render a transparent sprite in front of the camera with a blur effect.
Posted By: ello

Re: Soft filter? - 04/13/04 19:24

in my mind the only way would be to use different passes with transparency and slightly different positioning to get the blur (just like the furshader works, but another way of positioning).
i dont think that a blur can be done in a single pass using blurformulas as u dont get the values of the neighbour-pixels
Posted By: Joey

Re: Soft filter? - 04/13/04 23:18

but how would you do it in a multipass-technique? that won't be possible, neither.
how do the rendermonkey-examples work, and how many passes do they use?
Posted By: VladWorks

Re: Soft filter? - 05/08/04 14:41

A small test map would be nice for us graphic noobs! Whats 2 or 3 mb's...
Posted By: Orange Brat

Re: Soft filter? - 05/28/04 01:03

Here's a new Gamasutra article on realtime glow/blur using DirectX 7, 8, and 9:

http://www.gamasutra.com/features/20040526/james_01.shtml
Posted By: Drew

Re: Soft filter? - 05/28/04 02:14

NICE! theres hope...
Posted By: Cellulaer

Re: Soft filter? - 05/28/04 05:56

Based on the Gamasutra article I got blur working in 3DGS. It uses render to texture so it will probably only work in commerical and pro. You need a 320x240 white pcx named 320x240.pcx in the path. You need to be running at 1024x768.

If you want to increase the blur you need to use a smaller image like 160x120 or 80x60. You also need to change the blurcam size_x and size_y to the same size as the image. Additionally you need to change the blurmap.x to fit the blurmap perfectly on the screen. 277 is perfect for 320x240. 69 is perfect for 80x60. Other resolutions (like 800x600) require a different blurmap.x.

As stated in the Gamasutra article there are artifacts but these can be mitigated by increasing the alpha of the blurmap. Making the blurmap less transparent also increases the blur. There will probably be less artifacts the more you blur too (less at 80x60).

---

Explaination of how it works:

You have Camera and Blurcam. Blurcam takes the exact same picture that Camera does except that it does NOT include blurmap in the picture. Camera has a view entity on layer 1 named Blurmap. Blurmap is a sprite (basically a panel) that is 320x240. Blurmap is transparent. Blurcam renders itself to Blurmap (render to texture). Blurmap (a 320x240 texture) is stretched across the 1024x78 view causing it be "blury" except that blurmap is also transparent and therefore you have the regular view and then the blury view superimposed on top.

Frame rate: The only frame rate hit you take is from the extra 320x240 render per view that Blurcam has to render. The blurrier the less of a frame rate hit you take (because the Blurcam render is smaller).

The frame rate hit I noted was LITTLE to NONE.

---

entity blurmap
{
type = <320x240.pcx>;
layer = 2; // display above view entities with layer 1
flags = visible,transparent;// visible on screen from the start
view = CAMERA; // same camera parameters as the default view
albedo = 0; // gouraud shading from sun position
x = 277; // place 277 quants ahead of the view
y = 0; // center horizontally
z = 0; // center vertically
}

view blurcam
{
layer = 0;
pos_x = 0;
pos_y = 0;
size_x = 320;
size_y = 240;
offset_x = 0;
offset_y = 0;
flags = visible;
}

function main()
{
blurmap.alpha=50;
blurcam.bmap=bmap_for_entity(blurmap,0);
cameramove();
}

function cameramove() {
proc_late();
while(1) {
vec_set(blurcam.pos,camera.pos);
vec_set(blurcam.pan,camera.pan);
wait(1);
}
}

---
No blur:



Blur (320x240):



Blur (80x60):


Posted By: alienheretic

Re: Soft filter? - 05/28/04 10:23

cool how do ya get the stretch part working? and where did 277 calculation come from?
Posted By: qwerty823

Re: Soft filter? - 05/28/04 10:31

Quote:

It uses render to texture so it will probably only work in commerical and pro.




render to texture is pro only
Posted By: alienheretic

Re: Soft filter? - 05/28/04 10:38

i Have A6 Pro 6.22 i can see the blur map but it stays at 320 x 240 with the code above
Posted By: alienheretic

Re: Soft filter? - 05/28/04 10:43


Posted By: Cellulaer

Re: Soft filter? - 05/28/04 12:25


On the blurmap entity, X is the distance from the camera. You should be able to lower X (the distance from the camera) to make the entity bigger in the view. Keep lowering X until if completely covers the view. Maybe A6 is different in how far away X is from the camera.
Posted By: Drew

Re: Soft filter? - 05/28/04 12:27

I cant believe commercial users cant use this..WHAT A MAJOR BUMMER (conitec!).
Posted By: Cellulaer

Re: Soft filter? - 05/28/04 12:46

For Commerical users you can modify it to the following and you'll have motion blur but it is slow (about 10 fps) until I can come up with another method. Can commerical users access camera.bmap at all? ->

function main()
{
blurmap.alpha=50;
//blurcam.bmap=bmap_for_entity(blurmap,0);
cameramove();
}

function cameramove() {
proc_late();
while(1) {
vec_set(blurcam.pos,camera.pos);
vec_set(blurcam.pan,camera.pan);
bmap_for_screen(bmap_for_entity(blurmap,0),1,0);
wait(1);
}
}

---

Do shaders have access to the screen texture?

Posted By: Cellulaer

Re: Soft filter? - 05/28/04 13:44


I'm using three layers (a 320x240, a 160x120, and a 80x60) now in my blur effect. It does reduce your frame rate but it is based on the fill rate of your video card and doesn't have much to do with the polygon count that is on the screen at the same time. There shouldn't be much of a hit with one layer. You will get a hit with one layer when you use particle effects at the same time as that will require more fill rate.
Posted By: Drew

Re: Soft filter? - 05/28/04 15:33

whew! yeah the fram rate is low on that..cool motion blur though thanks
Posted By: Julius

Re: Soft filter? - 05/28/04 16:33

you need to move the blurmap closer to the screen, just so it covers the picture.

Julian
Posted By: qwerty823

Re: Soft filter? - 05/28/04 23:03

Quote:

Can commerical users access camera.bmap at all? ->



Nope, gives them a reason to want pro.

Quote:

Do shaders have access to the screen texture?




What do you mean by screen texure? Are you refering to a view entity sprite or the actual backbuffer that gets rendered to?

Some things you could do, turn off the camera or try setting camera.bmap to a screen size texutre (warning, some vid cards limit render texture sizes, but you can probably do the same trick you are using now). You should be able to apply a material to the view entity that has a shader effect (just ask ello, he does it all the time).

For the non-pro people, upgrade. J/K. One thing you can do that will kind of get you some blur type effects, is to create a second camera (or third) and set it to transparent, and to a higher layer then the default camera. Then in a loop, set its x/y/z pan/tilt/roll to the camera's. Then change its arc/aspect to be slightly off from the main camera's. This will give you essentially a double render of the image, and with the right values, a decent blur look. Not sure how the second camera render will affect it.

As to the soft filter type shader, heres an idea i had.

Do it in three passes, first pass will be a slightly larger version of the model, using a soft color, and feathering the alpha at the model edges (based on the normal). Second pass renders's as normal. Third pass will need to be slightly smaller then the model, and be similar to the first pass, but somehow blend with the previous pass. If anyone thinks that might work, feel free to try it. I would if my time wasnt so limited, as I barely have time to read the boards.
Posted By: Taros

Re: Soft filter? - 05/31/04 01:21

Here is a glow code i made for fun. I just modified the blur code found on this topic (pro only but maybe you could do something with multiple views, dunno ):

Code:

entity blurmap
{
type = <320X240.tga>;
layer = 2; // display above view entities with layer 1
flags = visible,transparent;// visible on screen from the start
view = CAMERA; // same camera parameters as the default view
albedo = 0; // gouraud shading from sun position
x = 278; // place 277 quants ahead of the view
y = 1; // center horizontally
z = 1; // center vertically
}

entity blurmap1
{
type = <320X240.tga>;
layer = 2; // display above view entities with layer 1
flags = visible,transparent;// visible on screen from the start
view = CAMERA; // same camera parameters as the default view
albedo = 0; // gouraud shading from sun position
x = 278; // place 277 quants ahead of the view
y = 2; // center horizontally
z = 2; // center vertically
}

entity blurmap2
{
type = <320X240.tga>;
layer = 2; // display above view entities with layer 1
flags = visible,transparent;// visible on screen from the start
view = CAMERA; // same camera parameters as the default view
albedo = 0; // gouraud shading from sun position
x = 278; // place 277 quants ahead of the view
y = 3; // center horizontally
z = 3; // center vertically
}

view blurcam
{
layer = 0;
pos_x = 0;
pos_y = 0;
size_x = 320;
size_y = 240;
offset_x = 0;
offset_y = 0;
flags = visible;
}

view blurcam1
{
layer = 0;
pos_x = 0;
pos_y = 0;
size_x = 320;
size_y = 240;
offset_x = 0;
offset_y = 0;
flags = visible;
}

view blurcam2
{
layer = 0;
pos_x = 0;
pos_y = 0;
size_x = 320;
size_y = 240;
offset_x = 0;
offset_y = 0;
flags = visible;
}


function cameramove() {
proc_late();
while(1) {
vec_set(blurcam.pos,camera.pos);
vec_set(blurcam.pan,camera.pan);
vec_set(blurcam1.pos,camera.pos);
vec_set(blurcam2.pan,camera.pan);
wait(1);
}
}

function activate_blur()//put this in your main function
{
blurmap.alpha = 60;
blurmap1.alpha = 50;
blurmap2.alpha = 40;
//blurmap.material=mat_glow1;
blurmap.bright = on;
blurmap1.bright = on;
blurmap2.bright = on;
blurcam.bmap = bmap_for_entity(blurmap,0);
blurcam1.bmap = bmap_for_entity(blurmap1,0);
blurcam2.bmap = bmap_for_entity(blurmap2,0);
cameramove();
}





A couple of screenshots (copy/paste them to your browser):

http://dimenzije.topcities.com/with_glow.jpg

http://dimenzije.topcities.com/no_glow.jpg
Posted By: EX Citer

Re: Soft filter? - 05/31/04 16:34

looks fantastic. Who wants to sell his pro version very cheap to me?
Posted By: ello

Re: Soft filter? - 05/31/04 18:06

shaders produce problems on aome nvidia gpus. my radeon works all out, but when i want to show it a friend with a geforce (fx5600 for example) the render to texture shows up, but with no shader on it. using shaders on such things is really cool:)
i found out that simply passing the vertexshader by mov oT0,v7 ... and only doing some manipulations like negating it works on nvidias too, but if you want mor, say you use normals in the vs nvidias go down
Posted By: hondarider

Blurmap effect and screen resolution - 11/26/04 04:34

Hello All!

I'm trying out the blurmap effect elaborated by Cellulaer.

It works fine with the initial 640x480 pixel screen resolution.
However, when I press the F5 key to increase the screen resolution,
a strange thing happens:

the monitor goes black and sounds like it is switching back and forth
between resolutions. Finally, the computer gives up, interrupts the
program and puts up an error message. What is even more strange is that
the effect works fine if I change the video_mode variable by hand in
the script itself before running the level.

Has anybody else observed the same phenomenon? Might this be some kind
of interaction between the Acknex camera scripts and the blurmap script?
Or is it something which has to do with the bmap_for_entity command itself?

Thanks!

Thomas
Posted By: EX Citer

Re: Soft filter? - 11/26/04 17:35

is this shader working with DX9? And is the wikipage updated?
Posted By: hondarider

Re: Soft filter? - 11/28/04 03:37

Yes blurmap is working fine with the DirectX 9c provided by Conitec.

I wouldn't know about the wiki page though since I took the blurmap from the original forum post by Cellulaer. However, I did noticed that the fur, toon and hatching shaders posted on wiki do not seem to work in A6.3. On the other hand, they work fine in A6.2 with DX9. One of the reasons why I went back to A6.2.

Question: Is it correct to talk about "shaders" in the case of the blurmap effect since it only uses the bmap_for_entity function to map a view onto a sprite. I'm wondering because, from what I read in the manual, I thought shaders were a special type of rendering at the pixel or vertex level.

Thanks,

Thomas, aka Hondarider
Posted By: Matt_Aufderheide

Re: Soft filter? - 11/28/04 04:20


The reason it works in 6.2 and not 6.3 is that 6.2 doesnt use dx9 to run-- it still uses dx8. 6.3 is fully dx9 however.
Posted By: ello

Re: Soft filter? - 11/28/04 05:46

you can apply load the following fx-file into your rendertarget's material:
blur_fx
Posted By: hondarider

Re: Soft filter? - 11/28/04 05:47

So does this really mean that DX9 contains DX8 but with the addition of new functions? I was under the impression that DX9 was new from the ground up.
Posted By: hondarider

Re: Soft filter? - 11/28/04 05:59

Thanks Ello!

Hum! This is way out of my league. I am guessing that this code will bypass the processes of creation of a view and the bmap_for_entity statement used to map this view on a sprite.

Am I right, or completely off the target and I have to use blur_fx with the original blurmap effect written in C-script language?
Posted By: ello

Re: Soft filter? - 11/30/04 06:28

of course you need to render the view to a target first and then apply the blur shader to it
© 2024 lite-C Forums