•      Sign In
• Create Account

# jkristia

Member Since 14 Oct 2012
Offline Last Active Jan 02 2015 02:18 PM

### In Topic: thick line - fixed width ?

09 October 2013 - 07:13 AM

>>If you set the transformation to identity on vertex shader (effectively ...

Ahh, didn't think of that. I will give this a try tonigh

### In Topic: thick line - fixed width ?

08 October 2013 - 10:00 PM

>>These steps can easily be implemented in pure software, too, in case you don't target a platform with GS capabilities.

This is kind of what I'm trying to do. For now I'm just trying to figure out how to do it, and I'm recreating and recalculating the rectangles on each frame update. Once it is working, I might want to try and do the same in the shader.

I now have the widen line with 'almost' constant width regardless of the zoom (camera distance). Notice the line thickness is almost the same when zoomed out and in.

thickline_1.png   8.7KB   2 downloads

thickline_2.png   10.14KB   3 downloads

but I have not yet figured out how to 'cancel' the scaling caused by the perspective projection.

thickline_3.png   2.68KB   5 downloads

### In Topic: thick line - fixed width ?

08 October 2013 - 07:12 AM

Yes, am I transforming the points into a rectangle with the width. That part is working. The part that I cannot get working is to

- keep the width constant, so the far point appears same thickness as the near point. This is where I thought I just needed to transform the rectangles vertices using the inverse projection matrix.

- calculate how wide the far end and near end needs to be if I want the line to appear e.g. 10 pixels wide, near and far, regardless of the zoom.

Hmmm. thinking of it, I think I need to use the inverse proj when calculating the width. I will try that tonight when I have more time to play.

### In Topic: Constant buffer

03 October 2013 - 02:24 PM

I just started with DirectX recently (SharpDX) and I had problems getting the constant buffer working too.

Here is a snippet of my C# code which works. (remember tp update your buffer using UpdateSubResource - that is where I had the problem)

[StructLayout(LayoutKind.Sequential, Pack=4)]
struct cbTransform
{
public Matrix worldProj;
}

...
cbTransform m_cbTransform = new cbTransform();
Buffer m_transformBuf;
m_transformBuf = new Buffer(rc.Device, Utilities.SizeOf<cbTransform>(), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
rc.Context.VertexShader.SetConstantBuffer(0, m_transformBuf);
...

m_cbTransform.worldProj = m_viewProj;

m_cbTransform.worldProj =

/*Matrix.RotationX(time) **/ Matrix.RotationY(time * 2)/* * Matrix.RotationZ(time * .7f)*/ * m_viewProj;

m_cbTransform.worldProj.Transpose();

rc.Context.UpdateSubresource<cbTransform>(ref m_cbTransform, m_transformBuf);

### In Topic: SharpDX, how to set constant buffer when using effect / technique

02 October 2013 - 07:36 PM

thank you for the information.

PARTNERS