Help a n00b understand shaders!

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
User avatar
Janitor
Persecution Complex
Posts: 123
Joined: Sun Jul 08, 2007 17:16
Location: Not in Kansas anymore

Help a n00b understand shaders!

Post by Janitor »

So Graf's implementation of custom shaders seems like it could be useful, but unfortunately I don't have a clue how to start using them, or even what could be accomplished with them. So here are some questions in no particular order:

(1) The syntax appears to be GLSL specific. Could one potentially borrow code from other open source graphics programs to achieve certain effects? For example, one effect I'd like to see if it is possible would be to add bloom/HDR to my custom skyboxes.

(2) I think it's a safe assumption that abusing shaders or using them extensively could cause some performance issues? Is this a correct understanding?

(3) I've seen it mentioned that reflective effects could be achieved. Could it also be possible to apply reflective or shiny surfaces to model skins? Could it be possible to make brightmaps for model skins?

(4) Graf has an example shader in GZDoom.pk3 now, can someone give me an idea of what exactly this does?

(5) In general, what are some of the things that can be done with these custom shaders? what are their limitations?
User avatar
Logan MTM
Posts: 179
Joined: Wed Jan 04, 2006 2:52
Location: Rio de Janeiro - BRAZIL
Contact:

Re: Help a n00b understand shaders!

Post by Logan MTM »

ShadersExample.zip
(691 Bytes) Downloaded 127 times
So as you read this know my friends I'd love to stay with you all.
Please smile when you think of me. My body's gone that's all...
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Help a n00b understand shaders!

Post by Graf Zahl »

Janitor wrote:So Graf's implementation of custom shaders seems like it could be useful, but unfortunately I don't have a clue how to start using them, or even what could be accomplished with them. So here are some questions in no particular order:

(1) The syntax appears to be GLSL specific. Could one potentially borrow code from other open source graphics programs to achieve certain effects? For example, one effect I'd like to see if it is possible would be to add bloom/HDR to my custom skyboxes.
The problem here is that to add such effects it's not enough to add some shader code. It needs support from within the engine. And frankly, I have no idea how to do that. I'm not a graphics effects expert, unfortunately.
(2) I think it's a safe assumption that abusing shaders or using them extensively could cause some performance issues? Is this a correct understanding?
Yes, shader abuse can easily bring down performance. Extensive use of shaders does not. If you use a modern graphics card (GF8xxx or better, ATI Radeon HD) everything is rendered using shaders.

(3) I've seen it mentioned that reflective effects could be achieved. Could it also be possible to apply reflective or shiny surfaces to model skins? Could it be possible to make brightmaps for model skins?
Reflectiveness is, like HDR/Bloom, something that needs support from within the engine so it can't be done easily.

Brightmaps for model skins are technically doable but it needs an extension to MODELDEF to work,
(4) Graf has an example shader in GZDoom.pk3 now, can someone give me an idea of what exactly this does?
It's just an alternate warping algorithm, nothing special.


(5) In general, what are some of the things that can be done with these custom shaders? what are their limitations?
They are mostly for texture manipulation. So you can do all kinds of warping effects or lighting effects.
User avatar
Janitor
Persecution Complex
Posts: 123
Joined: Sun Jul 08, 2007 17:16
Location: Not in Kansas anymore

Re: Help a n00b understand shaders!

Post by Janitor »

Thanks for the fast replies!

Alright, well, this at least gives me a place to start. I think making shiny things is something worth looking into, I'll see what I can do on that. Is it an engine limitation in the sense that it's 100% not at all possible, or possible but in the kind of way that's comparable to pulling teeth? In terms of texture manipulation, could this be used to make a kind of 'ripple' effect for liquid surfaces?
User avatar
Janitor
Persecution Complex
Posts: 123
Joined: Sun Jul 08, 2007 17:16
Location: Not in Kansas anymore

Re: Help a n00b understand shaders!

Post by Janitor »

Double post :S

So here's a link that contains some files that create a rippling effect on textures using GLSL. I figure I can just move this code into my /shaders directory in my PK3 to create a kind of rippling effect for water surfaces:

http://lists.apple.com/archives/quartzc ... 00009.html

I havent tried this yet, so I have no idea if this will actually work. I'm not going to have the chance to try this until later tonight. If anyone has the opportunity to try this, or if anyone is familiar enough with GLSL to let me know what I might need to make this work, that would be awesome
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Help a n00b understand shaders!

Post by Graf Zahl »

Sorry, no. That thing seems to be a fullscreen postprocessing effect.

Besides, it uses 2 textures and not in a way that's compatible with GZDoom.
DaniJ
Posts: 130
Joined: Sat Oct 08, 2005 19:22

Re: Help a n00b understand shaders!

Post by DaniJ »

Although, it should be possible to implement something similar but working in texture space rather than screen space. You could get around the texture issue by combining both textures in one, after all you're doing the texel look up in a shader so you can handle the wrapping manually. Not an easy one to start with though I will say.
Locked

Return to “GZDoom”