Page 1 of 8

Materials (PBR, Specular, Normal maps)

Posted: Wed Feb 14, 2018 7:36 am
by Talon1024
NOTE: This guide requires a recent build of QZDoom from Jan 25 or later. This guide will NOT WORK with GZDoom.
Updated 2018/03/05: Corrected info about PBR materials, added info about auto materials.
GZDoom dev builds support materials now!

If you've been following the QZDoom commit log, dpJudas has been working on adding support for specular maps, normal maps, and PBR maps (roughness, metalness, and ambient occlusion).

To make your own materials, you have to provide the relevant texture maps, and then define them in GLDefs, or put them in the auto material folders. At the very least, you need a normal map and a specular map for "classic" materials, or a normal map, a metalness map, a roughness map, and an ambient occlusion map for PBR materials.

A material definition looks like this:

Code: Select all

material <flat|texture> <TEXTURENAME>
{
    normal <NORMALMAP>
    specular <SPECULARMAP>
    specularlevel <float>
    glossiness <float>
    brightmap <BRIGHTMAP>
    [iwad]
    [thiswad]
    [disablefullbright]
}
iwad, thiswad, and disablefullbright work the same way they do for GLDEFS brightmap definitions.

Or for PBR materials:

Code: Select all

material <flat|texture> <TEXTURENAME>
{
    normal <NORMALMAP>
    metallic <METALMAP>
    roughness <ROUGHMAP>
    ao <AMBIENTOCCLUSIONMAP>
    brightmap <BRIGHTMAP>
    [iwad]
    [thiswad]
    [disablefullbright]
}
And the auto material folders are as follows:
  • materials/brightmaps/auto or brightmaps/auto for brightmaps.
  • materials/normalmaps/auto for normal maps.
  • materials/specular/auto for specular maps.
  • materials/metallic/auto for metalness maps.
  • materials/roughness/auto for roughness maps.
  • materials/ao/auto for ambient occlusion maps.
You can use GLDefs definitions if you want to fine-tune your materials' lighting characteristics. Also, if you are using full path textures (long texture names in GZDoom Builder), you will need to define your materials manually in GLDefs. Auto materials will not affect textures with long/full path names.

You can also apply material definitions to 3D model textures, but you'll need to have the model reference the textures. GZDoom and QZDoom use shader names in MD3s as texture names. If you use shader names in your MD3 model, be sure they match the names of the textures specified in the material definitions.

Also, only attenuated lights are affected by "classic" diffuse/specular/normal textures. Only PBR materials (metalness/roughness/ao/normal) are also affected by non-attenuated lights.

Here is a demo for those interested.

Re: [QZDoom] Materials (PBR, Specular, Normal maps)

Posted: Mon Mar 05, 2018 9:59 pm
by Talon1024
Updated 2018/03/05: Corrected info about PBR materials, and added info about auto materials.

Re: Materials (PBR, Specular, Normal maps)

Posted: Wed Mar 07, 2018 1:17 am
by Tormentor667
Would you mind adding some kind of information on what each material layer/folder actually does? For a total newbie when it comes to such things, I have no idea how to create each layer and how to control each layer.

Re: Materials (PBR, Specular, Normal maps)

Posted: Thu Mar 08, 2018 3:46 pm
by Major Cooke
What I'd be most interested in is a guide on how to generate them the best way possible.

Re: Materials (PBR, Specular, Normal maps)

Posted: Thu Mar 08, 2018 6:57 pm
by Chris
Here is what a quick search turned up.

Re: Materials (PBR, Specular, Normal maps)

Posted: Wed Mar 21, 2018 6:52 am
by ramon.dexter
Yes, the link provided covers allthe topics.
But I'm wondwring if there is any guide, that will guide me how to make the required maps MANUALLY - So, I have a texture, and I want to add materials. I have never done such a thing, so I need some basic guide. Is there any guidelike this? Also, I dont like any automatic processes (like input texture, and process will throw out materials), I want to paint the materials maps by hand. But I dont know how, also I dont know if there are any do's and don't do's.

Re: Materials (PBR, Specular, Normal maps)

Posted: Wed Mar 21, 2018 10:08 am
by Nash
@ramon.dexter try this: http://www.opengl-tutorial.org/assets/i ... iniTut.jpg

And yes, agreed, don't throw everything into an automatic generator, more often than not the results will come out lame as fuck. Actual artistic talent is needed to make PBR or diffuse/normal/specular look good.

Re: Materials (PBR, Specular, Normal maps)

Posted: Wed Mar 21, 2018 2:50 pm
by ramon.dexter
Nash: Great, many thanks!

I found some normal map generator, but the result was...well, terrible.

Re: Materials (PBR, Specular, Normal maps)

Posted: Wed Mar 21, 2018 6:31 pm
by HAL9000
Ok,I need some help. I made quick Pillar 3D PBR model from scratch for testing purposes.
(Painted to be full PBR metallness roughness compatible)

Here are some Gifs from Imgur:
HQ render:
https://i.imgur.com/SHfCMOl.gif
Realtime PBR
https://i.imgur.com/k1b2MHc.gif


I followed the provided qz/gzdoom PBR info, but only Classic Normal/Gloss/Spec Shading is working atm for me.
I can't get PBR (metalness/roughness) to work in Gzdoom (g3.3pre-658-gfae6f22a2)

Some Shots of Gloss/Spec shader running in Gzdoom.
https://i.imgur.com/dcDt3Zu.png
https://i.imgur.com/DcwImTZ.png

Does anyone have more info how to get PBR(metalness roughness) working in GZ ?
Thanks

Re: Materials (PBR, Specular, Normal maps)

Posted: Sun Mar 25, 2018 10:13 pm
by ZeHatsu
Major Cooke wrote:What I'd be most interested in is a guide on how to generate them the best way possible.
Substance Designer and Substance B2M are fantastic tools for this, though they are pretty costly.

Re: Materials (PBR, Specular, Normal maps)

Posted: Mon Mar 26, 2018 5:18 pm
by Talon1024
For non-PBR materials, you need:
  1. Specular map
  2. Normal map
For PBR materials, you need:
  1. Normal map
  2. Roughness map
  3. Metalness map
  4. Ambient Occlusion map
None of these maps are optional. For example, if you're missing the Ambient Occlusion map for a PBR material, the material won't work.

The sword from the demo PK3 (which is from OpenGameArt) didn't have an ambient occlusion map, so I imported the model into Blender and baked an ambient occlusion map in Blender.

I hope this helps clear some things up.

Re: Materials (PBR, Specular, Normal maps)

Posted: Tue Mar 27, 2018 9:29 am
by HAL9000
It is working Perfectly.
Also, I have noticed it only works with dynamic lights atm

Some SShots of Sexy light Reflections on PBR models
https://i.imgur.com/qVWCNzn.jpg
https://i.imgur.com/nTHAFX8.jpg

Also it would be a nice feature if we could set the "amount of Metalness/Roughness" from 0 to 100% similar as Gloss/Spec

Code: Select all

specularlevel 0.5
glossiness 0.3
example idea:

Code: Select all

metalnesslevel 50
roughnesslevel 100
Btw Substance painter is pretty affordable at price of 20$/month,
I used it for almost a year so far, its totally worth the price.

Re: Materials (PBR, Specular, Normal maps)

Posted: Wed Mar 28, 2018 12:54 am
by Indecom
Will these materials work for equipped weapon sprites or does that use a separate shader? If so, how much work would it be for me to get a comparable effect on an equipped sprite?

Re: Materials (PBR, Specular, Normal maps)

Posted: Wed Mar 28, 2018 2:19 am
by dpJudas
I haven't tried, but I think it uses the right shader. Unfortunately it only applies dynamic lights as an uniform color there - you won't be able to get such effect on a psprite.

Re: Materials (PBR, Specular, Normal maps)

Posted: Fri Mar 30, 2018 3:41 am
by Mynameislol
Here's some normal maps & specular maps, they need to be renamed & configured properly to work

https://drive.google.com/drive/folders/ ... sp=sharing

All credit goes to mpobers