Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 Jan 2010
Offline Last Active Private

#5316064 Tessellated ocean with no culling artifacts.

Posted by on 21 October 2016 - 06:11 AM

Nope. Unless you have a perfectly flat ocean there will always be some back-facing triangles.

#5315177 Blending texture to backbuffer

Posted by on 14 October 2016 - 08:08 AM

So I wonder, is there some shortcut method to blend 2 textures with the same size, format, and sample count in Direct3D?



Nope. ID3D11DeviceContext::CopyResource comes closest but doesn't allow multi-sampled resources nor blending. So rendering a full-screen quad/triangle and blending it is.

#5314689 Trouble passing multiple lights

Posted by on 11 October 2016 - 10:21 AM

When using the effect system there's no need to create and bind the buffers on your own. Updating is done through the effect's variables (in this case I guess using ID3DX11EffectVariable::SetRawValue) and then calling ID3DX11EffectPass::Apply().

#5314323 3D Object doesnt show

Posted by on 08 October 2016 - 06:01 AM

Create the device with D3D11_CREATE_DEVICE_DEBUG and watch the debug output window. The D3D11 debug layer will report screw-ups with (usually) great detail.

#5306504 Perlin Noise - seamless cube maps

Posted by on 18 August 2016 - 03:59 AM

Shouldn't you flip certain coords, e.g. for back (dim - 1 - x, y, dim) or something ? 

#5304004 Creating A Geometry Shader With Stream-Output Fails

Posted by on 04 August 2016 - 09:54 AM

it throws an unhelpful exception about being initialized to null...

geometryShader = new SharpDX.Direct3D11.GeometryShader(defaultDevice, geometryShaderByteCode, outputElements, null, 0);

A null array for the stride(s) doesn't sound right.

#5302236 Erasing Character

Posted by on 23 July 2016 - 04:49 PM

Precisely, you have been told already.

#5297857 D3D11 - Pretransformed vertices? (GUI)

Posted by on 24 June 2016 - 08:09 AM

Yup, changing the viewport needs adjusted transformations, as Hodgman shows.


You could use scissors (ID3D11DeviceContext::RSSetScissorRects) for axis aligned clipping and keep the viewport as is. Probably the simplest to implement.


For completeness: There are other ways to clip:

- Look into SV_ClipDistance semantic (VS output)

- Similarily: Manually clip in the pixel shader with clip/discard

- For rectangles you could "clip" in the vertex shader (rect intersection calculation, adjusting tex coords, too) (*)

- Hint: SV_Position as input to the pixel shader delivers pixel coordinates (with a 0.5 offset), this can come in handy.


Edit: (*) Can be even a good idea to do this CPU-side. Instead of lots of pipeline state changes, one can batch everything.

#5295816 Question about HLSL matrix multiplication

Posted by on 09 June 2016 - 10:17 AM

Because that is not a matrix multiplication but a component-wise one (aka modulate). This is:
matrix vp = mul(gProjMatrix, gViewMatrix);

Edit: When you can then use a sequence of matrix-vector mults instead of matrix-matrix. E.g. in this case the instruction count difference is quite big (10 vs. 22).

(Even better: Provide the product with the constant buffer already :wink: )

#5292384 When you realize how dumb a bug is...

Posted by on 18 May 2016 - 05:45 PM

The picture below supposed to be a voxelized sphere.


Problem: operator << has lower precedence than +. Should have used | or brackets.


Now I feel really dumb. :wacko:

Attached Thumbnails

  • VoxelsGoneBad.jpg

#5273478 Inverting normals when rendering backfaces

Posted by on 31 January 2016 - 09:44 AM

Use the SV_IsFrontFace system value semantic:

float4 PS(float3 normal: NORMAL, bool face: SV_IsFrontFace): SV_Target
    normal = -normal;

#5272850 Alpha mask dynamically rotated triangle

Posted by on 27 January 2016 - 10:53 AM

Different tex-coords for the mask, provided through the vertices already, transformed or reconstructed (as Servant has shown) are warranted here. Maybe you wouldn't need those triangles at all: If you look at it as a post-process (it sounds like you're after some sort of vignetting) you just draw a screen quad/triangle and do all the magic in the fragment shader.


Here is an example I wrote for D3D11, hopefully providing some food for thought.

#5272847 directional shadow map problem

Posted by on 27 January 2016 - 10:32 AM

This artifact is known as Peter Panning.

#5272251 Texture Rendering

Posted by on 22 January 2016 - 08:47 AM

You should learn how to find stuff yourself wink.png. I mentioned the transliteration for SharpDX. That was a first google hit:

SharpDX for Rastertek tutorials

Also, the DirectX subforum here has a couple of links that should help you.

Edit: Also, gamedev.net member Eric Richards has transliterated Luna's source code (also available online) to SlimDX here

#5272233 Detecting Boundaries in triangles with adjacency

Posted by on 22 January 2016 - 04:23 AM

In D3D11 a index of -1 has a special meaning (see here, last paragraph "Generating Multiple Strips"). IIRC in OpenGL you can define that value arbitrarily. I wonder if you even get something in the geometry shader then, since it operates on primitives. If that is the case, try another number, e.g. -2.


You can grab the index in the vertex shader with SV_VertexID and pass it along. Maybe that helps.