Jump to content

  • Log In with Google      Sign In   
  • Create Account

lomateron

Member Since 03 Feb 2012
Offline Last Active Jun 16 2013 08:28 PM
-----

#5069603 changing code on its roots

Posted by lomateron on 13 June 2013 - 06:46 PM

this solves what I was asking




#5069591 changing code on its roots

Posted by lomateron on 13 June 2013 - 06:05 PM

HLSL supports switches and in my case the "if"s will translate the same way a switch will do to assembly code

don't derail my real question

 

Has anyone think about a way to make this faster by creating a way of recompiling the code so it deletes all the unnecessary "if" lines in the assembly code while the application runs




#5069583 changing code on its roots

Posted by lomateron on 13 June 2013 - 05:39 PM

I have this code

 

float Code(float a,float b, int c)

{

    float r=0;

 

      if( c==0)

      {

           r=a*b;

      }

     else if( c==1)

     {

           r=a/b;

     }

     else if( c==2)

     {

          r=2*a;

     }

 

     return r;

}

 

 

 

Lets say i don't have 3 different "if" but a thousand different "if", and "c" as it is in the code just selects one "if" 

 

Has anyone think about a way to make this faster by creating a way of recompiling the code so it deletes all the unnecessary "if" lines in the assembly code

 

Or is there anything related to this that solves the problem in a different way?




#5059350 normals in tangent space question

Posted by lomateron on 04 May 2013 - 10:51 PM

"derived from the u-v coordinates"

how exactly is the bitangent direction derived?




#5040971 Directx bug?

Posted by lomateron on 08 March 2013 - 04:06 PM

can someone try this to see if its really a bug, it's simple:

 

create a texture with 1 texel....create it's render target..create its depthstencil with this DXGI_FORMAT_D24_UNORM_S8_UINT

create depthstencil state with this description:

 

D3D10_DEPTH_STENCIL_DESC dSDd;
dSDd.DepthEnable = FALSE;
dSDd.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ZERO;
dSDd.DepthFunc = D3D10_COMPARISON_ALWAYS;

dSDd.StencilEnable = TRUE;
dSDd.StencilReadMask = D3D10_DEFAULT_STENCIL_READ_MASK;
dSDd.StencilWriteMask = D3D10_DEFAULT_STENCIL_WRITE_MASK;

dSDd.FrontFace.StencilDepthFailOp	= D3D10_STENCIL_OP_KEEP;
dSDd.FrontFace.StencilFailOp		= D3D10_STENCIL_OP_INCR;
dSDd.FrontFace.StencilPassOp		= D3D10_STENCIL_OP_INCR;
dSDd.FrontFace.StencilFunc		= D3D10_COMPARISON_EQUAL;

dSDd.BackFace.StencilDepthFailOp	= D3D10_STENCIL_OP_KEEP;
dSDd.BackFace.StencilFailOp		= D3D10_STENCIL_OP_KEEP;
dSDd.BackFace.StencilPassOp		= D3D10_STENCIL_OP_KEEP;
dSDd.BackFace.StencilFunc		= D3D10_COMPARISON_NEVER;

 

create 2 techniques with this shaders, first technique uses VS1 and second technique uses VS2

 

struct VS_A
{
    float4 Pos : POSITION;
    uint Id : SV_InstanceID;
};

struct PS_A
{
    float4 Pos : SV_POSITION;
    float4 Texl : TTTTT;
};

PS_A VS1( VS_A i  )//stencil will not work as it should
{
	PS_A output;

	output.Pos=float4(0.0f,0.0f,0.0f,1.0f);
	output.Texl=float4(1.0f,1.0f,1.0f,1.0f);

	return output;
}

PS_A VS2( float4 Pos : POSITION  )//stencil will work correctly
{
	PS_A output;

	output.Pos=float4(0.0f,0.0f,0.0f,1.0f);
	output.Texl=float4(1.0f,1.0f,1.0f,1.0f);

	return output;
}

float4 PS( PS_A a) : SV_Target
{
	return a.Texl;
}

 

 

now to render

set the render target with its depthstencil, set its viewport and layout, point list and finally render it like this:

 


g_pd3dDevice->OMSetDepthStencilState(g_pDepthStencilState,1);

g_pd3dDevice->ClearDepthStencilView( g_pDepthStencilViewSpace3D, D3D10_CLEAR_STENCIL, 0.0f, 0 );
g_pTechnique1->GetPassByIndex( 0 )->Apply( 0 );
g_pd3dDevice->DrawInstanced( 1, 1, 0, 0);

g_pd3dDevice->ClearDepthStencilView( g_pDepthStencilViewSpace3D, D3D10_CLEAR_STENCIL, 0.0f, 0 );
g_pTechnique1->GetPassByIndex( 0 )->Apply( 0 );
g_pd3dDevice->DrawInstanced( 1, 1, 0, 0);

 

 

 

the first draw will fail the stencil test and will not draw nothing,

the second draw will pass the stencil test and will draw ----------->This is the problem, i don't know why it passes the test

 

Now change the technique so it uses the VS2 and render using: g_pd3dDevice->Draw( 1, 0);

The two draws will fail the stencil test, thats how it should work

 

The use of SV_Instance in VS1 i think is the cause of the problem, i dont know more

 

 




#5004009 Math "relations"

Posted by lomateron on 25 November 2012 - 03:48 PM

The way I see math in the most basic level is, relations between numbers. The only numbers we really can use are the natural ones, they are always the same but the relations we make between natural numbers are the ones that let us get to the other types of numbers. Then we have two parts, natural numbers and "relations". "Relations" are the most important and revolutional things in our lifes as we create more and deduce its properties.
Is there any place were i can find a calculator that doesnt gives numbers but relations, one that has a table of variables were i can introduce a list of numbers for each variable and it finds the relations that are between the numbers?


#4998169 Simple 3D model loader DirectX 11

Posted by lomateron on 06 November 2012 - 01:47 PM

I just made the simplest model loader

Code that creates the file with the mesh

[source lang="java"]#include <stdio.h>#include <d3dx10math.h>int main (){ FILE * pFile;D3DXVECTOR3 vertices[] ={{ D3DXVECTOR3( 1.0f,1.0f,1.0f )},{ D3DXVECTOR3( 1.0f,1.0f,1.0f )},{ D3DXVECTOR3( 1.0f,1.0f,1.0f )},};DWORD indices[] ={ 0,1,2,}; pFile = fopen ( "myfile.bin" , "wb" ); fwrite (vertices , 1 , sizeof(vertices) , pFile ); fwrite (indices , 1 , sizeof(indices) , pFile ); fclose (pFile); return 0;}[/source]
Code that loads the file with the mesh

[source lang="java"] FILE * pFile; pFile = fopen ( "myfile.bin" , "rb" ); D3DXVECTOR3 vertices[3]; fread (vertices,sizeof(vertices),1,pFile); DWORD indices[3]; fread (indicess,sizeof(indices),1,pFile); fclose (pFile);[/source]


#4981122 finding information on DirectX 10 is Difficult...?

Posted by lomateron on 17 September 2012 - 09:38 PM

The way I learned that window thingi is on the directxSDK in the directx 10 tutorial 0. click start > search "directx Documentation for C++" > look for samples and tutorial, then go to directx 10 tutorials. the tutorial 0 is about win32 basics.


#4953144 big loop with big array

Posted by lomateron on 26 June 2012 - 03:39 PM

solved, putting the "b" to read as binary solves it.


#4925781 very important equation desentralazing

Posted by lomateron on 27 March 2012 - 01:15 PM

Its common that the feeling of annoyance can be awaken when someone else has discovered a problem and makes himself loud and noticed by others that are in any way connected to you, knowing that the same thing happened before with the same problem and probably many times before with another person, but! as you have defined yourself as a discoverer of the world you should have already notice that that feeling will cause wrong neurons in your brain to get exited, wrong because you will start relating that feeling with the one of ignoration, and as you have seen throught relations of mathematical equations you must have already discovered that this world is all about relations, but you haven't!(you will not get it, as i do, words are not enough), your brain has set a common reaction, a way of thinking and as you do whatever of the things you do you will still be the same, thats a natural way of reacting by our human desing and you must discover how can you change that to continue that natural reaction of sensing(the senses) and making it more sensible.
What if i told you i know how to do it, i don't, maybe i will, MUAAHAHAHAHAHAUHUHUHUHU!!!! bye.


#4911868 stream output to vertex buffer (not working as it should)

Posted by lomateron on 10 February 2012 - 09:34 PM

.


PARTNERS