support this shader

Posted By: Giti

support this shader - 01/06/12 16:57

hi.
please help me for support this PPS in a8:'
http://developer.download.nvidia.com/shaderlibrary/packages/post_shadow_overlay.fx.zip



Code:
/*********************************************************************NVMH3****
*******************************************************************************
$Revision: #4 $

Copyright NVIDIA Corporation 2008
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY
LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

% Shadow-map for all geometry thats overlaid on white and composited.
% This trick provides simple shadowing across multiple materials without
% editing their shaders. The downsides are incorrect shadowing of with
% transparency and
% objects that are lit by multiple lights


To learn more about shading, shaders, and to bounce ideas off other shader
    authors and users, visit the NVIDIA Shader Library Forums at:

    http://developer.nvidia.com/forums/

*******************************************************************************
******************************************************************************/

/*****************************************************************/
/*** HOST APPLICATION IDENTIFIERS ********************************/
/*** Potentially predefined by varying host environments *********/
/*****************************************************************/

// #define _XSI_		/* predefined when running in XSI */
// #define TORQUE		/* predefined in TGEA 1.7 and up */
// #define _3DSMAX_		/* predefined in 3DS Max */
#ifdef _3DSMAX_
int ParamID = 0x0003;		/* Used by Max to select the correct parser */
#endif /* _3DSMAX_ */
#ifdef _XSI_
#define Main Static		/* Technique name used for export to XNA */
#endif /* _XSI_ */

#ifndef FXCOMPOSER_VERSION	/* for very old versions */
#define FXCOMPOSER_VERSION 180
#endif /* FXCOMPOSER_VERSION */

#ifndef DIRECT3D_VERSION
#define DIRECT3D_VERSION 0x900
#endif /* DIRECT3D_VERSION */

#define FLIP_TEXTURE_Y	/* Different in OpenGL & DirectX */

/*****************************************************************/
/*** EFFECT-SPECIFIC CODE BEGINS HERE ****************************/
/*****************************************************************/

/******* Lighting Macros *******/
/** To use "Object-Space" lighting definitions, change these two macros: **/
#define LIGHT_COORDS "World"
// #define OBJECT_SPACE_LIGHTS /* Define if LIGHT_COORDS is "Object" */

#define MAX_SHADOW_BIAS 0.01

#include <include\\shadowMap.fxh>

float Script : STANDARDSGLOBAL <
    string UIWidget = "none";
    string ScriptClass = "scene";
    string ScriptOrder = "postprocess";
    string ScriptOutput = "color";
    string Script = "Technique=Main;";
> = 0.8;

// color and depth used for full-screen clears

float4 gClearColor <
    string UIWidget = "Color";
    string UIName = "Background";
> = {0,0,0,0};

float gClearDepth <string UIWidget = "none";> = 1.0;

float4 gShadowClearColor <
	string UIWidget = "none";
> = {1,1,1,0.0};

/**** UNTWEAKABLES: Hidden & Automatically-Tracked Parameters **********/

// transform object vertices to world-space:
float4x4 gWorldXf : World < string UIWidget="None"; >;
// transform object normals, tangents, & binormals to world-space:
float4x4 gWorldITXf : WorldInverseTranspose < string UIWidget="None"; >;
// transform object vertices to view space and project them in perspective:
float4x4 gWvpXf : WorldViewProjection < string UIWidget="None"; >;
// provide tranform from "view" or "eye" coords back to world-space:
float4x4 gViewIXf : ViewInverse < string UIWidget="None"; >;

DECLARE_SHADOW_XFORMS("SpotLight0",LampViewXf,LampProjXf,gShadowViewProjXf)
DECLARE_SHADOW_BIAS
DECLARE_SHADOW_MAPS(ColorShadMap,ColorShadSampler,ShadDepthTarget,ShadDepthSampler)

DECLARE_QUAD_TEX(gSceneTexture,gSceneSampler,"A8R8G8B8")
DECLARE_QUAD_DEPTH_BUFFER(DepthBuffer,"D24S8")

float3 gSpotLamp0Pos : POSITION <
    string Object = "SpotLight0";
    string UIName =  "Lamp 0 Position";
    string Space = (LIGHT_COORDS);
> = {-0.5f,2.0f,1.25f};

float gSDensity <
    string UIWidget = "slider";
    float UIMin = 0.0;
    float UIMax = 1.0;
    float UIStep = 0.001;
    string UIName = "Shadow Density";
> = 1.0;

//////////////////////////////////////////////////////////////////////////
// Struct ////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

struct ApplyShadVertexOut {
    float4 HPosition	: POSITION;
    float4 BgUV		: TEXCOORD0;
    float4 LProj	: TEXCOORD1;	// light-projection space
};

////////////////////////////////////////////////////////////////////////////
/// SHADER CODE BEGINS /////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////

//
// reduced version of "shadowUseVS()" from shadowMapHeader -- no light vector
//   is calculated because we don't need it in this case
//

ApplyShadVertexOut applyShadowVS(ShadowAppData IN,
		uniform float4x4 WorldXform,
		uniform float4x4 WorldITXform,
		uniform float4x4 WVPXform,
		uniform float4x4 ShadowVPXform,
		uniform float4x4 ViewIXform,
		uniform float4x4 BiasXform)
{
    ApplyShadVertexOut OUT = (ApplyShadVertexOut)0;
    float4 Po = float4(IN.Position.xyz,(float)1.0);	// "P" in object coords
    float4 Pw = mul(Po,WorldXform);		// "P" in world coordinates
    float4 Pl = mul(Pw,ShadowVPXform);  // "P" in light coords
    //OUT.LProj = Pl;			// ...for pixel-shader shadow calcs
    OUT.LProj = mul(Pl,BiasXform);		// bias to make texcoord
    //
    float4 hpos = mul(Po,WVPXform);	// screen clipspace coords
    OUT.HPosition = hpos;
    OUT.BgUV = hpos;
    return OUT;
}

/*********************************************************/
/*********** pixel shader ********************************/
/*********************************************************/

float4 applyShadowPS(ApplyShadVertexOut IN,
		    uniform sampler2D SceneSampler,
		    uniform float SDensity
) : COLOR
{
    float shadowed = tex2Dproj(ShadDepthSampler,IN.LProj).x;
    shadowed = 1.0 - (SDensity*(1.0-shadowed));
    float2 sp = 0.5 * float2(IN.BgUV.x/IN.BgUV.w,IN.BgUV.y/IN.BgUV.w);
    sp += float2(0.5,0.5);
    sp.y = 1.0 - sp.y;
    float4 BgColor = tex2D(SceneSampler,sp);
    return float4(shadowed*BgColor.rgb,BgColor.a);
}

///////////////////////////////////////
/// TECHNIQUES ////////////////////////
///////////////////////////////////////




technique Main <
    string Script =
	"RenderColorTarget0=gSceneTexture;"
	"RenderDepthStencilTarget=DepthBuffer;"
	"ClearSetColor=gClearColor;"
	"ClearSetDepth=gClearDepth;"
	    "Clear=Color;"
	    "Clear=Depth;"
	"ScriptExternal=color;"
	"Pass=MakeShadow;"
	"Pass=UseShadow;";
> {
    pass MakeShadow <
	string Script = "RenderColorTarget0=ColorShadMap;"
			"RenderDepthStencilTarget=ShadDepthTarget;"
			"RenderPort=SpotLight0;"
			"ClearSetColor=gShadowClearColor;"
			"ClearSetDepth=gClearDepth;"
			"Clear=Color;"
			"Clear=Depth;"
			"Draw=geometry;";
    > {
	    VertexShader = compile vs_3_0 shadowGenVS(gWorldXf,
				    gWorldITXf, gShadowViewProjXf);
		ZEnable = true;
		ZWriteEnable = true;
		ZFunc = LessEqual;
		AlphaBlendEnable = false;
		CullMode = None;
	    // no pixel shader!
    }
    pass UseShadow <
	    string Script = "RenderColorTarget0=;"
			    "RenderDepthStencilTarget=;"
			    "RenderPort=;"
			    "ClearSetColor=gClearColor;"
			    "ClearSetDepth=gClearDepth;"
			    "Clear=Color;"
			    "Clear=Depth;"
			    "Draw=geometry;";
    > {
	VertexShader = compile vs_3_0 applyShadowVS(gWorldXf,
				    gWorldITXf, gWvpXf, gShadowViewProjXf,
				    gViewIXf, gShadBiasXf);
		ZEnable = true;
		ZWriteEnable = true;
		ZFunc = LessEqual;
		AlphaBlendEnable = false;
		CullMode = None;
	PixelShader = compile ps_3_0 applyShadowPS(gSceneSampler,gSDensity);

    }
}


/***************************** eof ***/



it is : post shadow overlay.
nvidia:Shadow-map for all geometry thats overlaid on white and composited. This trick provides simple shadowing across multiple materials without editing their shaders. The downsides are incorrect shadowing of with transparency and objects that are lit by multiple lights (1 technique/s)
and i want to use it in A8.

i mean is : What changes do I need to work?
please show me in code.
Posted By: Giti

Re: support this shader - 01/07/12 08:19

for stars , for flowers , for ocean , for crysis , for alpacino , for all games of the world ,for yourself , for god !
please help.


Posted By: JibbSmart

Re: support this shader - 01/07/12 08:25

I don't think anyone wants to click on a download link for a zip file they know nothing about. How about you include some screenshots, or a description, or something we can just look at safely in our browser?
Posted By: WretchedSid

Re: support this shader - 01/07/12 08:31

I would trust nvidia.com to some degree, however, a screenshot and code would be nice. Agreed.
Posted By: Giti

Re: support this shader - 01/07/12 08:45

ok i changed it.
Posted By: 3run

Re: support this shader - 01/07/12 10:21

Sorry, but what you've changed?
Posted By: Giti

Re: support this shader - 01/07/12 12:09

no i mean is add the screenshot and description.

i want to use this shader in a8. please help.
Posted By: 3run

Re: support this shader - 01/07/12 12:40

Post the .fx file here mate, that way it'll be easier for users to help you.
I wish I could help you with this myself, but I don't know anything about shaders stuff.
Posted By: Giti

Re: support this shader - 01/10/12 15:27

please help.
Posted By: Giti

Re: support this shader - 01/10/12 16:40

ok guys.
Let me ask the question another way.
I felt that those of my posts are upset.
I'm really searching questions. And here I found a place for answers.
I ask this question here is not true. imagine that my questions to ask about this engine in other places.
Yes, I do not know how shader. But I do not want to learn shader programming. All I ask is this:

Please help me:
How to support written and ready shaders , to A8 engine?

Perhaps a little explanation about the alternative.

tanx.
Posted By: Carlos3DGS

Re: support this shader - 01/11/12 23:31

Sorry but I don't understand half of the senteces you wrote. Mabe you could get someone that speaks english to help you explain what you want so we can understand you better.
Where are you from? If you are spanish I might be able to understand you in your native language (I speak spanish just as good as I speak english). If you are from somewhere else, mabe there is someone on the forum that understands that language.

Just a little advice though. Judging from similar threads I have seen on the forum in the past, the experienced users that could help you usually don't like people just spamming "help".
Also if I understood you correctly you do not know nor want learn how to fix the shader. To me (and probably many others) that means you are not really asking us to help you achieve your goal, what you are really saying is "do it for me".

Unless you are offering a paid job, I recommend you to show you are actually willing to learn and participate in what you want to achieve, or else it is unlikely you will get much help.

A couple months ago I knew absolutely nothing about shaders. I did ask for help on the forum for a randomized terrain shader and was pointed to the shader tutorials. I went through the tutorials, asked alot of questions and got involved (to the degree I could) in the process of creating that specific shader. Most of the shader got done for me, but I learned alot about shaders and vector math along the way. Most importantly though, I learned enough about shaders to modify and piece together other shaders, and even start creating my own. Now I am using shaders in ways I didn't know were possible, have created another 5, got help in another shader project, and am currently working on a fairly complex one (at least for my level of experience with shaders).

My point is, if you really want to learn, this forum is one of the best (or possibly the very best) there is. And you will benefit greatly from getting involved and making an effort to learn. If you just want someone to "do it for you" you will rarely get people interested and will always remain dependant on others for everything (which is never good if you actually want to get something done).

I hope I don't come across as annoying or insulting since that is not my intention. This is just some advice that I feel will benefit you greatly. I wish you luck on your project, and offer my help to learn how shaders work if you are interested in working on it.
© 2024 lite-C Forums