Shiny Shader Possible?

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!
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.

Shiny Shader Possible?

Postby Enjay » Sun Jul 15, 2018 5: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.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Shiny Shader Possible?

Postby Pixel Eater » Sun Jul 15, 2018 6: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...
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: Shiny Shader Possible?

Postby Enjay » Mon Jul 16, 2018 2: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.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Shiny Shader Possible?

Postby HAL9000 » Mon Jul 16, 2018 2: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
User avatar
HAL9000
I'm sorry Dave, I'm afraid I can't do that
 
Joined: 16 Mar 2018
Discord: HAL9000#9378

Re: Shiny Shader Possible?

Postby Nash » Mon Jul 16, 2018 2: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.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia GTX or Quadro with Vulkan support

Re: Shiny Shader Possible?

Postby HAL9000 » Mon Jul 16, 2018 3: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
User avatar
HAL9000
I'm sorry Dave, I'm afraid I can't do that
 
Joined: 16 Mar 2018
Discord: HAL9000#9378

Re: Shiny Shader Possible?

Postby Nash » Mon Jul 16, 2018 3: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 allExpand view

vec4 Process
(vec4 color)
{
    
vec3 eyedir normalize(uCameraPos.xyz pixelpos.xyz);
    
vec3 norm reflect(eyedirnormalize(vWorldNormal.xyz));
    return 
getTexel(norm.xz 0.5) * color;
}
 


And a variation by Striker:

Code: Select allExpand view

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(xy));

    
vec3 norm reflect(eyedirnormalize(normal.xyz));
    return 
getTexel(norm.xz 0.5) * color;
}
 
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia GTX or Quadro with Vulkan support


Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 2 guests