Sign in to follow this  

effect scripts

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i try to use the effect framework to render my geometry. I want to clear my render target within an effect file. In the documentation, there is an example of that. They use annotated scripts with standard semantics. This doen't seem to work. The script isn't running automaticaly. Do i have to get the script and parse its content ? cheers, atem Here is my script file: float4 MyClearColor = float4(0.0, 1.0, 1.0, 0.0); float Version : StandardsGlobal < string Script = "ClearSetColor = MyClearColor;" "ClearSetDepth = 1.0;" "Clear = Depth;" "Technique = T0;"; > = 0.8; technique T0 < string Script = "Pass = P0;"; > { pass P0 { VertexShader = null; PixelShader = null; ColorWriteEnable = 0; ZEnable = true; } }

Share this post


Link to post
Share on other sites
***Hola, you have to compile da effect file using d3dx utils:

LPD3DXEFFECT m_pEffect; // D3DX effect interface
DWORD dwShaderFlags = 0; //shader flags

HRESULT hr = D3DXCreateEffectFromFile(g_pd3dDevice, "test.fx", NULL, NULL, dwShaderFlags, NULL, &m_pEffect, NULL );

***next u've to set and execute all passes in your render loop:

D3DXHANDLE m_hTechniqueRenderScene;

//choose technique
m_hTechniqueRenderScene = m_pEffect->GetTechniqueByName( "technique_name" );
//set it up!!!
m_pEffect->SetTechnique( m_hTechniqueRenderScene );

***and do all the passes:

m_pEffect->Begin(&cPasses, 0);
for (iPass = 0; iPass < cPasses; iPass++)
{
if ( SUCCEEDED( m_pEffect->BeginPass(iPass) ) )
{
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, nTris );
m_pEffect->EndPass();
}
}
m_pEffect->End();

*** this should help execute your effect file ;)
*** greets !!

Share this post


Link to post
Share on other sites
Hi guiseppe,

i am already doing the application sequence you described.
This processes the pass P0 of my effect file. This is not
enough, because i want the effect file to clear my render target. Which is written in StandardsGlobal annotation of the effect file. As i understand the directx documentation, the script command in StandardsGlobal annotation should be processes before any pass is run. Which is not happening automaticaly. My render target is kept uncleared.
My question is, how can i force directx to process my script which is defined in the annotation ?

cheers,

atem

Share this post


Link to post
Share on other sites
I've never used annotations. But I'd say the only thing they do is provide additional information for the application using the effect. In the example the clearing of the render target is probably implemented in the application and the

string Script = "ClearSetColor = MyClearColor;"
"ClearSetDepth = 1.0;"

stuff is nothing more then a set of parameters.

But maybe there's some cool build in 'scripting language' in .fx files I have totally overlooked until now?

Share this post


Link to post
Share on other sites
wolfgangw,

that's right. In one part of the documentation annotations seems to be just additional information for the application.
In an other part, it reads, like there are standard global annotations which are processed by the effect framework.
But it is not working realdy.

Does anybody know a good documentation for effect files except of the directx documentation ?

regards,

atem

Share this post


Link to post
Share on other sites

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this