Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 1 more developer from Canada and 12 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


unbird

Member Since 04 Jan 2010
Offline Last Active Private

#5250293 Write to a texture with a Compute Shader

Posted by unbird on Yesterday, 11:08 AM

Resource barrier when switching from read to write (and vice versa) ?




#5242766 Issue with Cubemap Shader Resource View Mismatch

Posted by unbird on 26 July 2015 - 09:30 AM

Look closely:

canvas->getDeviceContext()->PSSetShaderResources(0, 3, textures);
canvas->getDeviceContext()->PSSetShaderResources(1, 1, &additionalSRV);




#5241386 [SlimDX] New tutorials?

Posted by unbird on 19 July 2015 - 11:08 AM

You just missed a relevant thread from this week wink.png




#5240440 Moving from MonoGame to SharpDX/SlimDX

Posted by unbird on 15 July 2015 - 02:21 AM

Since you know C++, I second Luna's book for learning the API. Spazzarama's cookbook looks solid, too, in particular because it also covers more advanced techniques. And here someone took the time to transliterate most of the rastertek tutorials to SharpDX.

 

Welcome to D3D11 smile.png




#5238757 MipMap count : counter or math is better ?

Posted by unbird on 07 July 2015 - 06:57 AM

for(int i = 1; i <= MAX_TEXTURE_SIZE; i++)
{
   assert(MipCount(i) == MipMath(i));
}



#5237967 XOR rendering with shaders or

Posted by unbird on 02 July 2015 - 03:52 AM

This is the blending formula (the following link is D3D10 but I consider it a good explanation)

src * srcblend operation dest * destblend

Note that * can mean channelwise, not only "vector times scalar", if the blendfactor implies several channels.

What you want is color inversion ("negative") of the target/destination. Mathematically:

1-dest

This is BlendOption.InverseDestinationColor (works for either blend factor). How to bring it into the above form ? Like so:

src * (1-dest) + dest * 0

I choose source, because that's what we can control with the pixel shader output. Output 1 from there should give us (test, simplify):

= 1 * (1-dest) + 0
= 1 * (1-dest)
= 1 - dest


Violà! This is the corresponding blend state description
new RenderTargetBlendDescription()
{
	BlendEnable = true,
	RenderTargetWriteMask = ColorWriteMaskFlags.All,

	BlendOperation = BlendOperation.Add,
	SourceBlend = BlendOption.InverseDestinationColor,
	DestinationBlend = BlendOption.Zero,

	// do whatever with alpha
	BlendOperationAlpha = BlendOperation.Add,
	SourceBlendAlpha = BlendOption.One,
	DestinationBlendAlpha = BlendOption.One,
}
Note that "XOR selection" was originally a crude optimization (because it is reversible) which doesn't really apply to today's hardware. You can draw almost easily the full screen full of characters each with different color and background color (or even gradients), changing all every frame. A classical selection effect is nothing else.

Here I draw an ellipse after some text:

Attached Thumbnails

  • Background.Png
  • Inversion.Png



#5237641 Error whenever trying to write/set constant buffer

Posted by unbird on 30 June 2015 - 02:10 AM

I don't see CB = new ConstantBuffer() or something anywhere.




#5237530 Drawing variable amount of instances (Terrain)

Posted by unbird on 29 June 2015 - 11:52 AM

You can always draw less than a buffer can hold. So create a big enough one at startup (or recreate it only when it grows).




#5237528 Error whenever trying to write/set constant buffer

Posted by unbird on 29 June 2015 - 11:43 AM

Do you actually create TriangleDemo::CB anywhere ? Is this a global ?




#5236433 Load Compiled Shaders

Posted by unbird on 23 June 2015 - 03:07 PM

I don't know if there's a way to extract and fill the input layout elements array from the bytecode. Anyone else?


D3DReflect and then ID3D11ShaderReflection::GetInputParameterDesc. This works for all shaders and there's also a corresponding function for output parameters.


#5236314 Render one image to several window

Posted by unbird on 23 June 2015 - 05:57 AM

You create a swapchain for each window you want to render to. For this to work you do NOT use the CreateWithSwapChain convenience function, but create device and swapchains separately, see here




#5234903 Can i resolve a multisampled depth buffer into a texture?

Posted by unbird on 15 June 2015 - 10:31 AM

Hmmm, sounds like you have to do that manually in which case you could do the shadowmapping with a Texture2DMS directly, I guess.




#5234477 texture problems trying to load a simple 3d model.

Posted by unbird on 12 June 2015 - 11:11 AM

That Wavefront converter is quite rudimentary and might have other issues but as a lucky guess it might just be OpenGL-style tex-coords:
Try flipping the y: tex.y = 1.0f  - tex.y


#5234470 float value increment in a loop?

Posted by unbird on 12 June 2015 - 11:02 AM

For god's sake show the bloody error message. It's probably float vs double trouble.

 

Yeah, now ninja-ed through the edit. f += 0.3f should work too.




#5234466 float value increment in a loop?

Posted by unbird on 12 June 2015 - 10:57 AM

What language, but more importantly: What error ?






PARTNERS