Jump to content

  • Log In with Google      Sign In   
  • Create Account

SIC Games

Member Since 22 Jun 2012
Offline Last Active Aug 26 2015 01:38 PM

#5245180 Popping SSAO issue DX11

Posted by SIC Games on 08 August 2015 - 09:22 PM

inside the screen quad code I forgot to store the perspective matrix in a FLOAT4x4.




Now I'm fiddling around with the perspective values. It was ultimately my forgetting issue.


looks ten times better and once i blur it then i'll show officially the scene.

#5236426 This isn't any good SSAO?

Posted by SIC Games on 23 June 2015 - 02:22 PM

SO I got into SSAO I took a snap shot but some reason it's not like Crysis 3 SSAO or any other ones I've scene. The depth is Z/W 100 as far plane and 0.1 as near plane.


The random texture was made in photoshop and converted to normal map. I stored the render target's height and width.




The normals are using the normal map included when it gets passed down to where the screen quad shades the SSAO.


This is done in 10 literatures. The rendertarget is R32G32B32A32_FLOAT and the depth stencil is D32_FLOAT.

#5235718 Anyone here a self-taught graphics programmer?

Posted by SIC Games on 19 June 2015 - 10:52 AM

I am - when I was young I think seven or eight my dad got me an IBM ATX/PC an old old monochrome pc which was remarkably slow. I have a uncle that was a programmer for McDonalds who got me hooked into programming. I started out with qBasic then moved onto Visual Basic 6.0 and some QuickC. There was a old graphics header file backthen and my dad got me some Windows Game Programming Books and 3D Game Programming Books - one was I believe The Black Arts of 3D Game Programming. I learnt how 3D rasterization works as in Wolfenstein style game.  From the period from 18-28 years old there's a huge void in my life. Got out of that void and up til recently been fascinated more about how today games look realistic (almost).


I tested out UDK for a bit few years ago before I started to decide to work on my own game engine. At first learning C++ and DirectX it threw me for a loop. My brain was eager to learn as much as possible so fast that I would get overwhelmed and have outbursts. I believe Hodgeman told me to take a break for a while and just do more research. After a while of researching and going by my pace of speed - I would say I've learnt a bit but need to learn more. I think that from going from asking too much help and trying to figure out myself helped a lot. 


I don't work for any IT job - I took one year at university online division for game level design - I didn't like it so I quit the education. I wasn't getting any fun out of it or anything. I wasn't being challenged enough should I say. I did see how schools work financially lol - get it---students loans!


So to finalize this whole post - recently, I've been taking my time - not bull rushing everything - just chilling. If I go head first into something - I usually get bent out of shape - so it's better to take your speed of pace like L. Spiro said.  What I like to do is break it down in chunks to get a better understanding of things.

#5228174 D2DFontX 1.0 Released Today!

Posted by SIC Games on 09 May 2015 - 02:11 PM

New functions help to translate, scale, rotate, skew and to set the the world matrix.

//-- Global Declaration.
D2DFontX *fontX;

bool InitFontX(IDXGISwapChain *d3d11swapchain, HWND windowhandle) {
     FontSettings fontSettings = FontSettings(L"Impact",16.0f, FONTCOLOR(1,1,1,1), DWRITE_FONT_WEIGHT::DWRITE_FONT_WEIGHT_NORMAL, 
     fontX = new D2DFontX(d3d11swapchain, fontSettings, windowhandle);
     if(fontX) {

       D2D1::Matrix3x2F myWorld;
       myWorld = fontX->getTranslationMatrix();
        return true;
return false;

void renderFontX(std::wstring text) {
if(fontX) {

#5228151 D2DFontX 1.0 Released Today!

Posted by SIC Games on 09 May 2015 - 12:51 PM

D2DFontX is a very simple D2D1 wrapper for D3D11. Include and Library files must point to Windows SDK and NOT DirectX SDK. It's in a debug release but you can help it become in Release State by pointing out what can be better. Any questions just ask.


If you don't have GitHub then you would have to download it. Then head over to the repository and download it from there.




Please read the ReadMe.txt first it should point you in the right direction.


#5227803 Issue with D2D10.1 blending with D3D11 Render Target

Posted by SIC Games on 07 May 2015 - 10:45 AM

Well high five to IeDoc! I got the D2D1 interoped from the samples you provided with ease. Just had to make sure I released some of the objects. D2D1 Debug Information was giving me memory leaks warning.


So this is cool and awesome because less code and easy to intergrate! Finally Microsoft done something cool. :D

#5210198 Has anyone had this problem when loading mesh with ASSIMP or anything?

Posted by SIC Games on 11 February 2015 - 11:16 PM

I'll do that BuckEye! Thanks for responding and I'll keep an update on how things went in the morning.

#5179974 Light - Dot function

Posted by SIC Games on 12 September 2014 - 03:18 PM

Thanks, float4 PosD = float4(0, 1, 0, 0); resolved problem with dot funtion.

But i still have problem with this lightning.

struct PS_INS_INPUT{

	float4 Pos : SV_POSITION;
	float4 Nor : NORMAL;
	float2 Tex : TEXCOORD0;
	float Light_S : LIGHT_S;


struct VS_INS_INPUT{

	float4 Pos : POSITION;
	float4 Nor : NORMAL;
	float2 Tex : TEXCOORD0;

	matrix instancePos : INSTANCEPOS;
	float Light_S : LIGHT_S;


	output.Pos = mul (input.Pos, input.instancePos);
    output.Pos = mul (output.Pos, View);
    output.Pos = mul (output.Pos, Projection);
    output.Tex = input.Tex;
	output.Light_S = input.Light_S;
	output.Nor = mul (input.Nor, input.instancePos);

    return output;

float4 PS_INS (PS_INS_INPUT input) : SV_Target{

	float4 diffuse = txDiffuse.Sample( samLinear, input.Tex ) * input.Light_S + KolorL;

	float3 PosD = float3 (0.25f, 0.5f, -1.0f);

	float3 LighD = float3 (0.5f, 0.5f, 0.5f);
	float3 LighA = float3 (0.2f, 0.2f, 0.2f);
	float3 FK;

	float3 NR = float3 (input.Nor.x, input.Nor.y, input.Nor.z);

	FK = diffuse * LighA;
	FK += saturate(dot(PosD, NR) * LighD * diffuse);

	return float4 (FK, diffuse.a);


Without FK += saturate(dot(PosD, NR) * LighD * diffuse);



With FK += saturate(dot(PosD, NR) * LighD * diffuse);



Why do I get someting like second photo? 


I'm guessing this is directional lighting being used like the sun? The reason why you're getting washed out area inside image two would because the position of the light is 1 unit above ground.

float3 PosD = float3(0.25f, 0.5f, -1.0f); //-- Light Position
float3 lightD = float3(0.5f, 0.5f, 0.5f) //-- Light Diffuse term
float3 lightA = float3(0.2f, 0.2f, 0.2f); //-- Light Ambient
float3 diffuseLight = diffuse.xyz * lightA; //-- Calculating diffuse map with the ambient color.
float intensity = saturate(dot(posD, input.normal)); //-- Clamp from 0 to 1 and get angle of light position to normal.
diffuseLight += saturate(lightD * intensity); //- Accumulate the diffuse light with the light intensity.

You could probably leave out the saturate from the diffuseLight accumulation - if it helps. I see you also changed the light position as well. Try to position it a bit heigher on Y Axis and see if there's any changes on how you like it.


Also the dot hlsl function returns a scalar 1 (float, int) - which could be the reason why you were having issues.



#5178234 Shader Resource View and Load()

Posted by SIC Games on 04 September 2014 - 11:20 PM

tex2D.MipLevels = 1;
tex2D.ArraySize = 1;
tex2D.Height = (height size of your texture.)
tex2D.Width = (width)
tex2D.Usage = D3D10_USAGE_DEFAULT;
tex2D.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
tex2D.CPUAccess = 0;
tex2D.SampleDesc.Count = 1;
tex2D.SampleDesc.Quality = 0;
tex2D.MiscFlags = 0;

srvD.Texture2D.MipLevels = 1;
srvD.Texture2D.MostDetailedMip = 0;
srvD.Format = tex2D.format;

I should've asked if you're trying to load a texture? If so then  you can use the D3DX10CreateShaderResourceViewFromFile


MSDN Reference of the function D3DX10CreateShaderResourceViewFromFile




It would load the texture and create a shader resource view which you can place inside your shader code.


Unless you're trying to do something different.

#5177598 What are these showing in my normal map (Forward Rendering)

Posted by SIC Games on 02 September 2014 - 12:37 AM

I've solved the issue - in BrazynerSoft Normalmapping tutorial he has it where you can compute the normals and tangents if needed to.


What I didn't notice is inside where the vertex data gets stored there's a XMFLOAT3 Tangent. If the compute normals aren't enabled - it sets the Tangent Data to black. Still resulting in proper display of the normal map without the messed up with edges that I had first post.


So, now there's no longer a weird shading issue due to proper filling of the input layout for the shader and the the vertex data.  It's really funny how the input layout for the shader has to match the exact same type of vertex data going in.


Thanks again for the support!

#5177566 What are these showing in my normal map (Forward Rendering)

Posted by SIC Games on 01 September 2014 - 09:28 PM

I hit the jack pot - I rendered Tangent data out Brayzsoft tutorial Normal Mapping and compared to mine plane.


Mine inside editor:




Brayznsoft Normal Map tutorial - Tangent Data rendered out


Brayzsoft-Normalmapsample (0-00-10-19).jpg


Now the question is since I set the compute normals off inside Brayzansoft normal map example - I have to look deeper into why my tangents aren't working.


Thanks Hodges for giving a helping hand but I know which direction now I have to head. Focus on how the data's being loaded from the mesh and also see if I can place visual cues in the geometry shader of the normals directions too.


Thanks Hodge..



#5177554 What are these showing in my normal map (Forward Rendering)

Posted by SIC Games on 01 September 2014 - 07:39 PM

This is the tangent rendered out without using color


Snapshot1 - Copy (3).jpg


The black and the abruptness of colors I would suspect to be a issue in the tangents. So possibly I would have to re-calculate the tangents by using the normals inside the mesh.


This is the tangent data calculated.




The same edges appear as top of this thread. So possibly recacluating the tangent data would do some good.



#5177548 What are these showing in my normal map (Forward Rendering)

Posted by SIC Games on 01 September 2014 - 07:24 PM

By discontinuuity what do you mean? Non-consistant?


This is the image of the normal as a color:


The hard edge is considered a discontinuity?


Normal map



input.normal as color

Snapshot1 - Copy (2).jpg


input.tangent as color


Snapshot1 - Copy.jpg


I'm sorry for uploading so many photos just trying to understand what you mean by discontinuity and how to debug something later in the future.



#5177543 What are these showing in my normal map (Forward Rendering)

Posted by SIC Games on 01 September 2014 - 06:56 PM

What I got was this :



Top view:




Left View



Bottom View



What colors am I looking for exactly?


I changed the PS code to be like you mentioned:

        input.normal = normalize(input.normal) * 0.5f + 0.5f;
	input.tangent = normalize(input.normal) * 0.5f + 0.5f;
	//input.tangent = normalize(input.tangent - dot(input.tangent, input.normal) * input.normal);

	float3 B = cross(input.normal,input.tangent);
	float3x3 texspace = float3x3(input.tangent,B,input.normal);
         input.normal = mul(normalmap,texspace);

#5177533 What are these showing in my normal map (Forward Rendering)

Posted by SIC Games on 01 September 2014 - 05:36 PM

When I output the normal map this shows up:




Would this be a normal issue inside the mesh? Funny how Brazynsoft checks to see if the parameter of cumpute normals is true or false. If not then it uses the normals from the mesh. I'm using the normals from the mesh.


The shader:

output.normal = mul(input.normal, (float3x3)worldMatrix); //-- worldMatrix is the model's world matrix.
output.tangent = mul(input.tangent, (float3x3)worldMatrix);


float3 normalmap = Textures[1].Sample(ss, input.texcoord);
normalmap = 2.0f * normalmap - 1.0f;

input.normal  = normalize(input.normal);
input.tangent = normalize(input.tangent - dot(input.tangent, input.normal) * input.normal);
float3 biTangent  = cross(input.tangent, input.normal);
float3x3 texSpace = float3x3(biTangent, input.Tangent, input.normal);

input.normal = normalize(mul(normalmap, texSpace));

Or possibly this could be a result of the normal map its self.