Flag waving in the wind (SM2-Vertexshader) .blend

This one is a simple Vertexshader which makes a flag moving in the wind. Can easily be incorporated in you own games. Have Fun. If somebody else could add a screenshot, i’d be grateful. If not i will add it later, when i am sitting at my own machine.

http://blendpolis.de/f/viewtopic.php?t=11944&highlight=flaggenshader

and another one by SaphireS:

http://blendpolis.de/f/viewtopic.php?t=13893&highlight=flaggenshader

Can you post a pic for those of us without fancy shader support :)?

Thanks

when I hit the download button on your host site… it just shows me a text file… this supposed to happen?? try savefile.com (English) it work’s quite well… maybe you need a German site?

@kirado: There is a alternative fileho link just above the other one, targeting this very problem. No Savefile no, Savefile sucks badly, it’s slow as hell.
And yes i need that german site, cause it is (as you have noticed) also for the BLENDPOLIS users. It saves me from uploading twice and (the reasons why you wrote it, i guess) boosts shamelessly my popularity,hehe.
BTW, i think this one, very mine shader, sucks, but nobody complaint, why? Tell me where it sucks and i will improve it.
@redteam_spartan : You are right. Here you go:

http://img120.imageshack.us/img120/2999/blender20070123004918155fy.jpg

Here, I whipped up a simple flag texture for you. Unfortunately, while making it the GIMP crashed and I hadn’t saved it as .xcf, so I decided to leave it as is, since it was a tad tedius. Doesn’t look great, but probably a little better than the world flag.

http://i140.photobucket.com/albums/r6/ktbluear/Flagtest.png

http://i140.photobucket.com/albums/r6/ktbluear/Flag.png

Ya damn kids and your new fangled shaders :rolleyes:

My radeon 9250 doesn’t support them :frowning:

@Dim

Man I love that song! One of my fav Sabbath songs, paranoid :smiley:

-sweet flag…

3d penguin… did you program the shader yourself… I’m asking because if you did you could make a sweet grass shader… like a flag but more 2d… you have a flat plane/grid and you move the top line of vertices with a cosin type wind… I’m sure you could figure it out… (I have know idea how to program gLSL… just understand the theory mostly)

I have a code snippet of one you could use for reference if you interested…

@Dim: Hey nice flag, reminds me of blackbeard. Very cool worn out look. What is the meaning of the symbol you used?

@kirado: Yes, by myself. It’s fun with Blender. It makes me see mathematical formula changing very fast over time. Your proposal is interesting, i’ll think of it. Please publish what you have so far. I have seen this grass shader example at Shadertech.com but could not run it, cause i have an ati-card and they don’t run half of the cg shaders. So if i write a shader for a single piece of grass, there has to be some python part which distributes it pseudorandomly and properly orientates them according to the wind direction. Sounds feasable. Could you help with the Python part?

hey 3d-penguin

here the code snippet… I got it off this french site that makes a program called Hyperion… it’s basically a render engine that uses XML to setup scenes and render GLSL shaders… I don’t know if there are Ati problems with it… but here is the link to the site… it has some cool tuts on it…

-code snippet from there tut for grass shader… they only use the GLSL for the vertex movement… not for the placement of the grass planes… there are comments in the example…

link to where I got the code for the grass shader from on the ozone3d site…

[Vertex_Shader]

uniform float time;
uniform vec2 vDelta;
varying vec2 texCoord;

void main(void)
{
    vec4 displacedVertex;
    displacedVertex = gl_Vertex;
    
    float len = length( displacedVertex );
    
    if(gl_Vertex.y>=10.0)
    {
        displacedVertex.x += 5.0 * sin(time + len);
        displacedVertex.z += 5.0 * cos(time + len);
    }

    gl_Position = gl_ModelViewProjectionMatrix * displacedVertex;      
    texCoord = gl_MultiTexCoord0.xy;
}

[Pixel_Shader]

uniform sampler2D colorMap;
varying vec2 texCoord;

void main (void)
{
    gl_FragColor = texture2D(colorMap, texCoord);
}

I don’t know much python but snailrose has a site that tells you how to implement the GLSL with blender… good luck… hope you find this info helpful…cool looking flag.

http://snailrose_dir.home.bresnan.net/shaders.html

Heh, the symbol on the flag doesn’t mean anything, it was simply a stand-in, but like I said, the GIMP crashed so I was stuck with it. The flag could have been a lot cooler, but oh well, I don’t really want to repeat it.

About your shader: It’s really cool, and something that I think has been needed for awhile. However, the fact that the bottom doesn’t twist like the top makes it look unrealistic, as well as the fact that it seems to go slow, and repeat itself frequently. To get a good example of flags waving, check out UT2K4’s flags, they look great.

@Red Team: yes indeed, great stuff. I enjoy Black Label Society as well. Speedball is awesome.

1 Like