Page 4 of 4

Re: Shader Help Thread

PostPosted: Fri Sep 07, 2018 1:37 am
by Dr. Van Nostrand
Ah I see... I've clearly got a lot to learn. I hadn't touched most of these newer features yet. Thanks again!

lol wow the effect is way too fast as I had it originally! Here's a more subtle version in case anyone else is looking for a simple underwater warp shader

Re: Shader Help Thread

PostPosted: Fri Sep 07, 2018 1:42 am
by Pixel Eater
lol wow the effect is way too fast as I had it originally!

Yeah I think I went cross-eyed the first time :lol:

Re: Shader Help Thread

PostPosted: Thu Sep 20, 2018 8:39 pm
by Pixel Eater
I wonder if someone can explain how the alpha property works for texture shaders? It's always seemed non-linear to me and impossible to counteract. Something I've just tried doing is actually causing me to be suspicious it's a bug but I want to make sure I'm not missing something.

So I have a 3D floor with the line opacity property set to 254. I have the software fuzz shader being applied to it's texture, multiplying the pixels' alpha (ie. colour.a) by values between 0.1875 and 0.65625. But what I get are low alpha values being shunted to zero (or lower?) instead. Previously I've assumed it was my error and just abandoned projects until I can figure it out, only now I'm using someone else's proven code verbatim.



You can see the detail is greatly reduced in the bridge compared to the spectre even though they share identical code. Are we supposed to treat colour.a differently in custom shaders?

Re: Shader Help Thread

PostPosted: Sun Nov 11, 2018 3:23 pm
by Cherno
Hello, I have a question regarding shaders in zDoom. First of all, I have writen my own shaders before in some Unity projects so the basic concepts are not new to me.

I would like to know if it's possible to have a material for a md3 model that shows it's bitmap texture mapped to the viewport, as opposed to being uv-mapped to the model's local vertices. So, if the model moves on screen, the triangle(s) in question would just show a different part of the texture. If you remember the "fake specular" effect in Alone in the Dark (for thing like metallic and reflective surfaces), you know what I'm talking about.

The effect can be seen here, in the small mirror item:

https://www.youtube.com/watch?v=9lWaQe8 ... .be&t=1497

Can this be done?

Re: Shader Help Thread

PostPosted: Sun Nov 25, 2018 12:03 pm
by Cherno
I know that MD3s can use materials, but can they also use custom shaders?

Re: Shader Help Thread

PostPosted: Mon Feb 18, 2019 2:33 pm
by SPZ1
Instead of making a new thread I'm bumping this one

I'm looking to make a shader to rotate a graphic at the center but have been unsuccessful. I tried modifying the shader that is in the wiki all sorts of ways but the results were just varied wave patterns. Is this even possible?

Re: Shader Help Thread

PostPosted: Tue Mar 26, 2019 3:36 pm
by RSSwizard
All im interested in is using those screen shaders like the Blaarg CRT stuff from zsnes.
Old school scanlines and rf artifacts like a vcr recording.
How do you get that going in zdoom?

Re: Shader Help Thread

PostPosted: Wed Mar 27, 2019 1:23 am
by Pixel Eater
SPZ1 wrote:I'm looking to make a shader to rotate a graphic at the center but have been unsuccessful. I tried modifying the shader that is in the wiki all sorts of ways but the results were just varied wave patterns. Is this even possible?

Give this one a try instead:
Code: Select allExpand view
uniform float timer ;
const float pi = 3.14159265358979323846 ;

vec4 Process( vec4 colour )
{
   vec2 pos = gl_TexCoord[0].st - .5 ;
   float hyp = sqrt( pos.x * pos.x + pos.y * pos.y );
   
   if( hyp < .5 ) //narrows the effect. max is .707 but just comment out this line at that point.
   {
      float rad = atan( pos.y / pos.x ) + timer ; //try radians( 45 ) instead of timer for a fixed angle.
      rad += pi * ( .5 - sign( pos.x ) * .5 );
      
      pos.x = cos( rad );
      pos.y = sin( rad );
      pos *= hyp ;
   }
   
   return getTexel( pos + .5 );
}


RSSwizard wrote:All im interested in is using those screen shaders like the Blaarg CRT stuff from zsnes.
Old school scanlines and rf artifacts like a vcr recording.
How do you get that going in zdoom?

There's scan lines in Retroshader and some other neat stuff.

I'm slowly working on a new Screem that will have them too:

It's also enabling pixelation with a softening filter.

Re: Shader Help Thread

PostPosted: Sat Apr 06, 2019 7:38 pm
by furyweb
Is it possible to add a shader just to the HUD weapon rather than the whole screen. I was hoping to get the Retro pixel shader working just on the weapons rather than the whole screen.

Thanks.

Re: Shader Help Thread

PostPosted: Mon Jun 10, 2019 10:02 am
by Mav3r1ck
I'm looking for custom smooth liquid shaders for flats and waterfalls. Would someone be able to direct me to these types of shaders?

Re: Shader Help Thread

PostPosted: Mon Sep 09, 2019 11:40 pm
by Talon1024
On the GLDEFS wiki page, it says:

The following uniform variables are always available to your shaders:

int fogenabled
vec4 fogcolor
vec3 dlightcolor
vec3 camerapos
float desaturation_factor
vec4 topglowcolor
vec4 bottomglowcolor
int texturemode
sampler2D tex
float timer

If you wish to use the timer uniform, you must define it yourself at the top of your shader file.

If the DYNLIGHT define is defined, the following uniform variables available:

ivec3 lightrange
vec4 lights[256]

Only if MAXLIGHTS128 is not defined

vec4 lights[128]

Only if MAXLIGHTS128 is defined

The following varying variables are always available to your shaders:

float lightlevel
vec2 glowdist
vec4 pixelpos
vec4 fogparm


Is this list up to date? And where in the GZDoom source code are these values defined and passed to user shaders for textures?

Re: Shader Help Thread

PostPosted: Sun Oct 27, 2019 4:54 pm
by Gabenslair
Is there a possibe way to have "shaders" encased in a texture?
Say I wanted to have this foggy glass texture that when viewed through blurs part of the screen to give the illusion that its affecting all them light beams and stuff.

Re: Shader Help Thread

PostPosted: Mon Oct 28, 2019 3:22 am
by Nash
Material textures do not have access to the current screen colour and depth, so no that's currently not possible. Those two things are needed to do any effects that seemingly affect what is "behind" a texture - for example, refraction behind a glass or water, or "heat haze".