2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
support this shader
#390978
01/06/12 16:57
01/06/12 16:57
|
Joined: Jul 2011
Posts: 39
Giti
OP
Newbie
|
OP
Newbie
Joined: Jul 2011
Posts: 39
|
hi. please help me for support this PPS in a8:' http://developer.download.nvidia.com/shaderlibrary/packages/post_shadow_overlay.fx.zip
/*********************************************************************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.
Last edited by Giti; 01/07/12 14:32.
|
|
|
Re: support this shader
[Re: Giti]
#391039
01/07/12 08:19
01/07/12 08:19
|
Joined: Jul 2011
Posts: 39
Giti
OP
Newbie
|
OP
Newbie
Joined: Jul 2011
Posts: 39
|
for stars , for flowers , for ocean , for crysis , for alpacino , for all games of the world ,for yourself , for god ! please help.
Last edited by Giti; 01/07/12 08:36.
|
|
|
Re: support this shader
[Re: Giti]
#391040
01/07/12 08:25
01/07/12 08:25
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
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?
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: support this shader
[Re: JibbSmart]
#391041
01/07/12 08:31
01/07/12 08:31
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
I would trust nvidia.com to some degree, however, a screenshot and code would be nice. Agreed.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: support this shader
[Re: WretchedSid]
#391043
01/07/12 08:45
01/07/12 08:45
|
Joined: Jul 2011
Posts: 39
Giti
OP
Newbie
|
OP
Newbie
Joined: Jul 2011
Posts: 39
|
|
|
|
Re: support this shader
[Re: 3run]
#391315
01/10/12 15:27
01/10/12 15:27
|
Joined: Jul 2011
Posts: 39
Giti
OP
Newbie
|
OP
Newbie
Joined: Jul 2011
Posts: 39
|
|
|
|
|