Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 13 Nov 2008
Offline Last Active Today, 11:32 AM

Posts I've Made

In Topic: Ocean Wave 'Fake' SSS

04 February 2015 - 12:12 PM

Look's nice, Could you provide the shader code though? Maybe someone has a idea for improvement?

In Topic: C++ error

25 September 2013 - 06:33 AM

Oh, ok.. I see! :) But check your result values anyway.

In Topic: C++ error

25 September 2013 - 06:31 AM

Maybe D3D11CreateDeviceAndSwapChain failed and your device context is not initialized properly. You should definitely check your result values (i.e.):

HRESULT hr = D3D11CreateDeviceAndSwapChain(NULL,

if (FAILED(hr))
  // do your error handling

In Topic: Particles Rotation

09 August 2013 - 07:16 AM

You could just set up to UNIT_Y (some pseudocode):

view = normalize(cameraOrigin - particleOrigin);
if (sphericalBillboard) // whenever the particle normal should truly face the camera
  vertical = cameraUpVector;
  vertical = Vector3::UNIT_Y;
horizontal = cross(view, vertical);

Keep in mind to do the calculation in the right space (i.e. worldspace) and to adjust to your coordinate system.

In Topic: Asynchronous constant buffer update

17 July 2013 - 07:36 AM

The BUFFER_DESC is fairly standard:

const bool isStatic = (flags & CBF_STATIC_BUFFER) != 0;

desc.ByteWidth = size; // size is already multiple of 16 here
desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
desc.CPUAccessFlags = 0;

if (isStatic)
  desc.Usage = D3D11_USAGE_IMMUTABLE;
  desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
  desc.Usage = D3D11_USAGE_DYNAMIC;
desc.MiscFlags = 0;
desc.StructureByteStride = 0;

data.pSysMem = p_Data;
data.SysMemPitch = 0;
data.SysMemSlicePitch = 0;

ID3D11Buffer* buffer;
hr = device->CreateBuffer(&desc, isStatic ? &data : 0, &buffer);
I can't provide the actual update code, since it's to deeply integrated in the engine. But what basically happens is that the buffers which are marked for update are mapped, the memory chunk is copied via memcpy and the buffers are unmapped afterwards.

Note: the device is only *thread-safe* for resource creation.

Yes, I'm aware of that. But the context can be used still from many threads, although the access needs to be synchronized manually. I thought maybe someone here does have some knowledge with this.