Looking for Resources for your mod/project? Want to share some of your creations so others can use them? Post them here!
-
kodi
- New User
- Posts: 14
- Joined: Wed Dec 30, 2015 2:57 pm
#1
Post
by kodi » Fri Nov 18, 2016 10:28 am
This is a silly trick where the alpha channel of a sprite, texture, hudmessage-printed graphic or anything else is hijacked as an argument for rotation. This means you can make smoothly turning clocks, compasses, rolling cacodemons etc.
Credits: based on the static rotation shader found in a beta of WolfenDoom: Blade of Agony. Edit: No longer applies.
Note: Does not work in GZDoom's GL renderer.
GLDEFS:
Code: Select all
hardwareshader [texture/sprite/graphic] SomeTextureNameHere
{
shader arot.txt
}
arot.txt:
Code: Select all
uniform float timer;
vec4 Process(vec4 color)
{
vec2 tex_coord = gl_TexCoord[0].st;
float angle = color.a*6.283; // turns to radians :^)
float x = tex_coord.x;
float y = tex_coord.y;
float output_x = cos(angle) * (x-0.5) - sin(angle) * (y-0.5) +0.5 ;
float output_y = sin(angle) * (x-0.5) + cos(angle) * (y-0.5) +0.5;
color.a = 1.0;
return getTexel(vec2(output_x, output_y)) * color;
}
Last edited by
kodi on Sat Nov 19, 2016 12:39 pm, edited 2 times in total.
-
Ænima
- Addicted to Zandronum
- Posts: 3523
- Joined: Tue Jun 05, 2012 6:12 pm
#2
Post
by Ænima » Fri Nov 18, 2016 6:38 pm
Will use, thanks!
(will credit you and wolfendoom)
Doom64: Unabsolved: New weapons, monsters, and gameplay features for coop !
ZandroSkins: a pack made by our community
-
Tormentor667
-
- Posts: 38
- Joined: Fri Jun 15, 2012 10:53 am
- Location: Germany
-
Contact:
#3
Post
by Tormentor667 » Sat Nov 19, 2016 8:43 am
Would have been cool if you asked for permisson though before using it
-
kodi
- New User
- Posts: 14
- Joined: Wed Dec 30, 2015 2:57 pm
#4
Post
by kodi » Sat Nov 19, 2016 10:40 am
Terribly sorry torm - I sometimes forget other people don't have as careless an attitude to their own code as I do. I rewrote the entire shader in the OP from scratch out of courtesy, using a different method but producing identical results.