NVDIA Effect Files & RenderTarget

Started by
13 comments, last by circlesoft 19 years, 1 month ago
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]
----------------------------------------------- - GENTS -"Every man dies, not every man really lives"[William Wallace] - visit my website: GENTS.it -- Using Effect files with DirectX 9 Basics Tutorial -- MilkShape 3D models and OpenGL ES Tutorial -
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 ^__^
----------------------------------------------- - GENTS -"Every man dies, not every man really lives"[William Wallace] - visit my website: GENTS.it -- Using Effect files with DirectX 9 Basics Tutorial -- MilkShape 3D models and OpenGL ES Tutorial -
No one has an idea how could I get these effects to works and how to use RenderTarget or DepthBufferTarget?!

Thanks ^__^
----------------------------------------------- - GENTS -"Every man dies, not every man really lives"[William Wallace] - visit my website: GENTS.it -- Using Effect files with DirectX 9 Basics Tutorial -- MilkShape 3D models and OpenGL ES Tutorial -
Or... where is possible to find some tutorials or similar articles?!

THANKS ^__^
----------------------------------------------- - GENTS -"Every man dies, not every man really lives"[William Wallace] - visit my website: GENTS.it -- Using Effect files with DirectX 9 Basics Tutorial -- MilkShape 3D models and OpenGL ES Tutorial -
no one?!
----------------------------------------------- - GENTS -"Every man dies, not every man really lives"[William Wallace] - visit my website: GENTS.it -- Using Effect files with DirectX 9 Basics Tutorial -- MilkShape 3D models and OpenGL ES Tutorial -
[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.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
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!
----------------------------------------------- - GENTS -"Every man dies, not every man really lives"[William Wallace] - visit my website: GENTS.it -- Using Effect files with DirectX 9 Basics Tutorial -- MilkShape 3D models and OpenGL ES Tutorial -
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().
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
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,
----------------------------------------------- - GENTS -"Every man dies, not every man really lives"[William Wallace] - visit my website: GENTS.it -- Using Effect files with DirectX 9 Basics Tutorial -- MilkShape 3D models and OpenGL ES Tutorial -
no ideas or no possibilities?!

THANKS
----------------------------------------------- - GENTS -"Every man dies, not every man really lives"[William Wallace] - visit my website: GENTS.it -- Using Effect files with DirectX 9 Basics Tutorial -- MilkShape 3D models and OpenGL ES Tutorial -

This topic is closed to new replies.

Advertisement