Materials (PBR, Specular, Normal maps)

Handy guides on how to do things, written by users for users.

Moderators: GZDoom Developers, Raze Developers

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.
Post Reply
Talon1024
 
 
Posts: 373
Joined: Mon Jun 27, 2016 7:26 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Contact:

Materials (PBR, Specular, Normal maps)

Post 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.
Last edited by Talon1024 on Fri Nov 09, 2018 12:22 am, edited 5 times in total.
Talon1024
 
 
Posts: 373
Joined: Mon Jun 27, 2016 7:26 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Contact:

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

Post by Talon1024 »

Updated 2018/03/05: Corrected info about PBR materials, and added info about auto materials.
User avatar
Tormentor667
Posts: 13530
Joined: Wed Jul 16, 2003 3:52 am
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post 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.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Materials (PBR, Specular, Normal maps)

Post by Major Cooke »

What I'd be most interested in is a guide on how to generate them the best way possible.
User avatar
Chris
Posts: 2940
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Materials (PBR, Specular, Normal maps)

Post by Chris »

Here is what a quick search turned up.
User avatar
ramon.dexter
Posts: 1516
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Materials (PBR, Specular, Normal maps)

Post 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.
User avatar
Nash
 
 
Posts: 17429
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post 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.
User avatar
ramon.dexter
Posts: 1516
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Materials (PBR, Specular, Normal maps)

Post by ramon.dexter »

Nash: Great, many thanks!

I found some normal map generator, but the result was...well, terrible.
User avatar
HAL9000
Posts: 266
Joined: Fri Mar 16, 2018 7:44 am
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post 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
User avatar
ZeHatsu
Posts: 4
Joined: Mon Dec 11, 2017 3:18 am

Re: Materials (PBR, Specular, Normal maps)

Post 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.
Talon1024
 
 
Posts: 373
Joined: Mon Jun 27, 2016 7:26 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post 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.
User avatar
HAL9000
Posts: 266
Joined: Fri Mar 16, 2018 7:44 am
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post 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.
Last edited by HAL9000 on Tue Apr 17, 2018 5:16 am, edited 1 time in total.
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Materials (PBR, Specular, Normal maps)

Post 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?
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: Materials (PBR, Specular, Normal maps)

Post 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.
User avatar
Mynameislol
Posts: 51
Joined: Thu Feb 02, 2017 5:19 pm

Re: Materials (PBR, Specular, Normal maps)

Post 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
Post Reply

Return to “Tutorials”