Page 5 of 5

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Thu Oct 17, 2019 9:36 am
by Tormentor667
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?

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Thu Oct 17, 2019 2:24 pm
by Rachael
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.

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Fri Oct 18, 2019 4:28 am
by Tormentor667
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...

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Fri Oct 18, 2019 4:34 am
by Rachael
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.

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Fri Oct 18, 2019 8:51 am
by zhadoom
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

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Fri Oct 18, 2019 11:36 am
by Tormentor667
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.

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Sun Oct 20, 2019 1:57 am
by Tormentor667
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?

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Sun Oct 20, 2019 2:55 am
by Rachael
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.

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Sun Oct 20, 2019 3:37 am
by Rachael
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"
}

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Mon Oct 21, 2019 11:48 am
by Tormentor667
Works like a charm, thanks kinldy Rachael, more comments on the GitHub :)

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Mon Oct 21, 2019 3:32 pm
by Ozymandias81
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

Re: Doom 1 Parallax Mapping (2 versions available)

PostPosted: Mon Oct 21, 2019 3:38 pm
by Rachael
1) Unfortunately, no, not unless custom material-specific uniforms are created for shaders within GZDoom itself.
2) Honestly, I am not sure.