Shader Help Thread

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

Moderators: GZDoom Developers, Raze 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.
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: Shader Help Thread

Post by kodi »

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:
skornedemon
Posts: 154
Joined: Mon Aug 02, 2010 11:10 am

Re: Shader Help Thread

Post by skornedemon »

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!
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: Shader Help Thread

Post by UsernameAK »

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
Major Cooke
Posts: 8196
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Shader Help Thread

Post by Major Cooke »

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...
_mental_
 
 
Posts: 3819
Joined: Sun Aug 07, 2011 4:32 am

Re: Shader Help Thread

Post by _mental_ »

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?
User avatar
Rachael
Posts: 13794
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Shader Help Thread

Post by Rachael »

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
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Shader Help Thread

Post by Nash »

Major Cooke wrote:Hey Nash, think you could include this tutorial link to the top of your thread?
Donerino
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: Shader Help Thread

Post by UsernameAK »

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 8:36 am, edited 2 times in total.
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: Shader Help Thread

Post by UsernameAK »

and yes, add uniform system to old fragment shader system
_mental_
 
 
Posts: 3819
Joined: Sun Aug 07, 2011 4:32 am

Re: Shader Help Thread

Post by _mental_ »

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.
User avatar
UsernameAK
Posts: 83
Joined: Wed Jul 15, 2015 5:26 am
Location: Ukraine

Re: Shader Help Thread

Post by UsernameAK »

_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 all

MESA_GL_VERSION_OVERRIDE=4.5 ./gzdoom
works well
_mental_
 
 
Posts: 3819
Joined: Sun Aug 07, 2011 4:32 am

Re: Shader Help Thread

Post by _mental_ »

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.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Shader Help Thread

Post by Pixel Eater »

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?
dpJudas
 
 
Posts: 3134
Joined: Sat May 28, 2016 1:01 pm

Re: Shader Help Thread

Post by dpJudas »

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.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Shader Help Thread

Post by Pixel Eater »

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:

Return to “Assets (and other stuff)”