Jump to content

FEATURE: OpenGL 3 Renderer


Recommended Posts

AO shall go into the specular map blue channel. Don't apply it to the albedo. We would loose correct specular color for this.

So maps we need for pbr:

Albedo RGBA:

RGB Albedo Color

A Transparency (optional)

Specular RGB

R Roughness Grayscale

G Metal Mask

B Occlusion (Cavity Occlusion, Ambient Occlusion or a combined one, it doesn't matter, just artists choise)

Normal RGBA

RGB Normal Map

A Height Map (optional)

 

Thats material layout right now. Though Occlusion doesn't get handled right now. Will do this when ready with IBL stuff.

 

you should rename the Specular RGB map to something else, Reflective or Microsurface would be better. Specular has an actual defined term in current industry usage.

 

If you're using metal masks (which you are), then reflectivity = lerp(0.04, albedo.rgb, metalmask). if you're using a specular map, then reflectivity == specular.

Link to comment

you should rename the Specular RGB map to something else, Reflective or Microsurface would be better. Specular has an actual defined term in current industry usage.

 

If you're using metal masks (which you are), then reflectivity = lerp(0.04, albedo.rgb, metalmask). if you're using a specular map, then reflectivity == specular.

Yea, I'm aware of all of this. I just didn't want to confuse people right now, since most of the people in this forum are not familiar with the pbr workflow and need to learn it from the beginning. I will rename it at some point, but now, I will stick with it.

Link to comment

Well that's why I'm asking such questions, ridiculous or not. I'm a beginner at this stuff, and trying my best to understand and learn.

Hey, no problem. You do fine. Seriously.

When I see questions regarding the renderer, I'm here to answer them. Takes some time to fully understand, or dont get confused on how everything works together, especially when you worked like 10 years with another system. (How long have you been doing 3d stuff DT85?)

DT85 likes this
Link to comment

added mip-map convolution with ggx distribution using importance sampling

old standart mip mapping code (simply downscaling the image)

 

af73Zko.jpg

 

 

 

with pre-filtering (1024 samples)

 

Nz0PJWV.jpg

 

 

 

Takes some time to see the differences, for someone whos not knowing, what its supposed to do. But I'm positive that this was the biggest part on getting IBL working in the engine.

Ramikad, DT85 and minilogoguy18 like this
Link to comment

@@SomaZ

 

So looking at the code, it looks like for deluxemapping you change $lightmap to $deluxemap in the shaders? I do this, but then I get what looks to be funky colors. Is this normal?

No, you don't need to add anything or change in the shader. Thats how I understand it. Strange colors should be normal. They aren't for showing. Adding them in the shader is just for debugging purposes.

DT85 likes this
Link to comment

so the AO and Cavity maps should be separate channels? What if you used an RBGA?

no, you can just combine them or take just one. The people at Frostbite, for an example, simply leave the ao completely aside and only use the cavity occlusion. (Thats how I read their "workshop" to get pbr working)

Link to comment

no, you can just combine them or take just one. The people at Frostbite, for an example, simply leave the ao completely aside and only use the cavity occlusion. (Thats how I read their "workshop" to get pbr working)

But they are not the same thing... right? @@Almightygir - what is most industry practice for AO & Cavity maps?

 

What if AO was in the Blue channel and the Cavity map was in an Alpha channel? I don't know what I'm saying- lol. @@SomaZ - I suggest you just transition all the nomenclature and switch over as Lee suugests now so folks can get used to the new terms. Maybe provide the industry definitions too.

Link to comment

Here's a really useful doc I found on PBR for artists. It's a bit of a read but I think it covers everything you need to know:

 

https://docs.google.com/document/d/1Fb9_KgCo0noxROKN4iT8ntTbx913e-t4Wc2nMRWPzNk/edit?usp=sharing

 

Also these:

 

https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/ <--- practical application

https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/ <--- education on PBR theory (very useful to artists, but can get techy)

https://www.marmoset.co/posts/pbr-texture-conversion/ <--- if you want to (try to) convert older assets to current gen, may be more work required than what's in the doc though.

 

 

But they are not the same thing... right? @@Almightygir - what is most industry practice for AO & Cavity maps?

 

What if AO was in the Blue channel and the Cavity map was in an Alpha channel? I don't know what I'm saying- lol. @@SomaZ - I suggest you just transition all the nomenclature and switch over as Lee suugests now so folks can get used to the new terms. Maybe provide the industry definitions too.

 

So the frostbyte guys have a "special" type of AO map, where they make the occlusion angles highly accute, which causes much tighter shadows in the map. They're in practice, the same thing... as in, they both affect the renderer the same way. Why do they do it though? Well, an AO map will usually have large, sweeping shadows (think of like... armpits, or between the legs and stuff). Often the lack of ambient light to these regions is enough to create odd looking shading. So by using cavity occlusion instead, they're limiting the lack of ambiance specifically to areas which have really deep geometric variance.

 

Interestingly, Naughty Dog recently released a paper on Uncharted 4 which can help with this stuff too, by interpolating the baked AO details out at glancing angles. i wrote a blog post on this (have to keep a stupid fucking blog for my masters degree), if anyone wants to read it:

https://leedevonaldma.wordpress.com/2017/02/19/keeping-things-unreal/

 

The math/pseudocode is:

float FresnelAO = lerp(1.0, BakedAO, saturate(dot(vertexNomalWorldSpace, ViewDir)));

 

as for nomenclature... It was a jarring switch industry wide, and a lot of people rebelled against it. But it really did make sense to use new terminology (ie: Albedo vs Diffuse, Reflectivity vs Specular) when considering the subtle differences.

 

 

added mip-map convolution with ggx distribution using importance sampling

old standart mip mapping code (simply downscaling the image)

 

af73Zko.jpg

 

 

 

with pre-filtering (1024 samples)

 

Nz0PJWV.jpg

 

 

 

Takes some time to see the differences, for someone whos not knowing, what its supposed to do. But I'm positive that this was the biggest part on getting IBL working in the engine.

 

Sick!

 

There's definitely something odd going on with the fresnel component though, it gets really really dark at the edges here, when really it should get closer to pure reflection instead.

SomaZ, eezstreet and minilogoguy18 like this
Link to comment

@@Almightygir Fresnel-term is computed by the ioq3 code right now, so chances are high that this is fucked up. Right now I'm trying to pre compute the DFG term in a LUT. Though I can't figure out, where the normal comes from, for the importance sampling in the paper from Epic. They simply use N without mentioning it. :P This answers your question, if we are using importance sampling in real time or the split-sum aproximation. ;)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...