Jump to content

PBR: Principles, Practice, and Prepwork


Recommended Posts

With RT3 accessible, re-ordered the blending operations for lightmapping/ibl to operate closer to ambient lighting, as is the intent for that kind of thing. (May or may not mean we can jostle SSS loose eventually to put that back...)

Dynamiccubemaps now gen mips, which means those are usable with roughness maps, if inadvisable, given, again that's essentailly 6 screen renderings per object, so we'll likely be wanting to loop that into the envVolume system.

Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 164
  • Created
  • Last Reply

Top Posters In This Topic

Right, so bug in the pipeline: https://forum.allegorithmic.com/index.php?topic=4625.msg23387#msg23387 that it would seem extends across the board for pngs as well.

Not sure what all folks preferences would be there for the defaults for the combined map, so by all means, pipe on up. I will say as it stands, the opengl end of things does go corrupt trying to read .dds in the default format that spits on out. Repo now contains more samples, including a higher poly sphere, a converted .sbsar and readable-by-engine-formats.

Current config and results:



Link to comment
Share on other sites

OK, so after having the head artist examine the output with better tools, it would seem that the opengl end of things is due to substance outputting data to .dds without mips. DX side can handle that (as well as the filp) OpenGL at a minimum seems to contain a flaw with that particular cornercase:

(Do note it applies as much to normal, and albedo as well there.)
Link to comment
Share on other sites

  • 1 month later...

Been remiss in updating folks on progress here, since things ramped up a bit on the gamedev side for a bit there, so:

A couple of folks now have asked about subsurface scattering. After quite a bit of research, that doesn't seem to be a PBR concept. Instead, most advice is to simply tint the albedo/diffuse. That being said, did go ahead and allow that feature to tint reflections specifically so there's a separate effect there for folks to play with.

Speaking of effects, been promising to throw over that per-object instance damage fork as a proper feature-set for a while now, and since the one up didn't account for normals, and needed to convert it to handle smoothness/metalness anyway, went ahead and threw that in (and tacked on a mindamage that can be used for either previewing, or saved out for variations on a theme.


Uses a simple lerp for smooth transitions.

On the experimental-tech front: https://github.com/Azaezel/Torque3D/tree/PBR_LightProbeLights explores the feasibility of using the cubemap cookie code already present in pointlights (with a few tweaks, like jury rigging a variation of it specifically for probes, running it through the cook-torrence method, and pointing those at dynamiccubemaps) in order to derive reflections in a projective manner, which should better handle things like terrain, objects rendering reflections of themselves into the sides facing away from the center point of the projection like we get with envVolumes, and the general need to have the origin-point for those enclosed within volumes to detect which singular gets applied.

Observed flaws: 1) Should derive that from a lower level class to cut out the overhead. 2) Should create a 'cage' for it, so that the 'camera' locations are at the edges to prevent players passing through the center an causing clipped projections of themselves in projected reflections. 3) While there is code to blend general level or envVolume environment maps into the lightmap buffer (we weren't using the lightbuffer.a channel for anything, so we embed directional attenuation there and pass that along for blending), need to do a better job there of accounting for distance however.

Finally, ran the codebase through https://vld.codeplex.com/ and knocked out a few leaks, including one more with the compositetexture implementation.

Link to comment
Share on other sites

  • 1 month later...

Any new pbr updates?

Still playing with a circa 6.21.15 pbr download. Been a busy summer.

See you've merged dev into pbr looks like it's time for me to update.

Will report glitches as I see em.

Trying to locate and wrap my head around the changes and pbr in general.

Thanks for the Visual Leak Detector link.

Link to comment
Share on other sites

Thanks for the reminder I was falling behind there a bit on roll-in. As far as additional progress, been mostly all-in on http://forums.torque3d.org/viewtopic.php?f=15&t=319. After all, I'm one of the folks that whinges about stability, so could hardly stand back when they wanted to *focus* on that. Did manage to slip in a fix for A/O map/channel handling though, so that's more light-angle reactive.

That being said, still need to tinker a bit more with:

https://github.com/Azaezel/Torque3D/tree/PBR_LightProbeLights a bit prior to roll-in in terms of sorting the attenuation based on angle blend out a bit better, and the cubemap side-points for additional scene-aware reflectivity, as well as maybe take a stab at rewriting LPV from scratch (maybe even drop the propagation step entirely in the process since https://github.com/Azaezel/Torque3D/blob/PBR_LPV/Templates/Full/game/shaders/common/offlineLPVReflectP.hlsl#L71-L97 is doing a naive 'raycast' already. And also need to sort the wetness shader from James Stanley https://github.com/Azaezel/Torque3D/tree/pbr_lpv_wteness_bbq on out for the angles.

Also going to want to take https://github.com/Azaezel/Torque3D/blob/PBR/Engine/source/lighting/advanced/hlsl/deferredShadingFeaturesHLSL.cpp#L67-L68 and methodize it so down the line if we move to node-based that'll be less disrupted, since that's something I ended up using in a lot of spots for clarity of reading through the output.

And take a page from MangoFusion/JamesU

https://github.com/jamesu/Torque3D/blob/cortexgl2/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp#L72-L111 since he offered to share that to further simplify things on the generated hlsl/glsl front.

Do note the last two are cleanups that'll take folks over the various shadergen alterations, so hey, if you want a structured review method before we move on from this release to the next and maybe try and slip the deferred end in at least, by all means feel free to take a stab at either of those and toss the findings back.

Link to comment
Share on other sites

Nothing special from me right now. Azaezel is the point man on this :D

Azaezel has the dynamic cubemaps for reflections working well in OpenGL, 99% no longer freezing, at least for me.

Roughness/Metalness seems to have the basics in place. Before it's fully in place there will be workflow changes.

You can download his branch, the zip download, and try it. Works out of the box for me on Win 8.1.


Will post some pics, just want to play around a bit, get up to speed on pbr in general and how we are doing it.

I also need to stop being lazy and fire up VMware+Linux and test OpenGL there.


Link to comment
Share on other sites

HiHi. You could do it in window :D . It would be nice to see a tutorial on the workflow if you like :) .


Torque's PBR is evolving right now. Tutorials might be a bit premature :)

The links below are a good place to start learning the PBR workflow. Azaezel and lot's of others have posted bunches of links here and elsewhere.

I'm slowly working my way through about 10 different resources myself.





Azaezel's PBR branch


You can have some fun playing with PBR workflows right now with the trials of Allegorithmic's tools.


Lot's of reading to do. :D

Link to comment
Share on other sites

Just playing around with the PBR branch whilst I study it's mysterious inner workings :)

Saved the grayscale roughness and metallic maps output by Bitmap2Material to RGB8 in Photoshop

Note the roughness .a and the metallic .r channels are selected in T3D

Downloaded Azaezel's PBR branch zip on 8.19.15

Screenshot is OpenGL

Link to the outputs and original main input texture https://www.dropbox.com/s/nwobyd10k7wm2q1/T3D-PBR-test.zip?dl=0

Torque3D PBR branch





Adding the Dropbox links




Let's try Photobucket.

Torque3D PBR branch




Can you get to the zip file from Dropbox?


Edited by koros
Link to comment
Share on other sites

You have the roughness mapping perfectly.

Makes me want to do a UE4 SciFi hallway style demo.

Picked up Bitmap2Material a few days ago. Most fun I've had in a while.

Wife says I'll have to wait on Substance Designer + Painter ... /tantrum


Link to comment
Share on other sites

hmmm... not you They don't show up in Chrome for me either..

First time I used Dropbox for pics, not pro.

They're supposed to be visible to anyone with the link, according to dropbox, showed for me on Firefox, the browser I log in on.

Edited by koros
Link to comment
Share on other sites


Did invert the smoothness channel on some other materials I was playing with and it works as expected in any of the color channels the way I saved it.

Those pics are killing me Azaezel, can't wait til I can justify buying Designer + Painter :)

Thx for the smoothness switch.

When we get around to hooking up the smoothness and metalness sliders can we add a relief slider? Since the parallax slider is non-functional anyway for meshes.

Maybe by then I'll be up to speed and can actually contribute. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...