Doom 1 Parallax Mapping (2 versions available)

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Tormentor667 » Thu Oct 17, 2019 9:36 am

One more question, I noticed your GLDEFS lump looks like this:
Code: Select allExpand view
material texture "BIGDOOR1"
{
   shader "shaders/displacement.fp"
   normal "materials/normalmaps/BIGDOOR1.png"
   specular "materials/specular/BIGDOOR1.png"
   texture displacement "materials/displacement/BIGDOOR1.png"
   glossiness 10.0
   specularlevel 0.5
}

The interesting part of this is only the "displacement" thing as I consider using this in Blade of Agony for various textures. Is there any way to make the engine automatically use the displacement texture with the same texture name instead of writing a GLDEFS entry to the lump for each texture?

Beyond that, what performance impact does this have in general?
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Rachael » Thu Oct 17, 2019 2:24 pm

The interesting part of this is only the "displacement" thing as I consider using this in Blade of Agony for various textures. Is there any way to make the engine automatically use the displacement texture with the same texture name instead of writing a GLDEFS entry to the lump for each texture?

Personally I just would write a tool to automate this. I'm not fucking around with GLDEFS if I have to do everything manually en masse.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Tormentor667 » Fri Oct 18, 2019 4:28 am

If I'd only be able to program something like that :) Checking the "materials/displacement/" folder and writing a TXT file according to the existing textures in the folder. So a "BIGDOOR1.png" in "materials/displacement" would generate this:
Code: Select allExpand view
material texture "BIGDOOR1"
{
   shader "shaders/displacement.fp"
   texture displacement "materials/displacement/BIGDOOR1.png"
}

I just wonder what could be done with longname textures...
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Rachael » Fri Oct 18, 2019 4:34 am

I could do it. In fact I could probably write a simple batch file for it. What I'd need, though, is knowing where to find the textures, and where to find their displacements.

As for longname textures, that shouldn't be a problem at all. I imagine it's just as simple as putting their longname in, instead of their shortname. Might have to do both, but the program can handle that.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Doom 1 Parallax Mapping (2 versions available)

Postby zhadoom » Fri Oct 18, 2019 8:51 am

Hello

Well, the much larger problem is to generate these displacement map files. I mean... there are so many awesome texture sets for GZDoom and none of them has displacement maps yet...

Kind regards
zhd
zhadoom
 
Joined: 04 Feb 2019

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Tormentor667 » Fri Oct 18, 2019 11:36 am

Rachael wrote:I could do it. In fact I could probably write a simple batch file for it. What I'd need, though, is knowing where to find the textures, and where to find their displacements. As for longname textures, that shouldn't be a problem at all. I imagine it's just as simple as putting their longname in, instead of their shortname. Might have to do both, but the program can handle that.

Thanks for the offer, that would be cool :) The textures are in the „/textures/„ folder and its subfolders. The displacement textures are in the „/materials/displacement/„ folder, without subfolders.
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Tormentor667 » Sun Oct 20, 2019 1:57 am

Sorry for the double post but is anyone able to explain how much impact the displacement maps have on the engine performance? Is it a CPU or a GPU feature? What makes it run slower or faster? The amount of textures visible or the amount of textures in the map overall?
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Rachael » Sun Oct 20, 2019 2:55 am

1) The displacement maps have a notable effect on engine performance, enough that you might consider distributing an add-on to disable the shader.
2) It's a GPU feature, the CPU is not affected. Anyone with a strong (ie GTX 1080+) GPU will probably not notice a difference, here, regardless of the power of their CPU.
3) The detail settings affect it running slower or faster, however even at minimum detail there is a performance impact and minimum detail is enough to create major artifacts. A card like a GTX 1080 will handle this like a champ, but anything older will have issues.
4) Only the amount of textures visible should affect things, but it depends on how much of the scene is culled. If you have a lot of the scene behind 1-sided lines, or closed (ie floorheight==ceilheight) sectors, it will speed things up considerably.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Rachael » Sun Oct 20, 2019 3:37 am

Okay, I made you something. I have made you a pull request that will stick it in your tools/ folder. (It will *only* work if placed in a first-level subfolder, if you need it someplace else you'll have to change the "cd %~dp0\.." line)

Right now, all it does is spit its output out to the console. If you want to create an actual file with it, it would be as thus:
Code: Select allExpand view
call D:\WolfenDoom\tools\gldefs-mats-generator.cmd > D:\WolfenDoom\gldefs.autogen


The "call" is assuming you are using this within a batch file, and allows nested batch file execution with a graceful exit. Replace D:\WolfenDoom with your actual development folder path, obviously.

If I call the batch file with the branch in its current state, this is its output:
Code: Select allExpand view
material texture "textures/AFRK_T02.jpg"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\AFRK_T02.png"
}

material texture "AFRK_T02"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\AFRK_T02.png"
}

material texture "textures/AFRK_T07.png"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\AFRK_T07.png"
}

material texture "AFRK_T07"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\AFRK_T07.png"
}

material texture "textures/BRIK_T05.png"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\BRIK_T05.png"
}

material texture "BRIK_T05"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\BRIK_T05.png"
}

material texture "textures/ROCK_G32.png"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\ROCK_G32.png"
}

material texture "ROCK_G32"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\ROCK_G32.png"
}

material texture "textures/SAND_T02.png"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\SAND_T02.png"
}

material texture "SAND_T02"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\SAND_T02.png"
}

material texture "textures/STON_G10.png"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\STON_G10.png"
}

material texture "STON_G10"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\STON_G10.png"
}

material texture "textures/egypt/EGYP_S03.png"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\EGYP_S03.png"
}

material texture "EGYP_S03"
{
        shader "shaders/displacement.fp"
        texture displacement "materials\displacement\EGYP_S03.png"
}
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Tormentor667 » Mon Oct 21, 2019 11:48 am

Works like a charm, thanks kinldy Rachael, more comments on the GitHub :)
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Ozymandias81 » Mon Oct 21, 2019 3:32 pm

I have two questions about this cool parallax mapping:

1. Could be the shader controlled via zscript to let users switch it on/off, and if yes how?
2. While I am a total noob with shaders coding, could be this one optimized in a way that the code interprete the effect with lowpoly details somehow? The effect actually impacts deeply in performance with low profile GPUs, for instance mine has 1gb of vram
Last edited by Ozymandias81 on Mon Oct 21, 2019 3:49 pm, edited 1 time in total.
User avatar
Ozymandias81
Doom is a State of Mind... Out of Control.
 
Joined: 04 Jul 2013
Location: Mount Olympus, Mars
Github ID: Ozymandias81
Operating System: Windows Vista/7 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Doom 1 Parallax Mapping (2 versions available)

Postby Rachael » Mon Oct 21, 2019 3:38 pm

1) Unfortunately, no, not unless custom material-specific uniforms are created for shaders within GZDoom itself.
2) Honestly, I am not sure.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Previous

Return to Shaders

Who is online

Users browsing this forum: No registered users and 0 guests