Jump to content

  • Log In with Google      Sign In   
  • Create Account


lipsryme

Member Since 02 Mar 2010
Offline Last Active Aug 21 2014 06:18 AM

Posts I've Made

In Topic: Alpha-Test and Forward+ Rendering (Z-prepass questions)

10 August 2014 - 07:17 AM

 

Alpha-tested geometry tends to mess up z-buffer compression and hierarchical z representations. So usually you want to render it after your "normal" opaques, so that the normal geometry can get the benefit of full-speed depth testing.

 

As for why they return a color from their pixel shader...I have no idea. In our engine we use a void return type for our alpha-tested depth-only pixel shader.

 

Could it be beneficial to skip z prepass for alpha tested geometry compleatly to avoid that z-buffer compression mess ups?

 

The issue here is you can't since you need the depth information for light culling in the compute shader.

By the way it seems they have alpha-to-coverage enabled in the AMD sample so maybe the color return type has something to do with that ?


In Topic: UE4 IBL glsl

09 August 2014 - 01:13 PM

Hi REF_Cracker. Sorry for the late answer I just happened to stumble upon the thread again (hadn't been following it).

The format I'm using is R16G16B16A16_FLOAT for each cube map face.

I calculate the roughness in the shader like this:

float Roughness = (CubeLOD) / (CubeLODCount);

Which would give you values like these:

0 (256x256)

0.166667 (128x128)

0.333333 (64x64)

0.5 (32x32)

0.666667 (16x16)

0.833333 (8x8)

1 (4x4)

CubeLOD is starting at 256x256 and going down 6 levels (so 7 in total / original + 6 mip levels) to 4x4 for the roughest one.

Maybe you should use less mips and make it end at 16x16 or so haven't done much testing here.


In Topic: UE4 IBL glsl

14 July 2014 - 05:13 PM

He is using Disney's roughness which is squared so that would be m*m inside the importanceSampleGGX function.

My HLSL code:

float3 ImportanceSampleGGX(float2 Xi, float Roughness, float3 N)
{
	float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph]

	// Compute distribution direction
	float Phi = 2 * PI * Xi.x;
	float CosTheta = sqrt((1 - Xi.y) / (1 + (a*a - 1) * Xi.y));		
	float SinTheta = sqrt(1 - CosTheta * CosTheta);

	// Convert to spherical direction
	float3 H;
	H.x = SinTheta * cos(Phi);
	H.y = SinTheta * sin(Phi);
	H.z = CosTheta;

	float3 UpVector = abs(N.z) < 0.999 ? float3(0, 0, 1) : float3(1, 0, 0);
	float3 TangentX = normalize(cross(UpVector, N));
	float3 TangentY = cross(N, TangentX);

	// Tangent to world space
	return TangentX * H.x + TangentY * H.y + N * H.z;
}

For completeness sake here's how I do G_Smith:

// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html
float GGX(float NdotV, float a)
{
	float k = a / 2;
	return NdotV / (NdotV * (1.0f - k) + k);
}

// http://graphicrants.blogspot.com.au/2013/08/specular-brdf-reference.html
float G_Smith(float a, float nDotV, float nDotL)
{
	return GGX(nDotL, a * a) * GGX(nDotV, a * a);
}

Not sure about the TexCoord code you are using but you just need to render a regular post process quad and simply pass through the TexCoords as they are and then use them as inputs to the integrateBRDF function like so:

return IntegrateBRDF(input.TexCoord.x, input.TexCoord.y);

Probably unrelated but I'm using an R16G16_FLOAT texture like Brian Karis is suggesting.


In Topic: UE4 IBL / shading confusion

30 June 2014 - 05:41 AM

Thanks for those links, that answers it.

I find the FresnelReflectance(they call it Specular) * 0.5 peculiar...

I guess they did it to limit the range of non-metals to something that was foolproof.


In Topic: Screen-Space Subsurface Scattering artifacts (help)

29 June 2014 - 08:28 AM

Thanks, that made it quite a bit faster...still feel a little hacky all around but whatever tongue.png

The overhead of that technique is still quite high...as you need to do several special cases...has anyone tried doing it in half res ? Don't wanna wash out skin details though...

circa 4 ms on close-up @ 720p

 

Update:

The blur passes itself are just about 2ms but msaa resolves for scene, linear depth, and specular target add up to 1-2 ms (according to AMD perf studio) + the additional mask prepass & add specular passes...


PARTNERS