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.
User avatar
cambertian
Posts: 344
Joined: Thu May 07, 2015 4:24 pm
Graphics Processor: nVidia with Vulkan support
Location: New England Area, USA

Re: Materials (PBR, Specular, Normal maps)

Post by cambertian »

I've been trying to get normal and specular maps working on a weapon sprite to no avail. Can you only use them on entities?
I tried putting them in the auto folder, renaming them so they don't conflict with the actual sprite, and specifying the full file paths, as well as updating to a dev build from 3.3.2 (which also happened to glitch the graphics, even without a PWAD.)
See attachment.
Attachments
specular.pk3
(9.89 KiB) Downloaded 281 times
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Materials (PBR, Specular, Normal maps)

Post by Indecom »

These materials only work on level geometry and imported models
hardcore_gamer
Posts: 109
Joined: Sun Jan 14, 2018 12:14 pm

Re: Materials (PBR, Specular, Normal maps)

Post by hardcore_gamer »

I am a bit confused in regards to how to get pbr on models. I figured it out for wall textures and flats but I can't seem to get them working for a test cube I made.

I can get the model working with just a normal texture merely by placing the texture inside the same folder as the md3 model, but when I place the other textures into the auto folders they don't appear to work. My setup is this:

The model:

Models/cube/cube.md3

Base/diffuse texture:

Models/Cube/cube.png

The pbr maps:

Materials/normal(or roughness, metal, ao etc)/auto/cube (all the texture maps are just called cube)

And yet while the model shows up with the diffuse texture the rest don't work. What am I doing wrong?
User avatar
HAL9000
Posts: 266
Joined: Fri Mar 16, 2018 7:44 am
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post by HAL9000 »

@hardcore_gamer

Here is Testcube with PBR materials I made for my project
https://www.dropbox.com/s/mn2i0nvwb9b00 ... M.rar?dl=0

Code: Select all

MAP Lights
Summon TESTCUBE3D
Or summon on any map with dynamic lights
Cheers!

Everything working as intended, Image:
Spoiler:
hardcore_gamer
Posts: 109
Joined: Sun Jan 14, 2018 12:14 pm

Re: Materials (PBR, Specular, Normal maps)

Post by hardcore_gamer »

I tried creating my own version of the file you uploaded using my own test cube and textures but it still doesn't work. Here is the file: https://ufile.io/ftm8q

There are also some things about your file that left me confused. For example, why do many of the text files have the word darkforces in them? And what are those dfm files?
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 will check it out later,
Ignore dfm extension and other extensions, its just custom modeldef extension for my project
(dark forces model - dfm Dark forces actor - dfa etc....)

Update:
Ok Here is your Cube Actor, Fixed with working PBR (your textures).
I also created alternative pbr textures for it.
DOWNLOAD: https://www.dropbox.com/s/mt8ve6a4r8gon ... x.rar?dl=0

Also ,Normals on your MD3 models were Broken. Be sure to check your model normals & phong/curvature when exporting to MD3.
Phong/Curvature will affect how the texture will behave&look on model. I've fixed the model normal and set your curvature to default 22.5°

Normals/Curavture before & After
Spoiler:
Cheers!
hardcore_gamer
Posts: 109
Joined: Sun Jan 14, 2018 12:14 pm

Re: Materials (PBR, Specular, Normal maps)

Post by hardcore_gamer »

"Unable to find sprite lump "CUBEA" used by actor "cube":11001. Forgot to include required resources?"

I just get this error when I try to load the pk3 into gzdoom builder (I converted the files you uploaded to a pk3 so it could be loaded).

EDIT: I could still summon it with the "summon cube" command but it doesn't seem to work in gzdoom builder.
User avatar
HAL9000
Posts: 266
Joined: Fri Mar 16, 2018 7:44 am
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post by HAL9000 »

It's not PK3 file, my archive was RAR with folders, I did not package it to PK3
Also Try to edit the cube actor to fit your requirements, I used my testcube actor's properties for this test.
I loaded it up with GZDoom 3.3.1 It works flawlessly

your original textures with fixed cube model
Spoiler:
new textures (so that you can see metalness/roughness fx)
Spoiler:
Last edited by HAL9000 on Tue May 08, 2018 4:34 pm, edited 1 time in total.
hardcore_gamer
Posts: 109
Joined: Sun Jan 14, 2018 12:14 pm

Re: Materials (PBR, Specular, Normal maps)

Post by hardcore_gamer »

Yea I was just about to post to notify you I fixed the problem. I had to make some changes to the frame index definitions and then it worked. Thanks for your help mate, it's been useful :P
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post by Nash »

Hi, thought I'd drop a couple of good tutorials on PROPER normal map creation.

No kids, don't throw everything you got into CrazyBump or NormalMap-Online. Take some time to do PROPER normal maps and perhaps your visuals won't end up looking like asset flips.

http://www.opengl-tutorial.org/assets/i ... iniTut.jpg (save this image in case it goes offline)

https://www.katsbits.com/tutorials/text ... images.php

Now if you read the second tutorial, under the comments section, someone said it's possible to "generate" results with high-passing and what-not. That's cool too. Personally, I would recommend a workflow of first hand-painting your heightmaps and then converting that to a normal map to describe the huge cavities of the texture, and then using a generated (from diffuse) image to layer on top for micro detail (things like tiny bumps, surface irregularities etc). You'd typically paste the generated version on a separate layer and use the eraser tool to take out any parts that would collide with the main cavities from the hand-painted version.

BUT WAIT! Combining normal maps might not be as straight forward as you think it is. There's actually a trick to it. If you try to Google this stuff, there's a looooot of posts talking about maths and things like that, however I found the best way to do it that is the simplest and doesn't require math:
There's a pretty easy and completely correct (from mathematical point of view) method to combine two normal maps in PS.
Say, layer A is basic NM, layer B is detail NM. So to put detail from B over A you have to do the following steps:
1. Clone layer B - B2
2. Go to blue channel of B2 and fill it with neutral gray.
3. Set B2 layer blending to Overlay
4. Select original B and set it to Multiply blending mode.
5. Select red and green channels of B and fill them with pure white.
6. Put B and B2 into the new group, use group mask and opacity to adjust blending.

7 (Optional). If your target engine doesn't perform runtime NM normalization - you have to do in manually using for example Xnromal's plugin.
But actually everything always works fine even without normalization.
I have not covered best practices for generating specular maps yet. I'm still experimenting with this to find the best way. But you usually can get good results by taking a greyscale version of your diffuse and playing with the levels. I'll update this post once I've found a good specularity workflow.

Lastly, I intentionally haven't covered anything about PBR because the implementation in GZDoom is still incomplete (no reflection probes).
User avatar
Kappes Buur
 
 
Posts: 4114
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post by Kappes Buur »

Nash wrote:.....
BUT WAIT! Combining normal maps might not be as straight forward as you think it is. There's actually a trick to it. If you try to Google this stuff, there's a looooot of posts talking about maths and things like that, however I found the best way to do it that is the simplest and doesn't require math:.....
Interesting.
Would you mind including images of the various steps?
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Materials (PBR, Specular, Normal maps)

Post by Indecom »

I've been away for a while for work, so I haven't kept up with doom. Is PBR a thing that works with sprites yet? lol
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Materials (PBR, Specular, Normal maps)

Post by Graf Zahl »

No, considering that sprites do not get "real" dynamic lighting.
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Materials (PBR, Specular, Normal maps)

Post by Nash »

Sprites getting "real" lighting (per pixel lighting) actually looks horrible, because the sprite billboard rotates depending on your view angle, which will cause the sprite's lighting to change as you circle strafe around it.

Imagine: you are in a dark room and there's an Imp standing in front of you. There is a red torch behind the imp. From where you are standing now, the imp is dark. Now if you reposition yourself so that now the red torch is in front of you, and the imp is behind it, suddenly the imp is brighter because the side of the imp billboard that's facing you is now rotated towards the red torch.
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Materials (PBR, Specular, Normal maps)

Post by Indecom »

Oh I understand the stipulations of applying PBR to flat planes that rotate in a 3D space. The reason I want it is to apply it to the weapons in the player view, not so much to apply it to the sprites in the environment. This is a gorgeous effect that you can see put to great use in the game Amid Evil. I've already accomplished this with GZDoom but I had to trick the engine to make it work.
Post Reply

Return to “Tutorials”