Enabling metallic workflow from material script

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Hotshot5000
OGRE Contributor
OGRE Contributor
Posts: 256
Joined: Thu Oct 14, 2010 12:30 pm
x 64

Enabling metallic workflow from material script

Post by Hotshot5000 »

I have a material:

Code: Select all

hlms ship_human0_mat pbs
{
	roughness	0.4
	fresnel		1.33
	
	diffuse_map		ship_human0_BaseColor.png
	normal_map		ship_human0_Normal.png
	roughness_map	ship_human0_Roughness.png
	specular_map	ship_human0_Metallic.png
}
The textures have been created by my artist and contain the following:
1. diffuse
2. normal
3. metallic
4. height
5. emissive
6. roughness

I know that emissive has been added in a more recent version of Ogre 2.1 but I don't have time to update right now so I simply merged the emissive as a layer over the diffuse map.

The metallic texture is a black and white texture so from what I understand I must set the metallic workflow because the specular is the default one. So the question is: how do I set the metallic workflow from this type of definition. I tried workflow metallic like in json type materials but it doesn't work.

I found viewtopic.php?f=25&p=520767#p520765 so it looks like there is no way of doing this except in code, but maybe something changed in the meantime as the post is from 2015.

Also I tried reading on PBR from the links provided http://wiki.ogre3d.org/HLMS+Materials pbr volume 1 and 2 but the links are expired. I think this is the new version: https://academy-api.substance3d.com/cou ... a9313a35cc

Also, how do I map the height map to the current pbs available maps?

In general, do you consider I should me moving to the json format or continue to use the old format?
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 169

Re: Enabling metallic workflow from material script

Post by xrgo »

I do everything by code so most of your questions I can't answer, but I can answer the heightmap one:
there are two ways to use a heightmap:
1) as displace map
2) as parallax occlusion (or similar)

very different techniques with different uses and pros/cons. none is supported by ogre out the box, but! its fairly easy to implement, with a few caveats:
1) this just moves the vertices, I have a simple implementation working that I use in a few specific cases... but the problem is that you need a lot of vertices in you mesh (which gets very expensive very quickly) or implement dynamic tessellation https://www.youtube.com/watch?v=bkKtY2G3FbU (which I have no idea how)
2) this one I also have an old implementation here: viewtopic.php?t=84156, I remember to be easy to implement, but it needs to be ported to the current templates (the link is still available! the file is PixelShader_ps.glsl method: parallaxMapping line 170)... this one is cheaper, you don't need extra geometry but it doesn't look good in silhouettes since it doesn't actually displace geometry, just distorts the uvs so it looks like it has more geometry. its a really nice effect for large areas like ground, grass, walls etc.

Saludos!
User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 267
Joined: Wed Apr 23, 2014 3:49 pm
Location: Bologna, Italy
x 75

Re: Enabling metallic workflow from material script

Post by TaaTT4 »

Hotshot5000 wrote: Tue Jan 07, 2020 9:21 pm The metallic texture is a black and white texture so from what I understand I must set the metallic workflow because the specular is the default one. So the question is: how do I set the metallic workflow from this type of definition. I tried workflow metallic like in json type materials but it doesn't work.
This is a full-reflective material I use to debug reflection maps:

Code: Select all

	"pbs" :
	{
		"Debug/Reflection" :
		{
			"workflow" : "metallic",

			"metalness" :
			{
				"value" : 1.0
			},

			"roughness" :
			{
				"value" : 0.001
			}
		}
	}
I use a value instead of a metalness map, but doing otherwise doesn't change the result.

Senior programmer at 505 Games; former senior engine programmer at Sandbox Games
Worked on: Racecraft EsportRacecraft Coin-Op, Victory: The Age of Racing