Home Technical Talk

[Coming Soon] PBRTK - PBR Viewport Shader for 3DS Max

2

Replies

  • PhobicGunner
    1.) unity may do that, but it's incorrect on a technical and physical level.

    Emissive pixels are considered to pass without lighting/shadowing. They can also give off illumination based on their brightness, depending on the engine (and usually they're great in combination with bloom, even if they don't give off illumination, due to their high contrast with shaded pixels around them).

    Because emissive pixels don't receive lighting or shadow, they're physically incorrect, which is one of the cornerstones of PBR.

    I think we're just getting into semantics here, though. It's called Emission, yes, but really the only thing it holds is diffuse+specular IBL which is added to direct lighting contribution. I could rename it to IBL if it makes you happy.
  • amartinez
    Offline / Send Message
    amartinez polycounter lvl 8
    2.) Wat. I thought mip selection was the standard way of doing blurry reflections?

    I would think so too. Maybe what he means is that it's not a 'linear' selection (0.0 roughness is biggest mip-map, 1.0 smallest mip, linearly distributed) and that it depends on more factors like maybe pixel fresnel value, reflectivity, roughness, view angle, etc. (but not all of them I would think).

    There is this 'hello world' article on PBR by Sebastien Lagarde http://seblagarde.wordpress.com/2011/08/17/hello-world/... he explains how he selects the mipmap level from a prefiltered environment map (i.e. an environment map where each mip map level matches the required material settings and whence unlikely to be 'linear').
    Math is all over the place and I understood nothing, maybe you get better luck.
    It's also not the metalness workflow, but I don't know if it actually matters, inside the shader the metalness expands to albedo, specular, etc at the end, independently of how those values were reconstructed (via metalness workflow or directly with glossiness, specular maps).

    There is this software https://www.knaldtech.com/lys-open-beta/ that generates prefiltered cubemaps for these types of things.

    There is also this small excerpt of UE4 PBR for mobile, there is an Environemnt BRDF approx function, that outputs a specular value, but I don't see where they use this to sample from the prefiltered cubemap -> https://www.unrealengine.com/blog/physically-based-shading-on-mobile

    (Enjoying this ride man! Lots of learning, little by little...)
  • PhobicGunner
    Revel wrote: »
    Hmm, I'm still learning and adapting the way PBR works, so correct me if I'm wrong. From what i understand is that when the object containing more metal quality in it makes the energy that hits it almost all reflected back as a reflection so since not much energy left to scatter around the surface which make the albedo appear black.

    Quote from Andrew Maximov's blog;

    That's true. But you only have to change albedo to black manually if you're using the specular color workflow. The metalness workflow does that for you. So for instance, let's assume your albedo color is white, this is what my shader does:

    Metalness: 0.0
    Diffuse: [1, 1, 1]
    Specular: [0.06, 0.06, 0.06]

    Metalness: 1.0
    Diffuse: [0, 0, 0] <- now diffuse is black
    Specular: [1, 1, 1] <- and specular is white
  • PhobicGunner
    amartinez wrote: »
    I would think so too. Maybe what he means is that it's not a 'linear' selection (0.0 roughness is biggest mip-map, 1.0 smallest mip, linearly distributed) and that it depends on more factors like maybe pixel fresnel value, reflectivity, roughness, view angle, etc. (but not all of them I would think).

    No, his point is that if you only select mip levels then the cubemap only has "blocks" of perceivable roughness value. That is, a single mip level will span a range of roughness, so it can *potentially* not look entirely accurate. The solution is to use mipmapping in conjunction with importance sampling, so basically you're sampling from the cubemap multiple times per pixel (up to 40?) to blur the cubemap more accurately.
  • Revel
    Offline / Send Message
    Revel interpolator
    Ah I see, thanks for the explanation, sir! :)
  • amartinez
    Offline / Send Message
    amartinez polycounter lvl 8
    No, his point is that if you only select mip levels then the cubemap only has "blocks" of perceivable roughness value. That is, a single mip level will span a range of roughness, so it can *potentially* not look entirely accurate. The solution is to use mipmapping in conjunction with importance sampling, so basically you're sampling from the cubemap multiple times per pixel (up to 40?) to blur the cubemap more accurately.

    Ah... got it, thanks for the clear-up. Maybe in real-time applications it doesn't matter? And trilinear filtering could piece-wise interpolate between 'the blocks'.

    Edit: missed all the previous post. Thread is going fast. Understood the full discussion and importance sampling issue by now. And that yes, mip-mapping that's how unity does it (and probably many other engines).
  • PhobicGunner
    amartinez wrote: »
    Ah... got it, thanks for the clear-up. Maybe in real-time applications it doesn't matter? And trilinear filtering could piece-wise interpolate between 'the blocks'.

    Edit: missed all the previous post. Thread is going fast. Understood the full discussion and importance sampling issue by now. And that yes, mip-mapping that's how unity does it (and probably many other engines).

    I'm not entirely convinced it matters that much, yet. I haven't really seen an example where it looks objectively incorrect, and at the very least should be good enough for a "preview" of sorts at least for now.
  • oblomov
    Offline / Send Message
    oblomov polycounter lvl 8
    Ah... got it, thanks for the clear-up. Maybe in real-time applications it doesn't matter?

    It does make a visible difference on smooth surfaces, mostly at grazing angles since the split-sum approximations assumes the surface normal is facing the camera for at least one of the precomputed integrals, or when smoothly increasing roughness on a flat surface. However it's a good enough approximations for games where they want to reduce the number of texture accesses in shaders as much as possible. Importance sampling is probably too costly to be used in games. However in applications like 3DS Max's viewport, Marmoset or Substance Designer/Painter, the added quality is worth the increased rendering cost in my opinion.
  • netgoblin
    the link in the first post is dead. can someone share the vieport shader? thnx
  • Computron
    Offline / Send Message
    Computron polycounter lvl 7
    netgoblin wrote: »
    the link in the first post is dead. can someone share the vieport shader? thnx

    site is down. curious about this too.
  • amartinez
    Offline / Send Message
    amartinez polycounter lvl 8
    Hey guys, if the original author don't mind, I have temporarily shared it here on this link while the original one comes back:
    https://dl.dropboxusercontent.com/u/136334834/PBRTK/PBRTK_v0_2.zip

    (I had also this in the same folder where I saved it, don't remember if it was related somehow, but it treated 3dsmax shader fx with the same 'code design' as Unity's surface shaders)
    https://dl.dropboxusercontent.com/u/136334834/PBRTK/SurfaceShaders.rar
2
Sign In or Register to comment.