Shiny Shader Possible?

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Shiny Shader Possible?

Re: Shiny Shader Possible?

by Nash » Mon Jul 16, 2018 2:21 am

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;
}
 

Re: Shiny Shader Possible?

by HAL9000 » Mon Jul 16, 2018 2:11 am

Marisa managed to create half-life-ish fake envmap hardware shader for her UT mod, (check powerup items)
viewtopic.php?f=43&t=60759

Re: Shiny Shader Possible?

by Nash » Mon Jul 16, 2018 1:57 am

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.

Re: Shiny Shader Possible?

by HAL9000 » Mon Jul 16, 2018 1:36 am

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

Re: Shiny Shader Possible?

by Enjay » Mon Jul 16, 2018 1:30 am

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.

Re: Shiny Shader Possible?

by Pixel Eater » Sun Jul 15, 2018 5:24 pm

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...

Shiny Shader Possible?

by Enjay » Sun Jul 15, 2018 4:56 am

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.

Top