PBR: Principles, Practice, and Prepwork

Materials, textures, lighting, postfx
165 posts Page 15 of 17
Timmy
Posts: 237
Joined: Thu Feb 05, 2015 3:20 am
by Timmy » Sat Dec 26, 2015 11:48 am
Merry xmas :mrgreen: . Coming along well az, nice work.
Mud-H
Posts: 175
Joined: Thu Feb 19, 2015 3:08 pm
by Mud-H » Mon Jan 11, 2016 10:00 pm
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:
Image
(I know the road stones PBR is not set correctly)
Image
As you can see, it's like the SkyLine skybox is shrinked and got the alpha disabled...
Azaezel
Posts: 360
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Tue Jan 12, 2016 3:09 am
This with the latest? Just added DX11
Mud-H
Posts: 175
Joined: Thu Feb 19, 2015 3:08 pm
by Mud-H » Tue Jan 12, 2016 4:32 am
Azaezel wrote: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?
Azaezel
Posts: 360
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Tue Jan 12, 2016 5:04 am
Mud-H wrote:
Azaezel wrote: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 viewtopic.php?f=40&t=473#p4049 and samples https://github.com/Azaezel/Torque3D/com ... d978f268fd (flat file) https://github.com/Azaezel/Torque3D/com ... a3d04c6d31 (shadergen)
and a few more https://github.com/Azaezel/Torque3D/com ... dDX11Check from Oct 23, 2015 )

2) does running a debug version spew any unlogged info?
Mud-H
Posts: 175
Joined: Thu Feb 19, 2015 3:08 pm
by Mud-H » Tue Jan 12, 2016 7:17 am
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:

Code: Select all

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?
Mud-H
Posts: 175
Joined: Thu Feb 19, 2015 3:08 pm
by Mud-H » Tue Jan 12, 2016 7:52 am
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:
Image
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:

Code: Select all

// 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:

Code: Select all

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'
Mud-H
Posts: 175
Joined: Thu Feb 19, 2015 3:08 pm
by Mud-H » Tue Jan 12, 2016 10:33 am
I think you forgot an update to gfxDrawUtill.cpp, there's still some reference to the removed GFXTriangleFan, I tought it was missing from gfxEnums.h at first, but I found that it have been completly removed from the D3D11 branch.
https://github.com/Azaezel/Torque3D/blo ... awUtil.cpp
Azaezel
Posts: 360
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Tue Jan 12, 2016 12:55 pm
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/com ... 60becR1042
Mud-H
Posts: 175
Joined: Thu Feb 19, 2015 3:08 pm
by Mud-H » Tue Jan 12, 2016 8:39 pm
Azaezel wrote:Converting from fan to strip requires a re-alignment of verticies...
Sample: https://github.com/Lopuska/Torque3D/com ... 60becR1042

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...
165 posts Page 15 of 17

Who is online

Users browsing this forum: No registered users and 1 guest