Jump to content

  • Log In with Google      Sign In   
  • Create Account

Endemoniada

Member Since 01 Jul 2003
Offline Last Active Sep 06 2016 07:03 PM

#5277034 Should I always use float4 ?

Posted by on 19 February 2016 - 04:08 PM

Hi guys,

 

I'm still not sure about what variable types to use for buffers and shaders. It's easier to explain with code:

 
// vertex layout
 
D3D11_INPUT_ELEMENT_DESC layout[] = {
 { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
 { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
 

I use a float3 for the position, should it instead be float4 ? Also, I like to use a float4 for the uv so I can use the .zw components for custom data but what if I only use the .xy components, should it then be float2 ?

 

The same question applies to the shader itself:

 
struct VS_INPUT
{
 float3 position : POSITION;
 float4 uv : TEXCOORD0;
};

Should these exactly match the layout (like they do here) ?

 

This has always confused me. Thanks.




#5268125 Enable MSAA in DirectX 11

Posted by on 27 December 2015 - 11:38 AM

Hi,

 

Here are two different ways I set my quality, they may not be the best ways to do it:

 
UINT msaa_quality;
 
// method 1
 
msaa_quality = D3D11_STANDARD_MULTISAMPLE_PATTERN;
 
// method 2
 
DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; // or the format you're using
UINT msaa_samples = 4; // or 2, 8, etc.
 
hResult = d3d_device->CheckMultisampleQualityLevels(DXGI_FORMAT_R8G8B8A8_UNORM, msaa_samples, &msaa_quality);
msaa_quality--;
 



#5266685 Temporally Smoothing SSAO ?

Posted by on 16 December 2015 - 12:22 PM

Hi guys,

 

I found only two practical articles on temporal smoothing and they leave a lot out.

 

I read this:

 

"To combine them, we simply took previous ssao buffer (so it became effectively accumulation texture), took offset based on motion vectors, read it and after deciding on rejection or acceptance (smooth weight) combined them together with a fixed exponential decay (weight of 0.9 for history accumulation buffer on acceptance, it got down to zero on rejection) and output the AO."

 

I don't know what motion vectors are, or how to accept/reject data based on them. The article makes it seem so simple.

 

I can use any info you may think is helpful.

 

Thanks.

 




#5254173 Unbind Render Target ?

Posted by on 26 September 2015 - 03:25 PM

Hi guys,

 

I don't really understand what is going on here:

// this is simplified for clarity
 
// set render target to rt0
d3d_context->OMSetRenderTargets(1, &d3d_rt0_view, nullptr);
 
d3d_context->Draw(...);
 
// now use rt0 as shader input
 
// set render target to rt1 (shouldn't this unbind rt0 ?)
d3d_context->OMSetRenderTargets(1, &d3d_rt1_view, nullptr);
 
// this breaks my ssao and causes debug errors
d3d_context->PSSetShaderResources(0, 1, &d3d_rt0_shader_view);
 
d3d_context->Draw(...);

I'm basically rendering to textures then using them in a shader (for SSAO, etc.)

 

Thanks.

 

 

*SOLVED*

 

I have to unbind it explicitly like this:

 

ID3D11ShaderResourceView* srvs[1] = { nullptr };

d3d_context->PSSetShaderResources(0, 1, srvs);

 




#5252939 Reducing Post-Processing Aliasing ?

Posted by on 18 September 2015 - 02:54 PM

Thanks Ashaman, I'm going to try to implement an HLSL post AA method, either FXAA or SSAA, to see how it goes.




#5252540 Reducing Post-Processing Aliasing ?

Posted by on 16 September 2015 - 11:01 AM

Hi guys,

 

I'm getting flicker when I apply image-based post-processing effects; everything looks great until there is movement so maybe this falls under frame cohesion.

 

I tried somethng simple by applying a Sobel filter and adding 25% of it to the output, it causes unacceptable flicker, especially on the moving objects (characters.)

 

I'm not using any post AA shaders so maybe that's the route I should go ? Perhaps I can use supersampling, I can probably render to 2x and downsample but will that destroy the effect I'm shooting for ? I don't know what to do or even if I should be working with image-space effects.

 

Thanks.

 




#5211258 WM_INPUT Keys Not Registering

Posted by on 17 February 2015 - 02:02 PM

Thanks Dave, that's a pretty good article. I thought I was losing it.




#5068776 Camera Panning ?

Posted by on 10 June 2013 - 04:33 PM

Change the position with your current up and right vector, like so (pseudo code).

 

 

   // dx, dy are your current mouse move deltas
   camera.position += dx * camera.right + dy * camera.up;

Probably need to play with the signs (-dy * up, if your mouse y increases when moving down) and scale according to current frame delta time and some empirical value until it feels right.

 

It works like a charm now, thank you.




#5062670 How would you concatenate an array of strings together?

Posted by on 17 May 2013 - 03:53 PM

 

char buffer[4096]; // adjust
buffer[0]='\0';
 
for(int i=0;i<array_size;i++){
strcat(buffer,string_array[i]);
}

 

You can implement a two pass system as well, the first pass can determine how big the buffer must be.

I want to provide constructive criticism to say why you are getting downvotes, because it is frustrating to receive a negative reputation with out explanation.

That is the wrong language; there is no strcat() that I'm aware of in C#, and character arrays are not what is being used. That's also one of the least efficient ways to concatenate a collection of strings, due to having to count the length of the buffer each time you concatenate the string, which takes longer and longer.

 

Thank you. I didn't see the C# icon until just now.




#5061190 How would you concatenate an array of strings together?

Posted by on 11 May 2013 - 07:04 PM

char buffer[4096]; // adjust
buffer[0]='\0';
 
for(int i=0;i<array_size;i++){
strcat(buffer,string_array[i]);
}

 

You can implement a two pass system as well, the first pass can determine how big the buffer must be.




#4956183 Catalog of Particle Effects ?

Posted by on 05 July 2012 - 08:20 PM

Hi guys,

Do you know of any catalogs of different types of particle effects so I can learn how they are made ? I made a little engine and editor and the stuff I'm coming up with doesn't look very professional. I know it's a complex subject but I'm just trying to make cool looking stuff for an essentially 2D game, I'm not necessarily looking for realism either.

One thing I'm running into is the effects I make look decent on one colored background (like gold) but not another (like blue). The different levels in my game will have different colored backgrounds so this is disheartening.

Any help would be appreciated. Thanks.


PARTNERS