Physically Based Rendering V2

Announcements and news updates to your projects using Urho3D.
Forum rules
If you have images or videos, you can attach them in the showcase post. Please use small thumbnail as link to original media resources.
When you post in this forum, you have to agree that Urho3D main website as well as the Facebook page have the permission to republish your post with all the related images or videos. The original images must have width larger than 890px for best viewing result in all the supported viewports by main website.

Physically Based Rendering V2

PostPosted by dragonCASTjosh » 21 Feb 2016, 18:27

Overview
Since Sonoid finished working on PBR he passed the torch to me and provided me rights to change and redistribute the code as i feel fit. Since i took on the project i made some small changes, the first change i made was to allow PBR to work alongside the legacy renderer in Forward Rendering. The second change i made was to change the diffuse model to be Burley because i personally prefer it over Lambert.

Results:


Images:
Show spoiler
Image
Image
Image



How to use
When you create a material you will need to use one of the PBR render techniques located in CoreData/Techniques/PBR

If the selected technique uses diffuse then you will need to input a albedo texture into the diffuse channel. Albedo is similar to diffuse although it does not contain any lighting data.
if the selected technique uses normal then you will need to input a traditional normal map into the normal channel.
if the selected technique uses Metallic /roughness then you will need to input a PBR properties map into the specular channel. The PBR properties map contains Roughness in the red color channel and Metallic in the green color channel.
if the selected technique uses emissive then you will need to input a emissive texture into the emissive channel.

For additional control over the material you can add Roughness and Metallic as material parameters, from these values you can adjust the PBR properties map or set default values for material without a PBR properties map
Image

Effect
Both the Roughness and Metallic values affect the overall look of the material. The effect each value has on the material is shown in the images below, these images where taken from the Material Test scene included in PBR repository.

Roughneses:
Show spoiler
Image


Metalic:
Show spoiler
Image



Area Lighting is still in development although sphere lights are currently supported. The image below demonstrates sphere lights as demonstrated on the Material Test scene.

Sphere Light
Show spoiler
Image


Download

Currently the download will not work on OpenGL Deferred Renderers due to know issue (without a fix currently)
https://github.com/dragonCASTjosh/Urho3D
Last edited by dragonCASTjosh on 10 Mar 2016, 23:32, edited 3 times in total.
User avatar
dragonCASTjosh
Moderator
Moderator
 
Posts: 205
Joined: 04 Aug 2015, 18:59

Re: Physically Based Rendering V2

PostPosted by codingmonkey » 21 Feb 2016, 19:37

Great work! Thanks for sharing this.
User avatar
codingmonkey
Have many posts
Have many posts
 
Posts: 517
Joined: 21 Oct 2014, 19:26
Location: Russian Federation, Novosibirsk

Re: Physically Based Rendering V2

PostPosted by dragonCASTjosh » 21 Feb 2016, 20:37

codingmonkey wrote:Great work! Thanks for sharing this.


Thanks for the support :)

I wanted to implement the IBL system demonstrated in the Unreal 4 PBR notes but it caused massive performance problems for my 970. you can enable it in the repo by changing iblColor in the LitSolid.hlsl to
Code: Select all
float3 iblColor = ApproximateSpecularIBL(specColor, roughness, normal, -toCamera)


and the number of samples in the Lighting to 1024
Code: Select all
float3 PrefilterEnvMap(float Roughness, float3 R)
      {
         float3 N = R;
         float3 V = R;

         float3 PrefilteredColor = 0;
         const uint NumSamples = 1024;

         float TotalWeight = 0.0000001f;

         for (uint i = 0; i < NumSamples; i++)
         {
            float2 Xi = Hammersley(i * 2 + 0, NumSamples);
            float3 H = ImportanceSampleGGX(Xi, Roughness, N);
            float3 L = 2 * dot(V, H) * H - V;
            float NoL = saturate(dot(N, L));
            if (NoL > 0)
            {
               PrefilteredColor += SampleCubeLOD(ZoneCubeMap, float4(L, 0)).rgb * NoL;
               TotalWeight += NoL;
            }
         }
         return PrefilteredColor / TotalWeight;
      }


Anybody is welcome to make PR to the repo especially if they help with performance of the Unreal PBR as it looks a lot better
User avatar
dragonCASTjosh
Moderator
Moderator
 
Posts: 205
Joined: 04 Aug 2015, 18:59

Re: Physically Based Rendering V2

PostPosted by practicing01 » 21 Feb 2016, 20:44

Congratulations to all the parties involved! I hope to be able to use pbr on mobile/linux some day.
Image
User avatar
practicing01
Active user
Active user
 
Posts: 145
Joined: 03 Oct 2014, 11:34
Location: Puerto Rico

Re: Physically Based Rendering V2

PostPosted by dragonCASTjosh » 21 Feb 2016, 20:47

practicing01 wrote:Congratulations to all the parties involved! I hope to be able to use pbr on mobile/linux some day.


OpenGL support should be done within a few days
User avatar
dragonCASTjosh
Moderator
Moderator
 
Posts: 205
Joined: 04 Aug 2015, 18:59

Re: Physically Based Rendering V2

PostPosted by weitjong » 22 Feb 2016, 01:12

dragonCASTjosh wrote:
practicing01 wrote:Congratulations to all the parties involved! I hope to be able to use pbr on mobile/linux some day.


OpenGL support should be done within a few days


I am looking forward to it. Thanks for sharing it.

EDIT
I just clone the repo and I have a few questions:
  • It seems that there are no changes whatsoever to the Urho3D engine code. Is it really true?
  • I understand that sinoid has transfer the copyright to you for all his work (IANAL, so sorry if I use a wrong term here). My question is, now under which license are you releasing your combined work? Please say MIT or even better Urho3D license (MIT) ;). Using Urho3D license makes it easier for us to pull the good bits over into upstream Urho3D project as there should be no copyright issue then in copying the code over pro-actively.
YaoWT - Leave no window unbroken ♪ (^。^) 
User avatar
weitjong
Contributor
Contributor
 
Posts: 1094
Joined: 16 Jan 2014, 15:34
Location: Singapore, 新加坡

Re: Physically Based Rendering V2

PostPosted by 1vanK » 22 Feb 2016, 05:57

weitjong wrote:It seems that there are no changes whatsoever to the Urho3D engine code. Is it really true?


Yes, it's only shaders. You can see fork from the original repo https://github.com/souxiaosou/UrhoPBRCoreData . It's containt detailed comments, like
Code: Select all
        /// Smith GGX Visibility
        ///     nDotL: dot-prod of surface normal and light direction
        ///     nDotV: dot-prod of surface normal and view direction
        ///     roughness: surface roughness
        float SmithGGXVisibility(in float nDotL, in float nDotV, in float roughness)
        {
            float rough2 = roughness * roughness;
            float gSmithV = nDotV + sqrt(nDotV * (nDotV - nDotV * rough2) + rough2);
            float gSmithL = nDotL + sqrt(nDotL * (nDotL - nDotL * rough2) + rough2);
            return 1.0 / (gSmithV * gSmithL);
        }

but it is obsolete, I think. It is a pity that these comments have been removed.
User avatar
1vanK
Moderator
Moderator
 
Posts: 430
Joined: 26 Jun 2015, 19:16
Location: Internet

Re: Physically Based Rendering V2

PostPosted by hd_ » 22 Feb 2016, 08:04

Just previewing the test scene, it seems to miss a bit of the punch of other PBR implementations. I couldn't guess why from the short test -- it could be as simple as poor environment map choice or may be something more. In my previous attempt with PBR I realised it's important to have simple tests and comparisons.

I can tell there is a lot of work put into this though, nice work so far !

weitjong wrote:It seems that there are no changes whatsoever to the Urho3D engine code. Is it really true?

Most of the work is in the shaders, but a complete PBR implementation will need to touch on the engine source to at least provide some parameters for area lights.
User avatar
hd_
Contributor
Contributor
 
Posts: 220
Joined: 21 Jul 2014, 08:55
Location: Australia

Re: Physically Based Rendering V2

PostPosted by dragonCASTjosh » 22 Feb 2016, 09:39

weitjong wrote:

I just clone the repo and I have a few questions:
  • It seems that there are no changes whatsoever to the Urho3D engine code. Is it really true?
  • I understand that sinoid has transfer the copyright to you for all his work (IANAL, so sorry if I use a wrong term here). My question is, now under which license are you releasing your combined work? Please say MIT or even better Urho3D license (MIT) ;). Using Urho3D license makes it easier for us to pull the good bits over into upstream Urho3D project as there should be no copyright issue then in copying the code over pro-actively.


Currently there are no changes to Urho3D engine code and its possible to get away without any changes but to include features like Parallax Correction for cubemaps and Area Lighting there will need to be small changes to the engine.
For the licence sinoid provided me the source under MIT as is visible in the licence image found under the shader dir (only there temporally). Im not sure if MIT would allow me to changes the licence to Urho3D but if it did i would change it.



1vanK wrote:but it is obsolete, I think. It is a pity that these comments have been removed.


The lack of comments is a temporary thing, I was planning on moving PBR to its own shader file and re-document.

hd_ wrote:Just previewing the test scene, it seems to miss a bit of the punch of other PBR implementations. I couldn't guess why from the short test -- it could be as simple as poor environment map choice or may be something more. In my previous attempt with PBR I realised it's important to have simple tests and comparisons.


The issue likely lies within the IBL solution that has been used. Currently i am using the Unreal 4 mobile IBL(same as sinoid implemented). I tried implementing more advanced IBL and it provided much better results although the performance of it currently is horrible

Comparison
Show spoiler
Current Rough Metallic
Image

More advanced IBL
Image

Current Rough Non-Metallic
Image

More advanced IBL
Image
User avatar
dragonCASTjosh
Moderator
Moderator
 
Posts: 205
Joined: 04 Aug 2015, 18:59

Re: Physically Based Rendering V2

PostPosted by weitjong » 22 Feb 2016, 10:07

dragonCASTjosh wrote:Currently there are no changes to Urho3D engine code and its possible to get away without any changes but to include features like Parallax Correction for cubemaps and Area Lighting there will need to be small changes to the engine.
For the licence sinoid provided me the source under MIT as is visible in the licence image found under the shader dir (only there temporally). Im not sure if MIT would allow me to changes the licence to Urho3D but if it did i would change it.


Thanks for the prompt reply. Again, IANAL. Urho3D license is MIT license. The only difference is that it declares the work/material/code is copyrighted by Urho3D project. If anyone submitting a PR to us then you must have read and agree to the T&C to release them under MIT license with the copyright statement "Copyright (c) 2008-2016 the Urho3D project" (see http://urho3d.github.io/documentation/H ... klist.html). Basically, what I am asking is whether we have your permission to "copy" the combined work into Urho3D project and thus they would adhere to the above term. We do not steal other ppl code ;) and claim them as ours. Alternatively, we can just wait passively until you send us PR when/if you decide to merge your work to upstream Urho3D project.
YaoWT - Leave no window unbroken ♪ (^。^) 
User avatar
weitjong
Contributor
Contributor
 
Posts: 1094
Joined: 16 Jan 2014, 15:34
Location: Singapore, 新加坡

Next

Return to Showcase

Who is online

Users browsing this forum: No registered users and 1 guest

cron