Page 1 of 2

Is shader editing possible?

Posted: Mon Dec 24, 2012 15:10
by Enjay
I thought that this had already been asked but I can't find an answer.


I think that Korshun made some edits to the shaders for his "blocky" version of the software lighting emulation. It got me wondering how shader editing can be done. I poked around inside gzdoom.pk3 but didn't find anything that I could make much sense of.

So, is it possible to edit the shaders? If so, is there any documentation anywhere that might help? If editing is possible, is adding new shaders possible (eg to make a warp3 or something)?

Re: Is shader editing possible?

Posted: Mon Dec 24, 2012 15:50
by Blue Shadow
This is probably not gonna help but apparently you can use GLDEFS to apply custom shaders on graphics.

As how to write them, I have no clue :P .

Re: Is shader editing possible?

Posted: Mon Dec 31, 2012 9:54
by krumzy
I tried to create a 'warp3' a while ago but it kept coming up with this error

Code: Select all

Unable to load shader warp3::colormap:
Unable to load 'warp3'
I don't really know anything about hardware shaders but i would like to create my own like warp3.

Edit:

Never mind, i fixed that error. Which brought up a new one:

Code: Select all

Script error, "rescources.wad:ANIMDEFS" line 4:
Bad syntax.

Warp3 won't work in an animdefs lump

Re: Is shader editing possible?

Posted: Tue Jan 15, 2013 21:38
by GooberMan
Well, I probably won't get around to writing shaders myself for Prime Directive. But looking at that example on the ZDoom wiki, I can only assume pretty much no one has used this feature. A list of uniforms and varyings that are exposed to those shaders would be nice.

Re: Is shader editing possible?

Posted: Wed Jan 16, 2013 12:06
by Gez
They are extremely limited. You can only make shaders for individual sprites and textures, not for the entire screen. The "software" light mode required to add special support in the C++ side too; something which is out of reach of a normal mod.

If you want examples, look at the shaders used for texture warping and the various types of fuzz. Other examples of shaders can be found in some closed bug reports.

Re: Is shader editing possible?

Posted: Wed Jan 16, 2013 21:34
by GooberMan
Yes, well, I'm quite well versed in GL (having had to write at least 3 GL codebases from scratch for various employers over the last few years) and I already determined that they're for pixel shaders only and only for use on flats/patches/etc.

I've already got the GZDoom SVN repository downloaded on my computer. I might dig through it and document it properly myself.

EDIT: And I have done just that. I hope it's clearer for everyone. It certainly makes sense to me. The old documentation required me to make too many assumptions based on my prior graphics programming knowledge, so I can't imagine it would have been easy for anyone who hasn't programmed shaders before.

Re: Is shader editing possible?

Posted: Thu Jan 17, 2013 6:52
by Blue Shadow
GooberMan wrote:Yes, well, I'm quite well versed in GL (having had to write at least 3 GL codebases from scratch for various employers over the last few years)
It's unfortunate that you can't do coding for anything but the company you work for, otherwise we would have ourselves a new GZDoom developer working on its renderer.

Re: Is shader editing possible?

Posted: Sun Feb 10, 2013 3:10
by krumzy
You can replace existing shaders.
Spoiler: Looks better in game

Re: Is shader editing possible?

Posted: Sun Feb 10, 2013 11:06
by Enjay
krumzy wrote:Looks better in game
Would you mind uploading the modified shader so I can see how it looks? :)

Re: Is shader editing possible?

Posted: Sun Feb 10, 2013 20:00
by krumzy
It's a bit wonky looking, but that's because i don't know how to edit shaders :P

Download here.

Re: Is shader editing possible?

Posted: Sun Feb 10, 2013 23:45
by Enjay
Thanks. It looks pretty cool to me. I like how it has the smaller ripple-like effects but there is a larger wave-like effect over the top of it.

Re: Is shader editing possible?

Posted: Mon Feb 11, 2013 3:10
by Rachael
I like it too.

Re: Is shader editing possible?

Posted: Mon Feb 11, 2013 5:15
by krumzy
Thanks, I'm glad that even though i had no idea what i was doing it turned out nice.

Re: Is shader editing possible?

Posted: Sun Feb 24, 2013 3:29
by Alexandra
Hey, this looks really nice. For the first time ever in Doom I feel like I'm looking at a liquid. Adding to the autoload. :)

Re: Is shader editing possible?

Posted: Tue Feb 26, 2013 4:52
by krumzy
If you like i could do the same thing for the other liquids. (lava, slime etc...)