Shader Help Thread

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Re: Shader Help Thread

Postby kodi » Thu Sep 14, 2017 11:26 am

Is there any way to access the cameras angle(s) in a texture shader? I only know how to get its position.

Edit: I'd also like to know if there's a way to find a sprite/actors origin point for an unrelated WIP shader that does something I'd like to release and share.

Edit 2: seems some type of angle data can be extracted from ViewMatrix[x][y], but it doesn't work for sprites drawn to the screen, at least not without other data. :blergh:
User avatar
kodi
Proscrastinator
 
 
 
Joined: 06 May 2013

Re: Shader Help Thread

Postby skornedemon » Tue Oct 24, 2017 1:35 pm

Decided to post here instead of making my own topic.

Ive never dealt with hardware shaders before, least anything 'complex'. I'm looking to try to get this shader: https://www.shadertoy.com/view/ltc3RX used on a texture in gzdoom.
Is anyone willing to help walk me through it? Converting the code to gzdoom's style, implementing, etc.

I was also thinking if we get a few 'generic' shaders in, I could make a new topic in the 'resources' forum so people could easily use them.

Cheers!
skornedemon
Doom modding since '99.
 
Joined: 02 Aug 2010
Discord: Skorne#1213

Re: Shader Help Thread

Postby UsernameAK » Wed Oct 25, 2017 10:18 am

Okay, I got GZDoom 3.2.1, but i haven't even bloom effect in option! WTF? (My GPU supports OpenGL 4.5, but gl_legacy_mode is true)
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: Shader Help Thread

Postby Major Cooke » Fri Oct 27, 2017 12:11 pm

Hey Nash, think you could include this tutorial link to the top of your thread? Trying to relearn shaders and lost the link, big thanks to Gutawer for getting it back to me.

If only converting shaders from toybox to GZDoom wasn't such an insane process...
User avatar
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Shader Help Thread

Postby _mental_ » Fri Oct 27, 2017 2:34 pm

UsernameAK wrote:Okay, I got GZDoom 3.2.1, but i haven't even bloom effect in option! WTF? (My GPU supports OpenGL 4.5, but gl_legacy_mode is true)

Strange, did you try to remove it from config file or set to false?
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Shader Help Thread

Postby Rachael » Fri Oct 27, 2017 2:42 pm

gl_legacy_mode is re-evaluated every time the OpenGL subsystem is initialized - and therefore, cannot be changed with any actual effect in the config file.

Its only purpose is to remove certain menu options when the software renderer is active, if the config file in question was last run in legacy mode.

The fact that it's true means that there was a problem initializing a context that supports advanced features; a startup log would be handy.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Shader Help Thread

Postby Nash » Sat Oct 28, 2017 2:40 am

Major Cooke wrote:Hey Nash, think you could include this tutorial link to the top of your thread?


Donerino
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Shader Help Thread

Postby UsernameAK » Sat Oct 28, 2017 9:32 am

Rachael wrote:gl_legacy_mode is re-evaluated every time the OpenGL subsystem is initialized - and therefore, cannot be changed with any actual effect in the config file.

Its only purpose is to remove certain menu options when the software renderer is active, if the config file in question was last run in legacy mode.

The fact that it's true means that there was a problem initializing a context that supports advanced features; a startup log would be handy.

Spoiler: GZDoom log


Well, why does it work in compat profile?

Spoiler: glxinfo
Last edited by UsernameAK on Sat Oct 28, 2017 9:36 am, edited 2 times in total.
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: Shader Help Thread

Postby UsernameAK » Sat Oct 28, 2017 9:33 am

and yes, add uniform system to old fragment shader system
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: Shader Help Thread

Postby _mental_ » Sat Oct 28, 2017 9:49 am

Most likely it's the same problem as in this report. There is a patch in the topic although we need volunteers to check it.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Shader Help Thread

Postby UsernameAK » Sat Oct 28, 2017 2:22 pm

_mental_ wrote:Most likely it's the same problem as in this report. There is a patch in the topic although we need volunteers to check it.

Code: Select allExpand view
MESA_GL_VERSION_OVERRIDE=4.5 ./gzdoom
works well
User avatar
UsernameAK
Cat
 
Joined: 15 Jul 2015
Location: Ukraine
Discord: /bin/cat#8891

Re: Shader Help Thread

Postby _mental_ » Sat Oct 28, 2017 2:54 pm

This should be fixed in code so proper OpenGL profile will be selected by default, i.e. without environment variables or any other user actions.
Unfortunately I can check in VM only but this definitely needs to be tested on real hardware.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Shader Help Thread

Postby Pixel Eater » Wed Mar 28, 2018 5:05 am

Before I make a fool of myself with a feature request I thought I'd ask something here. How feasible would it be for GZDoom to store a texture of the scene "pre-shaded" for custom shaders to access? It would look the same as if the light amplification visor were on. The idea is that the shader would be able to determine whether the pixel it's processing had been affected by the lighting system and by what amount by comparing it to the proposed texture. I think there could be some interesting effects made achievable with this setup.
What do people think? Is the concept flawed or maybe impractically slow?
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: Shader Help Thread

Postby dpJudas » Wed Mar 28, 2018 5:27 am

This would require GZDoom to output an extra gbuffer with this information. Technically possible, nothing of this sort is currently planned. If such a thing was added it wouldn't make sense to hardcode it output a "pre-shaded" value - it would be better to allow texture shaders to output anything they want into such gbuffers.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Shader Help Thread

Postby Pixel Eater » Wed Mar 28, 2018 6:03 am

Sorry dpJudas, I'm having trouble following. I looked up what a g-buffer is and it sounds like what I'm suggesting. Except where you are mentioning shaders writing to the texture I'm hoping to have them read from it.
The goal here is for the shader to separate what is an index colour from what has been shaded by the lighting and by how much.

Edit: I'm referring to post-processing shaders in case I haven't mentioned :oops:
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

PreviousNext

Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 2 guests