dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

probleema ar .fx :(
Goto page 1, 2  Next
 
dev.gamez.lv Forum Index -> Microsoft DirectX
View previous topic :: View next topic  
Author Message
dawchiks



Joined: 03 Jan 2007
Posts: 37
Location: Rīga

PostPosted: Sat Feb 10, 2007 9:47 pm    Post subject: probleema ar .fx :(

karo4 man izmet dont send erroru ja es proveeju k-ko dariit ar shaderiem,
reku mans render()

Code:

void Render()
{
   g_pd3dDevice->Clear(0,NULL,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,10),1.0f,0);
   
   D3DXMATRIX matScale;
   D3DXMatrixScaling(&matScale,1.0f,1.0f,1.0f);
   g_pd3dDevice->SetTransform(D3DTS_WORLD,&matScale);
   D3DXVECTOR3 vEyePt(0.0f,5.0f,-6.0f);
   D3DXVECTOR3 vLookAt(0.0f,2.0f,0.0f);
   D3DXVECTOR3 vUpVec(0.0f,1.0f,0.0f);
   D3DXMATRIXA16 matView;
   D3DXMatrixLookAtLH(&matView,&vEyePt,&vLookAt,&vUpVec);
   g_pd3dDevice->SetTransform(D3DTS_VIEW,&matView);
   D3DXMATRIXA16 matProj;
   D3DXMatrixPerspectiveFovLH(&matProj,D3DX_PI/4,1.33333333f,1.0f,144.0f);
   g_pd3dDevice->SetTransform(D3DTS_PROJECTION, &matProj);
   D3DXCreateEffectFromFile(g_pd3dDevice,"material.fx",NULL,NULL,dwShaderFlags,NULL,&g_pEffect,NULL);

 UINT cPasses,iPass;
   if(SUCCEEDED(g_pd3dDevice->BeginScene()))
{

   g_pEffect->SetMatrix("g_matView",&matProj);
   g_pEffect->SetTechnique("AmbientLight");
   g_pEffect->Begin(&cPasses,0);
   for(iPass = 0;iPass<cPasses;iPass++)
   {
      g_pEffect->BeginPass(iPass);
      pods->DrawSubset(0);
        g_pEffect->EndPass();
      g_pEffect->End();   
   }
   }
   g_pd3dDevice->EndScene();
   g_pd3dDevice->Present(NULL,NULL,NULL,NULL);
}
taads kods man izmet 'dont send'.

bet ja es nokomenteeju dazas vietas
Code:

//g_pEffect->SetMatrix("g_matView",&matProj);
//g_pEffect->SetTechnique("AmbientLight");
//g_pEffect->Begin(&cPasses,0);
//for(iPass = 0;iPass<cPasses;iPass++)
//g_pEffect->BeginPass(iPass);
// g_pEffect->EndPass();
//g_pEffect->End();   



tad protams straadaa, takaa nekur citur man nav probleemas.pls help Razz[/quote]
Back to top
View user's profile MSN Messenger
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Sat Feb 10, 2007 9:59 pm    Post subject:

kas tas veel par dont send erroru?
_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
dawchiks



Joined: 03 Jan 2007
Posts: 37
Location: Rīga

PostPosted: Sat Feb 10, 2007 10:06 pm    Post subject:

nu taads ir...

shader.exe encountered a problem, and needs to be closed.
+ veel kautkaads bezjeedziigs teksts.

un apaksaa ir 2 pogas
1. Send error report
2. Dont Send


ja kas es lietoju sitaadu shaaderi -
Code:

float4x4 g_matView;

struct VS_OUTPUT {
float4 Position : POSITION;



};

struct VS_IN
{
float4 Position : POSITION;
};

VS_OUTPUT AmbientVS (VS_IN In) {
VS_OUTPUT Out = (VS_OUTPUT) 0;
Out.Position = mul (In.Position,g_matView);
return Out;
}

float4 PS() : COLOR
{
float4 Acolor = {1.0,0.15,0.15,1.0};
float Aintensity = 0.5;
return  Aintensity * Acolor;
}

technique AmbientLight
{
pass P0
{
VertexShader = compile vs_1_1 AmbientVS();
PixelShader = compile ps_1_1 PS();
}
}



pfff.. ko es daru nepareizi?
Back to top
View user's profile MSN Messenger
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Sat Feb 10, 2007 10:17 pm    Post subject:

pirms renderesanas parbaudi vai g_pEffect != NULL

iespejams vienkarsi ka tev videokarte neatbalsta seiderus un liidz ar to arii nenokompilee fx failu.

Kada videokarte?


p.s. un tas ir mazliet stulbi kompileet sheiderus katraa kadraa, freimreits buus baigi zemais
_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
dawchiks



Joined: 03 Jan 2007
Posts: 37
Location: Rīga

PostPosted: Sat Feb 10, 2007 10:27 pm    Post subject:

tas pofig kur es vinus kompileeju, pectames saliktu visu ka vajag.
g_pEffect !=NULL;


video GF6600, un 100% atbalsa 1.1 shāderi :)



ok labi bija g_pEffect = NULL; bet ja es pielieku to "!" tad saka -
missing ';' before '!='
Back to top
View user's profile MSN Messenger
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Sat Feb 10, 2007 10:33 pm    Post subject:

grrr..

peec->
D3DXCreateEffectFromFile(g_pd3dDevice,"material.fx",NULL,NULL,dwShaderFlags,NULL,&g_pEffect,NULL);

veic paarbaudi

if(g_pEffect!=NULL) {

... ... rendere savu scenu

}
else {
.. error shaderis ir 0
}
_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
dawchiks



Joined: 03 Jan 2007
Posts: 37
Location: Rīga

PostPosted: Sat Feb 10, 2007 10:36 pm    Post subject:

OK ir porbleema akal -

man ir funkcija
Code:

void effekts(void)
{
   HRESULT hr;
   hr = D3DXCreateEffectFromFile(g_pd3dDevice,"material.fx",NULL,NULL,0,NULL,&g_pEffect,NULL);
   if(FAILED(hr))
   {
      MessageBox(NULL,"PSC. Errors, jo nezinamu iemeslu\n del nevareja ieladet shaderi","Baigais Errors",MB_OK|MB_ICONEXCLAMATION);
   WM_DESTROY;
   }
}

tur prikola pec ieliku "if(FAILED(hr)) utt" komandu, izraadaas ka pa tiešaam vins hvz kapeec neielaadee shaaderi, jo man izmet erroru.
un protams vel parbaudot g_pEffect ir 0.
Back to top
View user's profile MSN Messenger
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Sat Feb 10, 2007 11:21 pm    Post subject:

pedejais fukcijas D3DXCreateEffectFromFile parametrs atgriez kompilaciajs kluudu aprakstus, palasi dokumentaaciju kaa lietot
_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
dawchiks



Joined: 03 Jan 2007
Posts: 37
Location: Rīga

PostPosted: Sat Feb 10, 2007 11:25 pm    Post subject:

tikko izdariiju kluuda ir - kautkaadi 3 ķeburi. :(

pareizaak - a burts ar ķeksi virs taa/ kvadraats/un A burts Sad
Back to top
View user's profile MSN Messenger
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Sat Feb 10, 2007 11:27 pm    Post subject:

nu baac tiek atgriezts pointeris uz ID3DXBuffer

lai dabutu aaraa to stringu ko vajag lieto GetBufferPointer
palasi tacu dokumetaaciju un tad keries pie kkaa klaat

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Summer_04/directx/graphics/reference/d3dx/interfaces/id3dxbuffer/_id3dxbuffer.asp
_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
dawchiks



Joined: 03 Jan 2007
Posts: 37
Location: Rīga

PostPosted: Sat Feb 10, 2007 11:44 pm    Post subject:

oj izdzeesu savu iepriekseejo postu, karo4 vaina ir shaderii.,... :P

pareizaak
šeit ir vaina
Code:

PixelShader  = compile ps_1_1 AmbientPS();



nja, tas shaderis ko nolaadeeju no http://indago.gamez.lv/Izstradataji/Raksti/hlsl_gaisma/HLSL_apgaismojums.htm
man nestraadaa.. a citi straadaa... Smile
Back to top
View user's profile MSN Messenger
dawchiks



Joined: 03 Jan 2007
Posts: 37
Location: Rīga

PostPosted: Sun Feb 11, 2007 1:15 pm    Post subject:

a kas vareetu buut par vainu, ka man ja hlsl shaaderii pie
technique ir
Code:
pixelShader = compile ps_1_1 PS();
tad programma met error ka nevar ielaadeet shaderi, a ja es nokomenteeju to rindu
Code:
 //   PixelShader  = compile ps_1_1 PS();
tad viss iet,.,,. a kapee taa? :(


eem man taaa PS funkcija tikai uzliek kraasu modelim, bez apgaismojuma, bez nekaa. a vajag veel kautko c++ defineet saistibaa ar shaaderi, iznemot setMatrix? es ar shaderiem esmu n00b...
Back to top
View user's profile MSN Messenger
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Sun Feb 11, 2007 8:24 pm    Post subject:

tapec ka tev kluuda pixel saderii , ja vins nekompilejas
_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
dawchiks



Joined: 03 Jan 2007
Posts: 37
Location: Rīga

PostPosted: Mon Feb 12, 2007 6:13 pm    Post subject:

da kautvai no http://indago.gamez.lv/Izstradataji/Raksti/hlsl_gaisma/HLSL_apgaismojums.htm
noka4aaju, tas ar neiet, bet dazi citi iet, taa jau viss buutu OK,
ja vien man kautko raadiitu,. jo kad es ateru savu .exe man raadaas melns ekraans.... protams ja nokomentee visu kas saistiits ar shader tad jau iet protams, un raada visus objektus.

ahh...


ok ar FX composer ka es uzlieku effektu uz kaada objekta objekts kluust neredzams.... hmmm.... :)



eem, ja man shaderis prosta ir šitaads -
Code:

// An empty material, which simply transforms the vertex and sets the color to white.

//------------------------------------
float4x4 matWVP : WorldViewProjection;

//------------------------------------
struct vertexInput {
    float3 Position   : POSITION;
};

struct vertexOutput {
    float4 HPosition : POSITION;
    float4 Diffuse : COLOR0;
};

//------------------------------------
vertexOutput VS_TransformDiffuse(vertexInput IN)
{
    vertexOutput OUT;
    OUT.HPosition = mul( float4(IN.Position.xyz , 1.0) , matWVP);
    OUT.Diffuse = float4(1.0f, 0.0f,1.0f,1.0f);
    return OUT;
}

//-----------------------------------
technique textured
{
    pass p0
    {      
      VertexShader = compile vs_1_1 VS_TransformDiffuse();
      
      // Just use the color
      ColorArg1[0] = Diffuse;
      AlphaArg1[0] = Diffuse;
      ColorOp[0] = SelectArg1;
      AlphaOp[1] = SelectArg1;
    }
}



kas man buutu veel jaaraksta iekš c++?
nu visi tie settechnique, begin, beginPass ir, un g_pEffect->SetMatrix("MatWVP",&matView); arii ir. kas veel jaaliek?
Back to top
View user's profile MSN Messenger
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Mon Feb 12, 2007 7:32 pm    Post subject:

dawchiks wrote:


ok ar FX composer ka es uzlieku effektu uz kaada objekta objekts kluust neredzams.... hmmm.... Smile


ja neiet nekas no originalajiem fx composer sampljiem, tad tev videokarte neatbalsta seiderus, bet taa kaa tu teici ka tev GF6600, tad
!!Paarliecinies vai tev ir normals draivers uzinstaleets!!


tavaa noraadiitajaa shadera kodaa nemaz nav pixelshadera, ir tikai vertex sheideris. bet ieprieks tu tur mineji

PixelShader = compile ps_1_1 AmbientPS();

es kaut kaa neredzu kodaa pixel sheideri vispaar :D

krc es nezinu ko tu tur dari, atrod kaut kaadu step by step tutorialu.
_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
Display posts from previous:   
dev.gamez.lv Forum Index -> Microsoft DirectX All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group