home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


Animated textures?

by thojoh370 on 07/01/2007 14:27, 24 messages, last message: 07/23/2007 22:09, 13496 views, last view: 05/05/2024 13:12

Does Sauerbraten support any filetype that can be animated? I know that GIF can be animated so I tried to source-edit Sauerbraten so that it loads GIF files instead of JPG, but it didn't want to show the GIF images in-game.

Go to first 20 messagesGo to previous 20 messages    Board Index   

#5: Re: Caustics?

by Eris on 07/10/2007 21:03, refers to #4

I wonder too.

reply to this message

#6: crude animation shader

by a baby rabbit on 07/11/2007 16:12

Ok, so tile 16 images within a single image in a 4x4 grid. Apply the following shader to the texture (note that depending on where you place the texture, you'll get a different animation order... but hey - proof of concept)

shader 0 "movie" [
@vpstart
TEMP dtc;

DP3 dtc.x, opos, program.env[0];
DP3 dtc.y, opos, program.env[1];

TEMP off;
MUL off, program.env[6], 1; //animation rate

FRC off.x, off.x;
MUL off.x, off.x, 4; // thus 4x4 tiled image
FLR off, off;
ADD dtc, dtc, off;
MUL result.texcoord[0].xy, dtc, 0.25; // 1/4

DP3 result.texcoord[1].x, state.matrix.texture[1].row[0], vertex.texcoord[1];
DP3 result.texcoord[1].y, state.matrix.texture[1].row[1], vertex.texcoord[1];
@fogcoord
END
] [
@fpstart
OPTION ARB_fog_linear;
TEMP diffuse, lm;
TEX diffuse, fragment.texcoord[0], texture[0], 2D;
TEX lm, fragment.texcoord[1], texture[1], 2D;
MUL diffuse, diffuse, 2;
MUL result.color, diffuse, lm;
END
]

reply to this message

#7: Re: crude animation shader

by thojoh370 on 07/11/2007 17:29, refers to #6

I am unsure I understood what you meant.

reply to this message

#8: Re: crude animation shader

by MeatROme on 07/11/2007 18:25, refers to #6

nice one,
works like a charm :)

thojoh370: (in reply to #7)
make yourself a texture - 64x64 pixels, transparent background.

Now paste 4 images (e.g. the four frames of your animation) into it.
Start off bottom right for frame #1,
bottom left frame #2,
top right frame #3 ... guess where frame #4 goes ...
... save as png and put it somewhere inside the sauerbraten packages tree (I'm assuming it's gonna end up as packages/base/vid.png).

Then paste the shader script into your autoexec.cfg; modify two lines - because your just using a 2x2 animation grid ... hope this helps you get to grips with what the shader is doing a little better ... instead of just copy-paste w/o understanding :)
You need to modify the lines 12 and 15 - change them to the following (respectively):
MUL off.x, off.x, 2; // thus 2x2 tiled image
MUL result.texcoord[0].xy, dtc, 0.5; // 1/2

then create packages/base/test.cfg and put following two lines into it:
setshader movie
texture 0 base/vid.png

now fire up sauerbraten and go
/newmap
/savemap test
/map test
..raise a piece of wall,
select a single cube
/edittex +1000
/savemap

HTH
and - yeah, that helped : baby-rabbit :)

reply to this message

#9: ..

by slider on 07/11/2007 19:18

wow !!!! has anybody uploaded a u-tube video of this implemented. I would love to see this in action.

reply to this message

#10: Re: crude animation shader

by Quin on 07/11/2007 20:14, refers to #6

Nice, thank you for taking the time to write that for everyone and share it. The possibilities for this are endless :)

reply to this message

#11: Re: viewing pleasure

by MeatROme on 07/11/2007 20:36, refers to #9

Heh, why a movie ... take this demo map:
http://www.quadropolis.us/node/717

reply to this message

#12: Re: crude animation shader

by Rainforce on 07/11/2007 20:44, refers to #6

realy nice...er...but the order of the picture belongs to the place of the cube... wrong place ends up in number chaos like: #13 #12 #15 #14 #9 #8 #10 #11
confusing, eh?
hope somebody fix this, but for the first time of animated tex it's great

reply to this message

#13: Re: crude animation shader

by a baby rabbit on 07/12/2007 17:21, refers to #12

Fussy critters.... Okay, now always animates in the same order - also minus the lightmap stuff, since I figure a 'movie screen' probably emits light.

shader 0 "movie" [
@vpstart
DP3 result.texcoord[0].x, opos, program.env[0];
DP3 result.texcoord[0].y, opos, program.env[1];
TEMP off;
MUL off, program.env[6], 1; // animation rate
FRC off.x, off.x;
MUL off.x, off.x, 4; // thus 4x4 tiled image
FLR result.texcoord[2].xy, off;
@fogcoord
END
] [
@fpstart
OPTION ARB_fog_linear;
TEMP dtc;
FRC dtc, fragment.texcoord[0];
ADD dtc, dtc, fragment.texcoord[2];
MUL dtc, dtc, 0.25; // 1/4 - so correct scaling
TEX result.color, dtc, texture[0], 2D;
END
]

reply to this message

#14: Re: crude animation shader

by Rainforce on 07/12/2007 19:06, refers to #13

hm... I think both versions are important. This one is good if you try to make thinks like a screen were text rushes through.

I hope that there are more posts like this one...

another question: how do you know how to make this?

reply to this message

#15: ..

by Eris on 07/12/2007 23:32

leet man

reply to this message

#16: Re: crude animation shader

by Passa on 07/13/2007 01:36, refers to #13

Wow baby rabbit, thats really impressive stuff :)

reply to this message

#17: ..

by Acord on 07/13/2007 15:13

This is gonna get used. Zer gut.

reply to this message

#18: Re: crude animation shader

by kurtis84 on 07/13/2007 16:03, refers to #14

he knows how to make this, because the shader language is STANDARD OPENGL stuff, it's NOT sauer-specific people.

We can just "live and learn", but a bit of reading helps that along ;)

reply to this message

#19: Re: crude animation shader

by kurtis84 on 07/13/2007 16:04, refers to #18

btw baby-rabbit, it's a nice script :)

reply to this message

#20: heeh

by Eris on 07/15/2007 12:18

thats how you get streetcred n props

reply to this message

#21: Re: crude animation shader

by Rainforce on 07/20/2007 15:34, refers to #18

sorry, I don't know anything about openGL...
and hey, acute illiteratism isn't funny! XD
--
Does anybody know a good source for learnin something about OGL?

reply to this message

#22: getting started with OGL

by MeatROme on 07/20/2007 20:33, refers to #21

Get a copy of the "OpenGL-RedBook" and peruse http://nehe.gamedev.net/

reply to this message

#23: ..

by crudscurdler on 07/22/2007 07:11

there's also the opengl shading language book

reply to this message

#24: ..

by Eris on 07/23/2007 22:09

So much for so little lol

reply to this message

Go to first 20 messagesGo to previous 20 messages    Board Index   


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53866240 visitors requested 71641393 pages
page created in 0.019 seconds using 10 queries
hosted by Boost Digital