nbohr1more Posted November 13 Report Posted November 13 Looks good but you could probably use a less blurry and more contrasted cubemap since the effect is almost too subtle now? Edit: Nevermind, this map just has the existing \ unchanged materials. I look forward to seeing the changes... Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
peter_spy Posted November 13 Report Posted November 13 As a side note, you might want to check texture sizes on that currency pack. 1024 px for a single coin or ingot is a big waste in terms of texture memory / pixel density. You can easily scale it down by half, or even quarter, with such small objects. Quote Artstation stuff
Arcturus Posted November 13 Author Report Posted November 13 On 11/5/2024 at 2:52 PM, nbohr1more said: one of our water glsl programs in the material I actually forgot that there's a blurring effect in the water. It would be useful if we had a stronger version of this effect. For example if we wanted to make Casper the friendly ghost. Spoiler Or crystal - I'm thinking of the scepter loot Spoiler ice Spoiler glass, etc. Spoiler textures/test/some_transparent_material { bumpmap textures\darkmod\some_normalmap { blend diffusemap map _white //rgb 0.3 red 0.2 green 0.2 blue 0.2 } { blend specularmap map _white //rgb 1 red 0.5 green 0.7 blue 1 } { vertexProgram heatHazeWithMaskAndDepth.vfp vertexParm 0 time * 0, time * 0 // texture scrolling vertexParm 1 10 // magnitude of the distortion fragmentProgram heatHazeWithMaskAndBlur.vfp fragmentMap 0 _currentRender fragmentMap 1 textures\darkmod\some_normalmap // the normal map for distortion fragmentMap 2 _white // the distortion blend map fragmentMap 3 _currentDepth } { forceHighQuality blend gl_dst_color, gl_src_color cubeMap env/studio_01/studio_01 texgen reflect rgb 0.5 } } In this video I used env/gen3, works quite well here. On 11/13/2024 at 8:33 AM, peter_spy said: As a side note, you might want to check texture sizes on that currency pack. 1024 px for a single coin or ingot is a big waste in terms of texture memory / pixel density. You can easily scale it down by half, or even quarter, with such small objects. According to the logs those were maade by @Wellingtoncrab 3 Quote It's only a model...
peter_spy Posted November 13 Report Posted November 13 Glass seems to be working as expected, this is a lead glass though, not raw crystal. Parallax mapping is a good candidate for the latter, as you can create an illusion of something being inside, without doubling the actual number of polygons. One of the few applications of parallax mapping today. You can also try ice. Quote Artstation stuff
Arcturus Posted November 13 Author Report Posted November 13 @peter_spy In this particular material parallax mapping isn't useful. For one thing, it doesn't interact properly with cubemap reflections (at least for the time being). They are drawn on top of non-parallax surface. And with the distortion effect on top you can't really see the parallax effect beneath. parallax without distortion: Spoiler With distortion: Spoiler Without parallax: Spoiler --- Having isolated bright spots in the cubemap makes a sparkle effect. Also having negative specularmap creates an interesting effect but it deosn't work in 32 bit the same way, unfortunately. 1 Quote It's only a model...
peter_spy Posted November 14 Report Posted November 14 Hmm, I think cubemaps are supposed to be drawn on top of the surface, as the additional fake reflections. But they should be affected by normalmaps, and height maps as well, IIRC. I've been trying to find videos on YT with practical applications, but I might need to record it myself, since most of them are focused on gameplay. Elden Ring crystals. The effect is more pronounced when you look closer: https://youtu.be/z1LcG6YCoNY?si=e1XoxYr9fm2KZUCa&t=110 Gears 5 ice: https://youtu.be/pByBy6RtZtw?si=rHUjq9JiyJG3M001&t=119 Quote Artstation stuff
peter_spy Posted November 14 Report Posted November 14 Also, what I was able to achieve without parallax mapping, a few years back: Quote Artstation stuff
Arcturus Posted November 14 Author Report Posted November 14 @peter_spy This is two separate materials, one for parallax, one for reflections. Spoiler textures/test/ice { diffusemap textures/test/ice_d bumpmap textures/test/ice_local { blend parallaxmap map textures/test/ice_height min -5 max 0 //refineSteps 10 linearSteps 400 grazingAngle 0 offsetExternalShadows 0 } } textures/test/ice2 { translucent bumpmap textures/test/ice2_local { blend specularmap map _white rgb 0.2 } { vertexProgram heatHazeWithMaskAndDepth.vfp vertexParm 0 0 // texture scrolling vertexParm 1 5 // magnitude of the distortion fragmentProgram heatHazeWithMaskAndBlur.vfp fragmentMap 0 _currentRender fragmentMap 1 textures/test/ice2_local // the normal map for distortion fragmentMap 2 _white // the distortion blend map fragmentMap 3 _currentDepth } { forceHighQuality blend gl_dst_color, gl_src_color cubeMap env/sparkles rgb 12 texgen reflect } } Edit: It can be simplified further by cramming parallax into second material and putting it in front of a black surface. We can get rid of the normalmap from the parallax stage, it even looks better without it in this case. Spoiler textures/test/ice { { blend diffusemap map _white rgb 0 } } textures/test/ice2 { translucent { blend diffusemap map textures/test/ice_d rgb 1 } bumpmap textures/test/ice2_local { blend specularmap map _white rgb 0.2 } { blend parallaxmap map textures/test/ice_height_inverted min -5 max 0 //refineSteps 10 linearSteps 400 grazingAngle 0 offsetExternalShadows 0 } { vertexProgram heatHazeWithMaskAndDepth.vfp vertexParm 0 0 // texture scrolling vertexParm 1 5 // magnitude of the distortion fragmentProgram heatHazeWithMaskAndBlur.vfp fragmentMap 0 _currentRender fragmentMap 1 textures/test/ice2_local // the normal map for distortion fragmentMap 2 _white // the distortion blend map fragmentMap 3 _currentDepth } { forceHighQuality blend gl_dst_color, gl_src_color cubeMap env/sparkles rgb 12 texgen reflect } } 1 Quote It's only a model...
peter_spy Posted November 15 Report Posted November 15 Yup, that looks promising Quote Artstation stuff
Arcturus Posted November 15 Author Report Posted November 15 I made a new env cubemap called "sparkles" which I applied to the scepter. The original material: Spoiler New: Spoiler Is there any lighting setup where blend gl_dst_color, gl_src_color may break? 2 Quote It's only a model...
peter_spy Posted November 15 Report Posted November 15 Btw. that sceptre is a great candidate for re-modelling, it looks way too simple for what you can do in TDM these days Quote Artstation stuff
Arcturus Posted November 15 Author Report Posted November 15 @peter_spy For now I updated the uv map a little bit, I hope that won't break anyone's missions. I guess I'll just start uploading those changes to the repository. Those sparkles probably will need to be toned down at the bottom of the cubemap. Quote It's only a model...
Arcturus Posted November 16 Author Report Posted November 16 heatHazeWithMaskAndBlur.fs blurs the image by offsetting four copies of the render. You can offset them even further for bigger effect, but with a help of Microsoft Copilot I also doubled number of layers. You can create blurring effect with stronger "heathaze" distortion but there are situations where having simple blur is more desirable. Spoiler /***************************************************************************** The Dark Mod GPL Source Code This file is part of the The Dark Mod Source Code, originally based on the Doom 3 GPL Source Code as published in 2011. The Dark Mod Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For details, see LICENSE.TXT. Project: The Dark Mod (http://www.thedarkmod.com/) ******************************************************************************/ #version 140 // !!ARBfp1.0 in vec4 var_tc0; in vec4 var_tc1; in vec4 var_tc2; out vec4 draw_Color; uniform sampler2D u_texture0; uniform sampler2D u_texture1; uniform sampler2D u_texture2; uniform vec4 u_scalePotToWindow; uniform vec4 u_scaleWindowToUnit; void main() { vec4 localNormal, mask, pos0, pos1, pos2, pos3, pos4, pos5, pos6, pos7, pos8; vec4 coord0, coord1, coord2, coord3, coord4, coord5, coord6, coord7, coord8; vec4 input0, input1, input2, input3, input4, input5, input6, input7, input8; vec4 subOne = vec4(-1, -1, -1, -1); vec4 scaleTwo = vec4(2, 2, 2, 2); // load the distortion map mask = texture(u_texture2, var_tc0.xy); mask.xy = (mask.xy) - (vec2(0.01)); if (any(lessThan(mask, vec4(0.0)))) discard; // load the filtered normal map and convert to -1 to 1 range localNormal = texture(u_texture1, var_tc1.xy); localNormal = (localNormal) * (scaleTwo) + (subOne); localNormal.z = sqrt(max(0, 1-localNormal.x*localNormal.x-localNormal.y*localNormal.y)); localNormal = (localNormal) * (mask); // calculate the screen texcoord in the 0.0 to 1.0 range // Initialise the positions pos0 = gl_FragCoord; pos1 = pos0; pos2 = pos0; pos3 = pos0; pos4 = pos0; pos5 = pos0; pos6 = pos0; pos7 = pos0; pos8 = pos0; // Offset the positions by a larger amount to increase the blurring effect pos1.y = (pos1.y) + (-10); pos2.x = (pos2.x) + (10); pos3.y = (pos3.y) + (10); pos4.x = (pos4.x) + (-10); pos5.y = (pos5.y) + (-20); pos6.x = (pos6.x) + (20); pos7.y = (pos7.y) + (20); pos8.x = (pos8.x) + (-20); // convert pixel's screen position to a fraction of the screen width & height coord0 = (pos0) * (u_scaleWindowToUnit); coord1 = (pos1) * (u_scaleWindowToUnit); coord2 = (pos2) * (u_scaleWindowToUnit); coord3 = (pos3) * (u_scaleWindowToUnit); coord4 = (pos4) * (u_scaleWindowToUnit); coord5 = (pos5) * (u_scaleWindowToUnit); coord6 = (pos6) * (u_scaleWindowToUnit); coord7 = (pos7) * (u_scaleWindowToUnit); coord8 = (pos8) * (u_scaleWindowToUnit); // scale by the screen non-power-of-two-adjust coord0 = (coord0) * (u_scalePotToWindow); coord1 = (coord1) * (u_scalePotToWindow); coord2 = (coord2) * (u_scalePotToWindow); coord3 = (coord3) * (u_scalePotToWindow); coord4 = (coord4) * (u_scalePotToWindow); coord5 = (coord5) * (u_scalePotToWindow); coord6 = (coord6) * (u_scalePotToWindow); coord7 = (coord7) * (u_scalePotToWindow); coord8 = (coord8) * (u_scalePotToWindow); // offset by the scaled localNormal and clamp it to 0.0 - 1.0 coord0 = clamp((localNormal) * (var_tc2) + (coord0), 0.0, 1.0); coord1 = clamp((localNormal) * (var_tc2) + (coord1), 0.0, 1.0); coord2 = clamp((localNormal) * (var_tc2) + (coord2), 0.0, 1.0); coord3 = clamp((localNormal) * (var_tc2) + (coord3), 0.0, 1.0); coord4 = clamp((localNormal) * (var_tc2) + (coord4), 0.0, 1.0); coord5 = clamp((localNormal) * (var_tc2) + (coord5), 0.0, 1.0); coord6 = clamp((localNormal) * (var_tc2) + (coord6), 0.0, 1.0); coord7 = clamp((localNormal) * (var_tc2) + (coord7), 0.0, 1.0); coord8 = clamp((localNormal) * (var_tc2) + (coord8), 0.0, 1.0); // load the screen render input0 = texture(u_texture0, coord0.xy); input1 = texture(u_texture0, coord1.xy); input2 = texture(u_texture0, coord2.xy); input3 = texture(u_texture0, coord3.xy); input4 = texture(u_texture0, coord4.xy); input5 = texture(u_texture0, coord5.xy); input6 = texture(u_texture0, coord6.xy); input7 = texture(u_texture0, coord7.xy); input8 = texture(u_texture0, coord8.xy); // Average the values and pump it into the fragment's color input0 = (input0) + (input1); input0 = (input0) + (input2); input0 = (input0) + (input3); input0 = (input0) + (input4); input0 = (input0) + (input5); input0 = (input0) + (input6); input0 = (input0) + (input7); input0 = (input0) + (input8); input0 = (input0) * (vec4(1.0 / 9.0)); // Average over 9 samples draw_Color = input0; } 1 Quote It's only a model...
Arcturus Posted November 16 Author Report Posted November 16 @nbohr1more When I played with mirrored reflections on water I would render them at super low resolution mirrorRenderMap 128 128 Can't we just scale _currentRender down and get blur for free instead of doing the offsetting thing? Quote It's only a model...
nbohr1more Posted November 16 Report Posted November 16 I think _currentRender uses the whole framebuffer but perhaps we can add something similar to the r_fboResolution cvar as a material flag. I'll look at the code. Maybe _currentRender is still hooked into the old Doom 3 generated texture system ( a sort of precursor to FBO homemade by Carmack ). 1 Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
peter_spy Posted November 16 Report Posted November 16 IIRC, setting custom resolution to mirrorRenderMap stopped working a few versions ago, the output is always at game resolution. That blur effect looks good, we could have frosted/steamed glass now. But, I worry about the performance cost. That said, even if you try making such material in UE4/5, you'd get a huge performance drop too, at least in the editor windows. Probably best to use it sparingly anyway Quote Artstation stuff
Arcturus Posted November 16 Author Report Posted November 16 The best I was able to get with MS Copilot was this: Spoiler #version 140 in vec4 var_tc0; in vec4 var_tc1; in vec4 var_tc2; out vec4 draw_Color; uniform sampler2D u_texture0; void main() { // Calculate the screen texcoord in the 0.0 to 1.0 range vec2 coord = gl_FragCoord.xy * vec2(1.0 / 960, 1.0 / 540); // Adjust the resolution to match your screen size // Sample the screen render vec4 input = texture(u_texture0, coord); // Output the color directly draw_Color = input; } Quote It's only a model...
Arcturus Posted November 17 Author Report Posted November 17 I uploaded the heathaze with stronger blur but in the end with only 4 samples, like the old one, even if it looks worse. I needed it for the scepter material. I added a separate normalmap for the refraction effect. Quote It's only a model...
nbohr1more Posted November 17 Report Posted November 17 Looks good to me 1 Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
Arcturus Posted November 17 Author Report Posted November 17 A problem: When put in front of another object that also uses heathaze with blur, it explodes: Spoiler Spoiler Quote It's only a model...
Arcturus Posted November 17 Author Report Posted November 17 @nbohr1more What about this file gaussian_blur.frag.glsl ? What does it do? There's no way to use it? Quote It's only a model...
nbohr1more Posted November 17 Report Posted November 17 It's used for bloom and frob features. It's designed for billboard \ screen facing 2D operations. Might be able to adapt it to UV space though... Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
Arcturus Posted November 17 Author Report Posted November 17 @nbohr1more On second thought this isn't really a problem with the scepter material, but more with that large ice pane material. A little bit of both. The ice blurs everything in front, but normally it's not that noticeable. Quote It's only a model...
nbohr1more Posted November 17 Report Posted November 17 Ah, that needs to be fixed by sampling the depth buffer like the other water shaders do. Gonna be difficult since all 5 sample pixels need to check the depth buffer before the final blur. Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.