Jump to content

  • Log In with Google      Sign In   
  • Create Account


unbird

Member Since 04 Jan 2010
Offline Last Active Private

Posts I've Made

In Topic: Best way to render text with DirectX11

20 August 2014 - 09:38 AM

Alternatively FW1FontWrapper by Erik Rufelt.

In Topic: Checkstyle

15 August 2014 - 07:01 PM

After looking at my code, I found that the issue was my error message. My error message was about 60 characters long, politely informing that the only legal strings allowed in the method are "heads" and "tails". I replaced the error message with a frowny face emoticon instead.

 

"Improved" programming style and made program less user friendly. Good teaching.


In Topic: Getting Width/Height of ID3D11ShaderResourceView texture.

15 August 2014 - 06:36 PM

Close, but not close enough ;)
 
texture is a shader resource view, not the resource itself. QueryInterface will fail, pTextureInterface stays NULL and you're now dereferencing a NULL-pointer. 
 
You need to get the resource first with GetResource() from which you do the QueryInterface.
 
PS: Step through with your debugger to see what's happening (e.g. that that pointer was NULL). Also most of these API calls give a HRESULT which you should check for failures.

In Topic: copying back buffer not working

15 August 2014 - 08:23 AM

Check all HRESULT returned by API calls with the SUCCEEDED/FAILED macroes for failure.

For more information: Direct3D Programming Tip #5: Use The Debug Runtime.

 

From a quick glance: According to docs you can't use UpdateSurface when the surfaces are locked (why would you anyway, unless you want to copy manually).


In Topic: Grass Rendering Questions

11 August 2014 - 09:56 AM

Thanks for the update wink.png

Procedural randomness (or rather randomness on the fly) sounds attractive, but I found it tricky get right. Since you can't use a PRNG with state you end up using a hash of some sort. This looks like one of those typical float based hashes (some transcendental functions and magic numbers). They're cheap but I found that they can expose a pattern. Integer based ones look better but aren't that cheap. I also wonder if you can get e.g. blue noise or something this way (cheaply, that is). So yeah, a lookup (vertex stream or texture) sounds reasonable. One can of course combine the two approaches.
 

Not sure how well this works if you have UV (0.0, 0.0).

Currently, you just multiply, so all instances get the same random feed. You have to experiment here, e.g. use a offset:

float random = GetRandomValue(IN.Uv + primeTable[instanceId].xx);
And I wonder why primes. Also check the dimensions. You could provide a random (float2) offset table.

I'm curious if this is causing some blades to stack on top of each other so I'm not getting the full effect currently.

Depends on how you apply the randomness. If you don't offset the position more than half a blade's cell size, they should never intersect.

PARTNERS