Quake3World.com Forums
     Level Editing & Modeling
        Up to 8 frames animated shaders, without using animMap..


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Up to 8 frames animated shaders, without using animMap..

Recruit
Recruit
Joined: 12 Mar 2009
Posts: 9
PostPosted: 11-28-2010 09:38 PM           Profile Send private message  E-mail  Edit post Reply with quote


Since animMap shaders are bugged, (server uptime >24h == animMaps are static), it makes them pretty useless.
However, an animated shader can often make things more fancy.
I was busy creating an animated shader that does not use animMap at all, but is still animated.

It is possible to use up to 8 render-passes in a shader.
My example shader has 1 base texture + 7 animation frames.
All frames of the animation are packed into 1 texture. (The texture is included in the pk3. The pk3 was made for ET.. but shaders should be useful for Q3 also.)

The shader itself does a lot of number fiddling, it might need some explaining..
* "tcMod transform" is used to get one of the 7 images of the texture. (the T coordinate is transformed so it starts at the "Y"-position of each sub-texture).
* alphaGen is used to alternate the texture translucency
* rgbGen is used to make the texture colors alternate black/normal
* blendfunc add is used, in the example case, to add the texture to the screen. Blending a black texture this way will have no visual effect, a normal colored texture will be seen on screen..

By choosing the correct intervals at which alpha-values and rgb-colors are changing, You can make only 1 of the 7 images be visible at a time..

In the example i use "wave sine" because it looked well on the caustic effect. When using "wave Square" the transition is immediate.

I prepared a little pk3 for download..
(You can put it in etmain and run the map.. The map is called "anim_shader_demo")

The pk3 includes 4 demo shaders:

Three caustics shader variations:
* 8 frames no lightmap,
* 7 frames + lightmap,
* 7 frames animation + extra tcmod

One special shader that displays the current framenumber of the shader at a low frequency. (So You can clearly see it is really displaying 7 seperate images in an animated sequence (+ a lightmap))..

-------------------------------------------------------------------------------------------------------------------------------
Here is the download link: http://members.home.nl/core/ETpro/anim_shader_demo.pk3
-------------------------------------------------------------------------------------------------------------------------------

Image

Greetings,
C..




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 11-28-2010 11:00 PM           Profile Send private message  E-mail  Edit post Reply with quote


The rather big footnote here should be that because it uses 8 rendering passes, it could be a rather large performance hit. Might be useful for some people, though.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 11-29-2010 12:53 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Should this be in LEM?




Top
                 

Insane Quaker
Insane Quaker
Joined: 26 Nov 2009
Posts: 341
PostPosted: 11-29-2010 04:38 AM           Profile Send private message  E-mail  Edit post Reply with quote


Could someone post a youtube movie, since I don't have q3a here, right now, but I am very eager to see it.




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 11-29-2010 04:51 AM           Profile   Send private message  E-mail  Edit post Reply with quote


While I haven't actually seen it, I imagine it's just an animated texture, nothing special to see. It's the underlying method that makes it interesting, amirite?




Top
                 

Insane Quaker
Insane Quaker
Joined: 05 Nov 2010
Posts: 449
PostPosted: 11-29-2010 06:29 AM           Profile Send private message  E-mail  Edit post Reply with quote


I tried recompiling and switching things around to make this work in quake 3, I got kinda close.

http://sirventolin.webs.com/shaderdemo.jpg

I could force all that to work, I'm sure....in fact, the ability to do this could be useful to my future quake 3 maps, but you really should post a video somewhere that walks through the code and demonstrates the working process of what you've done.




Top
                 

Recruit
Recruit
Joined: 12 Mar 2009
Posts: 9
PostPosted: 11-29-2010 08:35 AM           Profile Send private message  E-mail  Edit post Reply with quote


Quote:
The rather big footnote here should be that because it uses 8 rendering passes, it could be a rather large performance hit

Very true..

Quote:
It's the underlying method that makes it interesting

That is the only thing i want to illustrate. The technique of using alphaGen,rgbGen & wave functions to make a certain shader-stage be displayed at a calculated time and for a calculated duration..
I never meant to show a fancy looking shader. The aesthetic value of the demo shader is just a side issue..
The same technique could be used for just 1 frame, (which wouldn't be a big performance hit).. perhaps to make blinking control-lights for a shader of some electrical device.

Link to the original topic: http://www.splashdamage.com/forums/showthread.php?t=22485

^^in that link i displayed some ASCII-"art" image of the alphaGen & rgbGen blockwaves, but when i think about it, the description is not entirely correct.
Code:
  ___     ___
 |   |   |   |
_|   |___|   |___    alphaGen
     ___     ___
    |   |   |   |
   _|   |___|   |___ rgbGen

     #       #       frame displayed when alpha && rgb are both at max.


By shifting the phase of the rgbGen wave a bit to the right,
the duration at which both waves are at max. will be shorter..
Changing the rgbGen phase determines the duration of a frame being visible.
The (same) frequency of both waves determine the speed at which the animation starts a new loop.

..




Top
                 

Insane Quaker
Insane Quaker
Joined: 26 Nov 2009
Posts: 341
PostPosted: 11-29-2010 08:44 AM           Profile Send private message  E-mail  Edit post Reply with quote


Hm. Why not use a roq video file for such a thing? Size I guess...
And I've never seen it, but you say that if the server is up more than 24h then the animmap texture doesn't move a bit anymore, right? Also if you switch the maps?




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 11-30-2010 12:17 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Bliccer wrote:
Hm. Why not use a roq video file for such a thing? Size I guess...


ROQ video is heavily compressed. You'd see massive compression artifacts in your texture. It's also possibly an even bigger performance hit than an 8 stage shader.




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 11-30-2010 07:56 AM           Profile Send private message  E-mail  Edit post Reply with quote


ROQ is probably more processor and memory intensive, 8 stages is heavier on GPU.

I've never heard of this bug and the OP never answered if this bug affects a server or map with 24 hour up time. If the latter, this almost never happens with Q3 since servers usually cycle between maps.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Insane Quaker
Insane Quaker
Joined: 05 Nov 2010
Posts: 449
PostPosted: 11-30-2010 10:22 AM           Profile Send private message  E-mail  Edit post Reply with quote


That sounds true, considering the time Quake 3 was programed in. What was the original goal of this project, C..? Are you just trying to circumvent the bug you found? Or are you doing this mostly for funzies? I'm a funzies kind of person myself, but considering it's 2010, aren't we talking about how Quake 3 (probably ioquake3) will perform on computers that are easily ten times faster than the computers we had when quake 3 was being built? It's still a valid point of consideration if you want everything to be a certain way, but is the issue at hand really still an issue?

obsidian wrote:
I've never heard of this bug and the OP never answered if this bug affects a server or map with 24 hour up time. If the latter, this almost never happens with Q3 since servers usually cycle between maps.


(comment directed at C.. but in reference to what obsidian said)
And about that bug, I've never seen it myself, nor have I heard of it until now, perhaps ioquake3 fixes that bug that may have been present in q3-1.32c?

...Do RoQ files take lightmaps? I've never seen a "video screen" in quake 3 that looked like the environment effected it, which might be a good reason to try to rig up 8 shader passes IF the animmap bug is something that can be clearly demonstrated.

Practical or not, it's still kinda neat that 8 shader passes can be done and figuring it out this way must have taken some elbow grease.

Hypothetically, how far could this be pushed? is 8 where it kinda maxes out?




Top
                 

Recruit
Recruit
Joined: 12 Mar 2009
Posts: 9
PostPosted: 11-30-2010 09:13 PM           Profile Send private message  E-mail  Edit post Reply with quote


Quote:
What was the original goal of this project, C..? Are you just trying to circumvent the bug you found? Or are you doing this mostly for funzies?

Well,.. for both reasons actually.
I must mention that i never played Quake, ioq, or anything else.. i played Wolfenstein ET. That game still uses old old code.
In ET there is no fancy new engine (which is noticale sometimes.. renderspeed is relatively low in comparison to today's games, because old techniques are used and less HW-support).
ET code (and all the mods) is still full of old bugs.. :S the animMap is just one of them.

offtopic: The bug was not found by me. Perhaps the games You people play don't even have the bug.. i simply don't know.
I do know that in ET, it causes the animMaps to stop working and become static images..
I found a link to a forum explaining exactly what bug i was telling about. They even show the fix:
h t t p : / / forums.wireheadstudios.org/index.php?act=ST&f=11&t=2749
(i cannot see the content of the forum, unless i register.. so i did. I must only wait for the admin to reply, before i can crawl the forum..)

It was only my intension to show a creative use of alpgaGen & rgbGen. How one can make a shader-stage display its image at a calculated moment, for a calculated duration.
Creating animations with the technique is just another use of it.. combining several of those alpha/rgbGen passes, all with a different phase.
It's not my taste of shader, if You ask me, because of obvious reasons mentioned before.
I can imagine for people that can use animMaps without any trouble, the topic-title is not much appealing.. (why do so much trouble in a shader if it can be done easily with an animMap?).
To make it more interesting for those: It might be possible to make a shader with multiple stages, and have an animMap in every stage. Then use the alphaGen/rgbGen to display only 1 of the stages at a time. This way You can make a very long animMap.
Quote:
how far could this be pushed? is 8 where it kinda maxes out?

I tried it in ET. 8 render-passes appeared to be the max (which is already insane).
Never before have i tested howmany shader-stages can use an animMap, nor howmany frames/images a single animMap supports.
My guess is, it'll work. But it would really be extreme.. but fun.

..




Top
                 

Elite
Elite
Joined: 25 Mar 2000
Posts: 10054
PostPosted: 11-30-2010 11:13 PM           Profile Send private message  E-mail  Edit post Reply with quote


Cool stuff, C..

Your use of phase shifting to achieve a desired output reminds me of audio engineering, which is my home turf. In audio, it's generally the opposite, though. You tweak phases to cut out certain frequencies. Either way, interesting read. And interesting that this kind of stuff is still coming out of the woodwork, almost 12 years later!




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 11-30-2010 11:55 PM           Profile   Send private message  E-mail  Edit post Reply with quote


I know about the frozen animMaps thing. We had a Freeze Tag server running ages ago which had this problem. I'm not sure if a map change fixed it, I think it didn't actually. Maybe id Software fixed it in one of the point releases though?




Top
                 

Gibblet
Gibblet
Joined: 11 Oct 2007
Posts: 13
PostPosted: 12-03-2010 02:14 PM           Profile Send private message  E-mail  Edit post Reply with quote


obsidian wrote:
ROQ is probably more processor and memory intensive, 8 stages is heavier on GPU.


Also, Q3 can decode only one ROQ at a time, which means bye bye to videoMap TV screens, if you're going to use them simultaneously with the ROQ flames, or whatever you use them for.



_________________
http://www.rq3.com


Top
                 

Theftbot
Theftbot
Joined: 07 Oct 2009
Posts: 483
PostPosted: 12-03-2010 11:17 PM           Profile Send private message  E-mail  Edit post Reply with quote


Use multiple architecture&triggerable shaders.




Top
                 

Warrior
Warrior
Joined: 07 Sep 2006
Posts: 82
PostPosted: 12-09-2010 04:17 AM           Profile Send private message  E-mail  Edit post Reply with quote


I've never seen this bug myself so I'm not sure if this would work. If you use a triggerable shader and change to a shader with an animMap, the animMap will reset to the first frame of the animMap's sequence. If you make the level reset the animMap's shader with a triggerable shader when the level restarts or loads, would this possibly fix the problem of static animMaps after 24h of uptime?




Top
                 

The Afflicted
The Afflicted
Joined: 28 Apr 2008
Posts: 530
PostPosted: 12-10-2010 02:02 PM           Profile Send private message  E-mail  Edit post Reply with quote


Holy... It's Quack! Hi there!



_________________
If you are caught on a golf course during a storm and are afraid of lightning, hold up a 1-iron. Not even God can hit a 1-iron.
-Lee Trevino, golfer who actually has been struck by lightning.


Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.