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.

Re: Shader Help Thread

Postby Darkcrafter » Mon Jun 06, 2022 3:51 pm

I would like to make at least a semidecent fake environment map based shader. I already got one working in GZDoom but I'd like to mix that shader result to a texture applied so the effect of "reflection" would have an effect amount (opacity).

Here is the shader by Marisa:

Code: Select allExpand view
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 ;
}


It basicaly takes a texture (environment map) and applies it over a surface so it renders in a sky manner.
Here is what it looks like:
The shader.jpg


Here is what I'd like to get (I put a thin opaque 3D floor above the surface with the shader texture applied):
Desired result.jpg


Here is the enivornment map texture:
EnvironmentMap.jpg


So what I'd like to get is to being able to define a particular environment map texture in GLDEFS per texture so the shader would kind of process both textures at once, like that:

Code: Select allExpand view

material texture "FLOOR7_2"
{
   shader "shaders/EnvMapRefl_Marisa.fp"
        reflectionmap "textures/reflectionmaps/environmentmap1.jpg"
        opacity 0.5
}
You do not have the required permissions to view the files attached to this post.
Darkcrafter
 
Joined: 23 Sep 2017
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Previous

Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 0 guests