Jump to content

PBR: Principles, Practice, and Prepwork


Azaezel

Recommended Posts

linearization turned over https://github.com/GarageGames/Torque3D/pull/1461

there will be conflicts once that's rolled in to head. will resolve those as the issue arises.


also fixed the accumulation textures: http://imgur.com/a/K39yq


in addition, working with timmy to roll in dx11 https://github.com/Azaezel/Torque3D/tree/PBRDX11 cleaned up findings will be backported to the main working branch.

Link to comment
Share on other sites

  • Replies 164
  • Created
  • Last Reply

Top Posters In This Topic

Added a further demonstration/assistance model for artists that are unfamiliar with the system:


http://i.imgur.com/3xf3yht.jpg

http://i.imgur.com/t8SK6qg.jpg


Smoothness is X, metalness is Y.


Edit: forgot AO:

http://i.imgur.com/m6gC7vf.jpg

 

To be sincere it look like a work in progress. I mean is PBR it should look ~like in the real world.

Link to comment
Share on other sites

@Chelaru

Can you clarify what looks WIP? Do you not like the demo model? Or does the PBR look incorrect to you?

 

I was expecting some thing like this : http://www.marmoset.co/wp-content/uploads/microcompare05.jpg

Chelaru,

roughness=microsurface

metallic=colored spec from albedo/base texture.


There are different ways of doing PBR, these guys are using the Disney/Unreal method. You can read up more here:

https://www.allegorithmic.com/pbr-guide

(Have to make an account to download I believe)


Is this what you are questioning?

Link to comment
Share on other sites

@Chelaru

Can you clarify what looks WIP? Do you not like the demo model? Or does the PBR look incorrect to you?

 

I was expecting some thing like this : http://www.marmoset.co/wp-content/uploads/microcompare05.jpg

Chelaru,

roughness=microsurface

metallic=colored spec from albedo/base texture.


There are different ways of doing PBR, these guys are using the Disney/Unreal method. You can read up more here:

https://www.allegorithmic.com/pbr-guide

(Have to make an account to download I believe)


Is this what you are questioning?

 

I don't know pbr to well. After seeing what other are doing i was under the impression that the PBR from Torque 3d will look almost the same.

I was looking closely to this development branch, because in the original post from gg forum, images like the one from above where shown to be what pbr in T3d should look in the end.

Link to comment
Share on other sites

Were you expecting it to be a single value, and not 2 controls (reflectivity aka metalness and smoothness/roughness aka bluriness)? That's the only takeaway I'm getting from tossing up that line of balls and not a grid without some elaboration...


Also for what it's worth, re-comparing AO at least did show a miscalc, which just got corrected.

Link to comment
Share on other sites

The glossy factor is a bit off. With the AO even the most left ball is reflective. Every thing has a whit look, like is no contrast in the image. It might be because of the light, i don't know.

To be sure i think you should create the exact light conditions like the ones from http://i.imgur.com/Gt7VoVn.jpg or http://www.marmoset.co/wp-content/uploads/microcompare05.jpg .


It just looks a bit off from my perspective. It might be the light.

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

I have a problem using the SkyLine object with the PBR branch. I think there's something changed in the PBR branch shaders that cause an issue. I tried different shaders mix from the SkyLine object and the PBR but got no luck. I got the SkyLine object to work on PBR branch with one of those mix but then the direct lighting was not working only the ambient lighting was there so the PBR materials were not reacting to any light).

I'm giving up for now but I'd really like to be able to use the SkyLine with the PBR, maybe someone who understand more how shaders works can help. Here's screenshot showing the issue:

http://mud-h.com/miscweb/t3dforum/Misc/SkyLineIssueOnOff.jpg

(I know the road stones PBR is not set correctly)

http://mud-h.com/miscweb/t3dforum/Misc/PBRWithSkyLine.jpg

As you can see, it's like the SkyLine skybox is shrinked and got the alpha disabled...

Link to comment
Share on other sites

This with the latest? Just added DX11

It's with the code from last week, I will update it and try again.

EDIT2: By just added, you mean last week, right? Because I have pulled both branch into my PBR branch and nothing changed. So yes, those images are with latest code.


Btw, I'm not familiar with how DirectX work really, does the new DX11 stuff affect hardware that are not compatible with it? or do all hardware are compatible with DX11 using their limitations?


I'm asking because I was wondering if it could be "usefull" to have a PBR branch without DX11 stuff, I was suspecting the new stuff to cause the problem but like I said, I really don't know much about GFX coding. Btw, I do know it's a good thing to have T3D use DX11...


I do like how the PBR looks now, seem better :)


Edit: Well I just found out that there's a new PBRDX11 branch, should I use it or the PBR one?

Link to comment
Share on other sites

This with the latest? Just added DX11

It's with the code from last week, I will update it and try again.

EDIT2: By just added, you mean last week, right? Because I have pulled both branch into my PBR branch and nothing changed. So yes, those images are with latest code.


Btw, I'm not familiar with how DirectX work really, does the new DX11 stuff affect hardware that are not compatible with it? or do all hardware are compatible with DX11 using their limitations?


I'm asking because I was wondering if it could be "usefull" to have a PBR branch without DX11 stuff, I was suspecting the new stuff to cause the problem but like I said, I really don't know much about GFX coding. Btw, I do know it's a good thing to have T3D use DX11...


I do like how the PBR looks now, seem better :)


Edit: Well I just found out that there's a new PBRDX11 branch, should I use it or the PBR one?

 

DX11 is pretty much guaranteed to go into head before the PBR end, since that 'just' takes shader authoring (flat file and shadergen) revisions to account for the new macros vs art pipeline changes. So no, beating up incompatibilities is pretty much mandatory. As to the temp branch, that was for working out all the kinks I could find prior to shoving it into the main working fork.


Speaking of which,

1) any console log output related to inability to compile shaders?

(see conversion notes http://forums.torque3d.org/viewtopic.php?f=40&t=473#p4049 and samples https://github.com/Azaezel/Torque3D/commit/e13a235f6f98afcee38effd8be38f9d978f268fd (flat file) https://github.com/Azaezel/Torque3D/commit/1e32c48664072e801fc66c940bcc9ea3d04c6d31 (shadergen)

and a few more https://github.com/Azaezel/Torque3D/commits/deferredDX11Check from Oct 23, 2015 )


2) does running a debug version spew any unlogged info?

Link to comment
Share on other sites

Thanks for the infos! I think my main issue was that the SkyLine shaders weren't converted for DX11 with Timmy macros. I have manually convert the files and now at least the SkyLine Alpha Cubemap work but still not right. I see some transparency but the SkyBox is still very small.

I don't understand how the SkyBox is sized... (Not sure if it could be related to shaders)


So I Changed:

uniform samplerCUBE cubeMap : register(S0); TO TORQUE_UNIFORM_SAMPLERCUBE(cubeMap, 0);

texCUBE( cubeMap, IN.reflectVec ); TO TORQUE_TEXCUBE(cubeMap, IN.reflectVec);

float4 hpos : POSITION; TO float4 hpos : TORQUE_POSITION;

float3 position : POSITION; TO float3 position : TORQUE_POSITION;


I'm realizing now that one of the POSITION change might not be correct if I compare with some other shaders... The float3 position should stay POSITION, right?


Also compiling a debug build to see if it output something. In release, the only error I get is those 3 lines:

ShaderData((null)) sampler $diffuseMap not defined
ShaderData((null)) sampler $diffuseMap not defined
ShaderData((null)) sampler $diffuseMap not defined

Not sure where they are coming from, I will try to find out. Is there a efficient way to debug shaders?

Link to comment
Share on other sites

Nothing new by running the Debug build, got the 3 same error in console.log as above.


I gave a try to a standard SkyBox and found something interesting. If I set the FogBandHeight > 0, I get the same issue as with the SkyLine so maybe it's not related to the SkyLine object at all but to something not working with the new shader stuff. Here's a screenshot of what happen if I set the fogBandHeight > 0:

http://mud-h.com/miscweb/t3dforum/Misc/PBRAndSkyBoxFogIssue.jpg

Maybe you could give it a try and see if you have the same issue.


EDIT: I had a quick look at SkyBox code and here's the part I guess is causing the issue:

// Draw render band.
  if ( mFogBandHeight > 0 && mFogBandMatInst )
  {
     const FogData &fog = state->getSceneManager()->getFogData();
     if ( mLastFogColor != fog.color )
     {
        mLastFogColor = fog.color;
        _initRender();
     }

     // Just need it to follow the camera... no rotation.
     MatrixF camPosMat( MatrixF::Identity );
     camPosMat.setPosition( worldMat.getPosition() );
     sgData.objTrans = &camPosMat;
     mMatrixSet->setWorld( *sgData.objTrans );

     while ( mFogBandMatInst->setupPass( state, sgData ) )
     {
        mFogBandMatInst->setTransforms( *mMatrixSet, state );
        mFogBandMatInst->setSceneInfo( state, sgData );

        GFX->setVertexBuffer( mFogBandVB );      
        GFX->drawPrimitive( GFXTriangleList, 0, 16 );
     }
  }

I'd dont understand what the code do really but maybe someone can see something that might be the cause...


Edit:

Also found out that using basic Lighting both SkyBox and SkyLine are working fine. I'm pretty sure it was not fine before the conversion so I guess I'm on the right track. When I set the advanced lighting I get a console error:

Using Advanced Lighting
GFXD3D9Shader::_compileShader - Error compiling shader: E_FAIL: An undetermined error occurred (80004005)
  game/shaders/common/particlesP.hlsl(87,67): error X3004: undeclared identifier 'prepassUncondition'

Link to comment
Share on other sites

Just did a clean checkout and recompile. Only remaining references to GFXTriangleFan are in a few comments in Engine\source\gui\worldEditor\terrainEditor.cpp, though that does bring up a notion... Converting from fan to strip requires a re-alignment of verticies...


Sample: https://github.com/Lopuska/Torque3D/commit/bcc41c211774f64dc2f74de07659db41bd539b3f#diff-b23928a4f51b948ce21b6b298da60becR1042

Link to comment
Share on other sites

But this commit is already in the current D3D11 code and I shouldn't worry about it or should I?

And is there somewhere explaining what are those GFX draw types or a good documentation about how the GFX works in T3D or common engines? I really need to improve my knowledge in this area... Anyway, out of topic, might post about it somewhere else...

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.

Guest
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...