Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


kalle_h

Member Since 05 May 2012
Online Last Active Today, 05:04 AM

#5196837 Annoying shadow map artifacts

Posted by kalle_h on 07 December 2014 - 02:30 PM

I would get rid of that conditional and use texture wrap mode border color instead.




#5196783 Writing my own pathtracer on mobile device

Posted by kalle_h on 07 December 2014 - 08:13 AM

Shadertoy is really useful for simple and bruteforce examples. Like this small path tracer. https://www.shadertoy.com/view/4sfGDB

Its easy to just start to modify sources and learn what each lines do. And you can avoid all non relevant problems.




#5195505 AABB box intersection test

Posted by kalle_h on 30 November 2014 - 11:05 AM

 

Object space AABB culling work by first combining model matrix and viewProj matrix and then extracting planes from that. Because you don't actually care about planes but just the test result you should defer the plane calculation until its used then early out will save a lot more math. You actually don't need the distance but just the comparison result so you can omit the normalization.

My version can be found here http://pastebin.com/3uJmYXPT

 

Is the "frustrummatrix" just the inverse world-view-proj matrix? I guess it is row-major aswell? (I'm using column-major instead - but actually, does it really matter?)

 

No need for inversing.Its just world-view-proj matrix. Its colum major.

 

Theory behind method can be found here. https://fgiesen.wordpress.com/2012/08/31/frustum-planes-from-the-projection-matrix/




#5195252 Slow shader compile time when using large arrays.

Posted by kalle_h on 28 November 2014 - 03:31 PM

I'm curious, too.

kalle, you might reconsider. You say DX10 hardware, but you seem use the DX11 API. This is peculiar: structured buffers actually work with feature level 10 (and SM 4 shaders). I just did a minimal test with both hardware and reference device.

Thanks. Thats interesting behaviour. Documentation is bit scarce and just say. 

 

http://msdn.microsoft.com/en-us/library/windows/desktop/ff471514%28v=vs.85%29.aspx

Shader Model 4 (Available for compute and pixel shaders in Direct3D 11 on some Direct3D 10 devices.)

 

We are already in early access so I need to be really careful not to cut anyone out that already has bought the game. Structured buffers would be superior of ease of use. I guess the performance should be similar with either tbuffer, Buffer or Structured Buffer?




#5195236 AABB box intersection test

Posted by kalle_h on 28 November 2014 - 12:31 PM

Object space AABB culling work by first combining model matrix and viewProj matrix and then extracting planes from that. Because you don't actually care about planes but just the test result you should defer the plane calculation until its used then early out will save a lot more math. You actually don't need the distance but just the comparison result so you can omit the normalization.

My version can be found here http://pastebin.com/3uJmYXPT




#5195161 Slow shader compile time when using large arrays.

Posted by kalle_h on 28 November 2014 - 06:42 AM

I am getting awfully slow shader compilation times when using large arrays either in cbuffer or tbuffer formats. Simple test case where vertex is transformed by matrix from array using instanceId is enough to trigger this bug.

Compile times with different array size are:

n = 128     -> 0.008s

n = 1024   -> 0.621s

n =  65536 -> 62.34s

tbuffer TransformsTextureBuffer  : register(t0) { float4x4 u_transforms[1024];  } 

struct VS_INPUT
{
	float3	position	: SV_Position;
	uint instanceID		: SV_InstanceID;
};

struct PS_INPUT
{
	float4	position	: SV_Position;
};


PS_INPUT main (VS_INPUT input)
{
	PS_INPUT output = (PS_INPUT)0;
	output.position = mul(u_transforms[input.instanceID], float4(input.position, 1.0));
	return output;
}

Can any one repeat this problem? Is this know behavior? Is there know solutions?

 

Shader version is vs_5_0.




#5192961 SSAO very dark

Posted by kalle_h on 15 November 2014 - 04:18 AM

One problem with SAO is that the falloff function over emphasis close samples. Basically samples are linearly distributed in screenspace distance but not in area. They are also weighted with inverse square falloff and the f term which cut the intensity even more when samples are far a way. These combined make effect really hard for different radiuses.

In their paper there are alternative falloff functions and I modified one of those and did get a lot better results. It's also a quite much faster.

float3 v = samplePos - centerPos;
float vv = rsqrt(dot(v, v) + EPSILON);
float ao = vv * vv * max(dot(v, normal) - BIAS, 0.0);



#5192456 Generating mipmaps for depth texture?

Posted by kalle_h on 12 November 2014 - 12:41 PM

I see; I guess this is a special case for this SSAO technique? I mean, in general mipmaps gives more sharp/öess blurry textures at distances

 

Usually you filter texels when you generate lower mipmaps. But for depth this does no make any sense. So instead of filtering you just pick one sample with rotating pattern.




#5192299 Generating mipmaps for depth texture?

Posted by kalle_h on 11 November 2014 - 02:52 PM

Mipmapping only improves performance. It does not improve the quality at all(actually its get slightly worse).

float main (PS_INPUT input) : SV_Target
{
  // Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling
  int2 ssP = input.position.xy;
  return u_texture0.Load(int3(ssP * 2 + int2((ssP.y & 1) ^ 1, (ssP.x & 1) ^ 1), 0)).r;
}



#5192011 Generating mipmaps for depth texture?

Posted by kalle_h on 10 November 2014 - 03:48 AM

http://graphics.cs.williams.edu/papers/SAOHPG12/McGuire12SAO.pdf

 

Use rotated grid subsample pattern.




#5191959 Multipass rendering with depth compare EQUAL

Posted by kalle_h on 09 November 2014 - 04:19 PM

Does it work if you use the same vertex shader on both passes?




#5191584 2D Motion Blur Shader

Posted by kalle_h on 06 November 2014 - 05:05 PM

This does not produce what I expected sad.png the objects aren't streched, but rather change in opacity. Is there no way to do it like PAINT.NET? there is a motion blur that stretches the object. But it is really slow so I think it is not done by a O(n) fragment shader

http://graphics.cs.williams.edu/papers/MotionBlurI3D12/McGuire12Blur.pdf

 

Basically you need to dilate velocity buffer to make object stretch. You can do this by calculating max motion vectors to lower resolution buffer and use that instead of per pixel. You need to do some amount of sample weighting to get rid of some artifacts. These might not be too bad in 2d case.




#5191441 2D Motion Blur Shader

Posted by kalle_h on 05 November 2014 - 06:31 PM

http://john-chapman-graphics.blogspot.co.uk/2013/01/per-object-motion-blur.html

 

2d motion blur should work just like 3d one.




#5191412 ssao self-occlusion problems

Posted by kalle_h on 05 November 2014 - 03:12 PM

You should't smooth normals for buildings that should have hard edges.




#5191206 ssao self-occlusion problems

Posted by kalle_h on 04 November 2014 - 04:06 PM

http://i1.minus.com/iNaUDFZZDp822.png Corner at right wall look really blue? Why is that and could that be the problem.






PARTNERS