Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Feb 2008
Offline Last Active Today, 08:28 AM

#5313242 State Change Management in D3D11

Posted by on 29 September 2016 - 07:54 AM

you should manage your state and only set what is needed (when it is needed). 

Depending on the rendering design, I have seen performance boost up to 15% just by managing state properly.

One think I would do differently in the code above is only actually setting the state (on the device context) just before draw/dispatch.

#5308022 Pd.D. C.S. Research Topics?

Posted by on 26 August 2016 - 07:15 AM

You might want to take a look at http://openproblems.realtimerendering.com/s2016/index.html in case you are interested in graphics programming.

#5299333 ddx, ddy reuse for better performance?

Posted by on 06 July 2016 - 09:45 AM

I think you should recalculate ddx/ddy after the offsets (from POM) have been added to the texcoords.

As the offsets are different between pixels, this results in different UVs (to sample base maps) and this results in different derivatives.

So as you have to calculate them anyway, you might as well use tex2D.


You can probably derive a scaling factor (from the offsets) to apply to the baseUV ddx/ddy (and that will likely be cheaper than recalculating)

#5255087 Banding Problem

Posted by on 02 October 2015 - 01:27 AM

perhaps you already seen it but I think this presentation gives some solutions to fix banding.

#5240464 Best engine for cinematics?

Posted by on 15 July 2015 - 06:19 AM

You could take a look at Crytek's Cinebox, 

All the tech from CryEngine (and much, much more) inside an application specifically targeting animation / previs.

See this fx guide thread

Not publicly available but already used by animation studios, so you sould contact Crytek for more info.

#5198915 Copy texture between contexts

Posted by on 18 December 2014 - 03:24 AM

Assuming you want to use the passed-in resource with a different device/context (than it was created with), take a look at resource sharing.

You might need to create a new texture resource on the first device (so you can correct sharing flags) and share that texture with the second device. Now you can copy (using the first context) the rendered frame to the new resource (and use it with the second context/device).

#5198782 Determine Shader Model for Compiled Shader Object

Posted by on 17 December 2014 - 10:21 AM

You should use the provided macros (defined in d3d11shader.h):


To get the shader type (returns a D3D11_SHADER_VERSION_TYPE):


where version is the value of D3D11_SHADER_DESC::Version

#5176038 Sampling the Render target while rendering to it

Posted by on 25 August 2014 - 12:20 PM

I have done it in the past using an UAV and in-place (un)packing.

See this msdn article for more info

#5146167 Doubt with textures

Posted by on 10 April 2014 - 11:45 PM

Typically you would use submeshes. so a model (aka mesh), is actually an array of models ( frequently called submeshes).

a mesh is split into submeshes based on various strategies: artist defined, based on material/shader/texture/..., gameplay related reasons, ...

Do note that this (and pretty mutch any asset related operations), should be done offline.

#5145635 Deferred shading position reconstruction change

Posted by on 09 April 2014 - 06:01 AM

Thanks, I'll try it. smile.png

What does the rcp function actually do? Rounding, like floor / ceil in C?


rcp is the reciprocal ( 1 / x ).

note that in shaders this is often a fast approximation (so faster than actually doing 1.0 / x but less accurate).

#5126805 Increase texture reading speed

Posted by on 27 January 2014 - 03:40 PM

first off all, 144 tex lookups per pixel is a lot. a solution would be to simple use less ( find a balance between performance and visuals).


Try to make your textures smaller and/or slimmer.

fat textures (like your (R16G16B16A16) are slower so try to pack your data. 

Normals for example could be stored as X8Y8 and reconstruct Z inside the shader.


also look to the access patterns and filtering.

reduce filtering quality or try to use the Gather instruction if possible.

you could even refactor your renderer to make use of a compute shader where you can sample your textures into group-shared memory

#5126053 How to use VFACE in HLSL?

Posted by on 24 January 2014 - 03:05 AM

VFACE can be assigned to a parameter inside your shader function and the gpu will fill in the value on the fly.

something like this should work:

float4 PsMain( float vface : VFACE) : COLOR0
	if (vface < 0)
		return float4(1,0,0,1);
		return float4(0,1,0,1);

do note that on D3D10 (and up), this value is now a boolean and renamed to SV_IsFrontFace.

float4 MainPS( bool vf :  SV_IsFrontFace)  : SV_Target
    float4 output;
	if (vf)
		output.x = 1;
		output.y = 1;
	return output;

#5117280 Graduation project ideas

Posted by on 16 December 2013 - 04:07 AM

I'm with Kaptein: You can investigate a lot of other techniques (imho temporal reprojection has the best results atm) but in the end you will find out that SSAA (supersampling) is by far the best.


some ideas you could do (although not sure you can do them with unity)

* Volumetric related stuff (like you mentioned can be lighting but also shadows and participating media like fog)

* dynamic global illumination

* voxel related techniques (GI, shadows, reflections, ... )

* screen space decals

* layered material system

* GPU particles (either as vfx or for example fluid dynamics)

* occlusion culling (software based, portals, .. )

* reflections (screen space, glossy reflections, ... )

#5111230 PIX Crash

Posted by on 22 November 2013 - 01:10 AM

I use Intel GPA

The frame analyser works pretty good and looks and feels simular to pix.

#5089155 Rawinput x64 bit problem

Posted by on 26 August 2013 - 06:37 AM

UInt nSize = 40;
BYTE m_Buffer[40];

The size difference between 32bit and 64bit.

use something like:

uint8 buffer[sizeof(RAWINPUT)] = {};
uint32 size = sizeof(RAWINPUT);