Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Jun 2009
Offline Last Active Today, 02:42 PM

Posts I've Made

In Topic: StructuredBuffer and matrix layout

15 September 2014 - 12:13 PM

Yes, I've seen that behavior as well when using compute shaders. My workaround was to use a StructuredBuffer instead and use 4 loads. In terms of the compiled assembly this isn't really any less efficient, since a float4x4 by will get split into 4 loads when compiled to assembly (you can only load 4 DWORDs at a time from structured buffers).


While searching for an answer I stumbled upon your blog, which is the just about the only place that this packing issue is mentioned (bad MSDN...). I actually used your advise and loaded the 4 vectors myself, just to find out that the skinning shader went from 46 instructions with column-major to 176 instructions with row-major.

I knew that row-major is more inefficient than row-major, but x4 instructions is just too much.

In Topic: Mip mapping issue

12 September 2014 - 04:20 AM

0 isn't a valid value for MaxAnisotropy; it needs to be between 1 and 16: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476207%28v=vs.85%29.aspx
(Note that 1, not 0, is for anisotropic filtering disabled).
I suggest correcting this first, then see if the problems still happen.


This value is ignored in case the filter type is not anisotropic.

Appraently, 0 is indeed a valid value even if the filter type is anisotropic.

D3D11 ERROR: ID3D11Device::CreateSamplerState: MaxAnisotropy must be in the range [0 to 16].  20 specified. [ STATE_CREATION ERROR #226: CREATESAMPLERSTATE_INVALIDMAXANISOTROPY]

In Topic: PBR (blurry reflections)

12 September 2014 - 02:55 AM

As I understand from the articles that I've been reading, the more metallic a surface, the more reflection it has (and less albedo). Is it as simple as this?

Basically, yes. But there's more to it. There are other properties like the reflection color, shape, surface smoothness, etc.

PBR and BRDF is a huge topic, with many different models (Phong-model is a very basic BRDF).


What article are you reading? What are you trying to achieve?

I don't see any PBR in the code you posted. The shader does environment mapping with a very crude constant specular attenuation function. Unless the physics is baked into the env-map, this is not a real physical model.

In Topic: Mip mapping issue

11 September 2014 - 11:37 AM

Can you provide the code that shows how you generate and use the texture?


Why aren't you using DirectX functions (When creating the resource or with GenerateMipMaps)?


Also, make sure you're rendering state is correct - you didn't specify which DX version you are using, but it can be due to incorrect ShaderResourceView::MipLevels and SamplerState::MaxLod fields.

In Topic: Where do I go beyond Graphics Programming?

09 September 2014 - 02:26 PM

You start by saying that you are working on a game, yet the rest of your post is about engine development.

I suggest you start by reading the "Write Games, Not Engines" post (old, but still very relevant).


If you want to write a game, I suggest you pick a game engine off the shelf. There are numerous options - some proprietary like Unity, other open-source like Torque3D and Panda3D. By using an existing engine, you can spend more time on developing the game itself. There are other benefits like OS portability, engine robustness, existing resources, etc.


If you want to write an engine, Game Engine Architecture is a decent book. Writing a good game engine takes a lot of time, as modern engine contains a lot of components. It's not just graphics - you also need audio, networking, input, file services and many more.


You can decide that all you want to do is focus on the graphics engine (not to be confused with game engine) - that's a huge topic on its own.

You can decide that you want to focus on graphics programming (not to be confused with graphics engine) - another huge topic.

And the list of options is very long...


So - first decide what you really want to do. If it's making a game you are really after - than use an existing engine and make your game.