Jump to content
  • Advertisement
Sign in to follow this  
GENTS

NVDIA Effect Files & RenderTarget

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

RENDERCOLORTARGET, RENDERDEPTHSTENCILTARGET, Render-to-Texture Data, etc. How is possible to manage all these parts within an effect file (.fx) and with which source code could I manage them?! THANKS for help ^__^ Byez, [Edited by - GENTS on February 21, 2005 5:23:09 PM]

Share this post


Link to post
Share on other sites
Advertisement
I'm trying to do something similar to DXSAS code of NVDIA SDK 8.5!

I'm trying to coding in C++ a class to manage al effects, but I've several problems with scene and post effects files 'cause of renderTarget or DepthBufferTarget and similar...

So how could I manage them?!

THANKS ^__^

Share this post


Link to post
Share on other sites
No one has an idea how could I get these effects to works and how to use RenderTarget or DepthBufferTarget?!

Thanks ^__^

Share this post


Link to post
Share on other sites
[lol] Rendertargets and such usually aren't dealt with inside effects, because effects should be independent of render targets. They don't care what they render to - all they care about is outputting that pixel, wherever it may be.

In essence, there is a lot more to shaders than just the effect files themselves. You have render states that need to be set, render targets, pre-rendering steps, post-rendering steps, constant setting, ect... You need to develop an abstract class which you can inherit all of your specific shaders from. This way, you have a general interface to each shader, but each shader can do specific things, in turn.

For example:


class IShader
{
private:
ID3DXEffect* effect;

public:

virtual HRESULT BeginShader() = 0;
virtual HRESULT EndShader() = 0;
virtual HRESULT SetupForEntity( IEntity* entityIn ) = 0;
};


The problem in itself is very complicated, and there are many solutions/interpretations of it. Personally, I like doing it this way because I can easily create shaders that require additional processing on the engine-side. For example, a water shader may require additional properties to be calculated and setup.

Share this post


Link to post
Share on other sites
I've seen that inside NVDIA effects there is this type of code:


technique Glow_9Tap
<
string ScriptClass = "scene";
string ScriptOrder = "postprocess";
string ScriptOutput = "color";
string Script =
"ClearSetColor=ClearColor;"
"ClearSetDepth=ClearDepth;"
"Clear=Color;"
"Clear=Depth;"
"RenderColorTarget0=GlowMap1;"
"RenderDepthStencilTarget=DepthBuffer;"
"ClearSetColor=ClearColor;"
"ClearSetDepth=ClearDepth;"
"Clear=Color;"
"Clear=Depth;"
"ScriptExternal=color;"

"Pass=BlurGlowBuffer_Horz;"

"Pass=BlurGlowBuffer_Vert;"

"Pass=GlowPass;";
>
{
pass BlurGlowBuffer_Horz
<
string Script ="RenderColorTarget0=GlowMap2;"
"Draw=Buffer;";
>
{
cullmode = none;
ZEnable = false;
VertexShader = compile vs_2_0 VS_Quad_Horizontal_9tap();
PixelShader = compile ps_2_0 PS_Blur_Horizontal_9tap();
}
pass BlurGlowBuffer_Vert
<
string Script = "RenderColorTarget0=GlowMap1;"
"Draw=Buffer;";
>
{
cullmode = none;
ZEnable = false;
VertexShader = compile vs_2_0 VS_Quad_Vertical_9tap();
PixelShader = compile ps_2_0 PS_Blur_Vertical_9tap();
}
pass GlowPass
<
string Script= "RenderColorTarget0=;"
"RenderDepthStencilTarget=;"
"ScriptExternal=color;"
"Draw=Buffer;";
>
{
cullmode = none;
ZEnable = false;
ZWriteEnable = false;
AlphaBlendEnable = true;
SrcBlend = one;
DestBlend = one;
VertexShader = compile vs_1_1 VS_Quad();
PixelShader = compile ps_2_0 PS_GlowPass();
}
}


Is it setting RenderTargets, etc, isn't it?!

I know how to made a class with virtual function in it, but I'm trying to setting in general these parameters as "RenderColorTarget0=GlowMap1;" or "RenderDepthStencilTarget=DepthBuffer;"... How is possible to set them?! I'm trying to do it not only within an effect but in general with DirectX... Is there any tutorial or any article on this topic?! How could I set these target?!

THANKS A LOT!

Share this post


Link to post
Share on other sites
AFAIK, all of that script stuff is NVIDIA-indepdent (ie it only is implemented for FX Composer). I couldn't really find anything about those individual tags in the DXSAS reference. If you want to implement something like that, you are probably going to have to parse all of those keys and values manually.

Are you asking how to setup different rendertargets? That is pretty easy - you can either use ID3DXRenderToSurface or IDirect3DDevice9::SetRenderTarget().

Share this post


Link to post
Share on other sites
I thought that I've to parse these commands if I want to create a sort of NVDIA Effect Framework...
I don't know how to use these commands in DirectX and which are their equivalent functions...

I've seen at C# source code of DXSAS Implementation example of NVDIA SDK 8.5, but I can't get out how to create an equivalent code in C++...

Is it possible?! Which functions should I use?!

THANKS A LOT!!!

Byez,

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!