Shiny Shader Possible?

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.
Post Reply
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Shiny Shader Possible?

Post by Enjay »

Is it possible to create a shader that makes surfaces look shiny? I guess full reflectiveness probably can't be done but what about something that gives the impression of being shiny? I think it might be quite nice to apply to SHAWN surfaces or maybe windows or something.

I had a play around with the shader used on the glass in Freaky Panties but it makes surfaces look darker and, also, it sort of warps the appearance of the texture; so if you have a regular pattern (e.g. a texture that looks like glass reinforced by a wire mesh) the warping looks wrong.
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: Shiny Shader Possible?

Post by Pixel Eater »

Could it be done with the new normal map stuff?

Barring that, I could imagine a shader that makes the texture whiter the more 'head on' you're looking at it...
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Shiny Shader Possible?

Post by Enjay »

New normal map stuff? Dayum, I'm out of the loop. Anywhere to get a good source of info on this? Searches of the Wiki and on here have failed me.
User avatar
HAL9000
Posts: 266
Joined: Fri Mar 16, 2018 7:44 am
Contact:

Re: Shiny Shader Possible?

Post by HAL9000 »

Pixel Eater wrote:Could it be done with the new normal map stuff?
No, because PBR / "Normal stuff" is missing environment maps. I've requested this feature recently viewtopic.php?f=15&t=61269
With current pbr, you will only get somekind of "shiny fx" only directly near dynamic light.(and that depends on the pbr material)

Enjay probably wants to achieve this with shaders
Image

However, I'm not sure if this can be achieved with hardware shaders in GZD
Anyways, here are some glsl (vertex and fragment) hardware shader examples of specular reflections
https://stackoverflow.com/questions/117 ... ed-surface
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Shiny Shader Possible?

Post by Nash »

With GZDoom's current material system, what Enjay wants would probably have to rely on there actually being attenuated lights placed in the map, as otherwise materials don't have any lighting to react to.

Makes me wonder how do early 2000s games do those faked environment map reflections? I'm thinking Unreal, Half-Life 1 etc.
User avatar
HAL9000
Posts: 266
Joined: Fri Mar 16, 2018 7:44 am
Contact:

Re: Shiny Shader Possible?

Post by HAL9000 »

Marisa managed to create half-life-ish fake envmap hardware shader for her UT mod, (check powerup items)
viewtopic.php?f=43&t=60759
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Shiny Shader Possible?

Post by Nash »

For those who don't want to download an entire mod just for this bit of code (actually found the same shader MK posted on Discord)

Code: Select all

vec4 Process(vec4 color)
{
    vec3 eyedir = normalize(uCameraPos.xyz - pixelpos.xyz);
    vec3 norm = reflect(eyedir, normalize(vWorldNormal.xyz));
    return getTexel(norm.xz * 0.5) * color;
}
 
And a variation by Striker:

Code: Select all

vec4 Process(vec4 color)
{
    vec3 eyedir = normalize(uCameraPos.xyz - pixelpos.xyz);
    
    vec3 x = dFdx(pixelpos.xyz);
    vec3 y = dFdy(pixelpos.xyz);
    vec3 normal = normalize(cross(x, y));

    vec3 norm = reflect(eyedir, normalize(normal.xyz));
    return getTexel(norm.xz * 0.5) * color;
}
 
Post Reply

Return to “Assets (and other stuff)”