D3D Scripts

User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: D3D Scripts

Post by Draise »

Well.. that's a nice start.

Here is what and how - I think I mentioned earlier - using micronormal maps would work, which is by FAR much faster that processing it in code or nodes into the Environment and specular aspects of the shader. It has NO hit on performance, or none that I know of.

Image

So, using my shader that Stan and I developed for the passes, and with the default secondary normal map I have placed, you can tile it to quite high values. So using the Diffuse value, I inversely influenced the reflectance, and made the normal map stronger and more tiled inversely. So more reflectence, the more tiled (smaller) the micronormalmap would be, also less/more height values accordingly to not distort the environment map too much. Obviously I'd need to finetune the settings and make a single controller that would drive all those values dynamically - but you can achieve that system without much processing... well other than the dynamic aspect of the shader driving those values.

Ultimately I consider roughness to be.. molecular roughness, microscopic.. so why not use the beauty of normal maps on microscopic detail to achive the "blur" roughiness?? No or little visual performance hit. Though, the little normal map can only get so large tiled that you begin to see it's rough detail as not so "microscopic" but noisy..

Ultimately, PBR usually doesn't have a Specular driver, so that would have to be dynamically configured too, to dynamically change it's value with the reflectance/diffuse and Micronormal map values. When.. I have a bit of time and want to do something large or interesting in trueSpace again - I'll develop that. I miss having realtime AO. I will need to work on my false AO lighting rig a bit more.....
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: D3D Scripts

Post by clintonman »

Very nice. I think I'll have to borrow that idea. Normalmaps for roughness - that's brilliant!
One limitation of trueSpace is that it uses DX9 and many of the techniques that have come out over the years are based on DX10 and newer. For me it's ok if it runs slowly, the end goal is to have a material that has the same inputs as the Unreal UE4 shaders with a somewhat similar look which is also close to the disney pbr which should make using renderman easier since it also has similar inputs for it's pbr shader.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: D3D Scripts

Post by clintonman »

Still coming along. I can get some results that look like the unreal material editor preview by combining the roughness with a blur. Only drawback is that the blur was slow. The blur has been rewritten and is now 5 times faster than before which is fast enough for what I want to do. The roughness calculation is still slow. Also found out I needed an hdr image and some adjustments to bring the values into range for display. I was using vue 5 to make hdr images and found that the format was hdr but the values were low dynamic range and gave a bad result.
Image shows no roughness reflection. Next roughness of 0.2 with 16 samples. Last image is blur reflection before the roughness is applied.
pbrwblur1.jpg
pbrwblur2.jpg
pbrwblur3.jpg
Clinton Reese

http://clintons3d.com
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: D3D Scripts

Post by Draise »

This middle one made the sun speckle a bit, is.. that supposed to happen?

I'm glad it's 5 times faster! Good work on the optimizing.
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: D3D Scripts

Post by clintonman »

Draise wrote:This middle one made the sun speckle a bit, is.. that supposed to happen?

I'm glad it's 5 times faster! Good work on the optimizing.
That's what you get with only 16 samples. The blur is used to hide the low sample count. The 3rd one is the 2nd with a blur.

I have everything worked out for metallic materials and got the truespace and unreal editor viewports giving similar results. Earlier test was comparing tS to the material editor in unreal. One last adjustment was to the tS lights. Setting intensity to 1500 and quadratic to 50 makes the lighting match up.
I'll take a short break now to fix up the other compositing nodes with the 5 times faster technique.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: D3D Scripts

Post by clintonman »

MetalPlastic.jpg
Closer still. Left is metal and right is non-metal both with the same roughness value and base color. Maybe one more session to work out the details, match the unreal look then combine plastic and metal as one material.
Clinton Reese

http://clintons3d.com
User avatar
Draise
Captain
Posts: 3198
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: D3D Scripts

Post by Draise »

Looking good!!!!!

I think you are forgetting the Fresnel on the Diffuse on the Metalic shader though?

Here are some good reads up on PBR that I base my.. stuff off sometimes. Link 1 and Link 2
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: D3D Scripts

Post by clintonman »

Thanks, I'll look into it. Could be because I'm faking it with small sample count + blur.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: D3D Scripts

Post by clintonman »

PBRnov2022.jpg

Resurrecting the old project.

I've been working on this for over a week trying to understand the math and how to do it within trueSpace limitations.
The image shows a GLTF model imported to trueSpace with the new PBR based material. The results are pretty good. The trick to get started was to bypass all of the material setup in tS except for the normalmap which is kind of separate anyway. Everything is inside the constant part of the material. It also bypasses the model shader so one more thing I need to add is the light attenuation. That will be really easy compared to everything else. As shown there are no lights in the scene. It has an environment lighting and reflection setup using an hdr image.

I'm also working on a GLTF import/export plugin. It's actually the reason I needed a PBR material. So the GLTF textures for metallic, roughness, ambient occlusion and color had a meaningful place to go.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5422
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: D3D Scripts

Post by clintonman »

PBR_2_nov2022.jpg
final work for now.

Fixed the reflection, it was upside down.
Fixed faint detail was missing. It's still too faint but it can be seen now, more obvious is the bottle cap detail.


I attached the object file since it can't be shown very well in still images. The material is still a little rough and hasn't been balanced with the lights, so it looks best if all the lights in the scene are set to black. This requires the Clintons3dPlugin is installed or one of the Unofficial Updates which includes it.

The environment light/reflection is from the Unreal game engine. The original bottle model is from the Khronos Group github page
https://github.com/KhronosGroup/glTF-Sa ... master/2.0
An internal precalculated data image was created using the BRDFGenerator, https://github.com/HectorMF/BRDFGenerator

I'll come back to this project after more work on the gltf importer is complete.
Attachments
WaterBottlePBR.RsObj
(9.95 MiB) Downloaded 67 times
Clinton Reese

http://clintons3d.com
Post Reply