本文整理汇总了C++中GetPixelShader函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPixelShader函数的具体用法?C++ GetPixelShader怎么用?C++ GetPixelShader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPixelShader函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SetParameters
void SetParameters(FRHICommandList& RHICmdList, const FViewInfo& View, FLightShaftsOutput LightShaftsOutput)
{
FGlobalShader::SetParameters(RHICmdList, GetPixelShader(), View);
SceneTextureParameters.Set(RHICmdList, GetPixelShader(), View);
ExponentialParameters.Set(RHICmdList, GetPixelShader(), &View);
if (LightShaftsOutput.bRendered)
{
SetTextureParameter(
RHICmdList,
GetPixelShader(),
OcclusionTexture, OcclusionSampler,
TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
LightShaftsOutput.LightShaftOcclusion->GetRenderTargetItem().ShaderResourceTexture
);
}
else
{
SetTextureParameter(
RHICmdList,
GetPixelShader(),
OcclusionTexture, OcclusionSampler,
TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
GWhiteTexture->TextureRHI
);
}
}
开发者ID:johndpope,项目名称:UE4,代码行数:27,代码来源:FogRendering.cpp
示例2: SetTextureParameter
void FSimpleElementPS::SetParameters(const FTexture* TextureValue)
{
SetTextureParameter(GetPixelShader(),InTexture,InTextureSampler,TextureValue);
SetShaderValue(GetPixelShader(),TextureComponentReplicate,TextureValue->bGreyScaleFormat ? FLinearColor(1,0,0,0) : FLinearColor(0,0,0,0));
SetShaderValue(GetPixelShader(),TextureComponentReplicateAlpha,TextureValue->bGreyScaleFormat ? FLinearColor(1,0,0,0) : FLinearColor(0,0,0,1));
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:7,代码来源:SimpleElementShaders.cpp
示例3: SetParameters
/** Sets shader parameter values */
void SetParameters(FRHICommandList& RHICmdList, const FLightSceneInfo* LightSceneInfo, const FViewInfo& View, int32 PassIndex, TRefCountPtr<IPooledRenderTarget>& PassSource)
{
FGlobalShader::SetParameters(RHICmdList, GetPixelShader(), View);
LightShaftParameters.SetParameters(RHICmdList, GetPixelShader(), LightSceneInfo, View, PassSource);
const FVector4 Parameters(GLightShaftBlurNumSamples, GLightShaftFirstPassDistance, PassIndex);
SetShaderValue(RHICmdList, GetPixelShader(), RadialBlurParameters, Parameters);
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:9,代码来源:LightShaftRendering.cpp
示例4: SetTextureParameter
void FCubemapTexturePropertiesPS<bHDROutput>::SetParameters( FRHICommandList& RHICmdList, const FTexture* Texture, const FMatrix& ColorWeightsValue, float MipLevel, float GammaValue )
{
SetTextureParameter(RHICmdList, GetPixelShader(),CubeTexture,CubeTextureSampler,Texture);
FVector4 PackedProperties0Value(MipLevel, 0, 0, 0);
SetShaderValue(RHICmdList, GetPixelShader(), PackedProperties0, PackedProperties0Value);
SetShaderValue(RHICmdList, GetPixelShader(), ColorWeights, ColorWeightsValue);
SetShaderValue(RHICmdList, GetPixelShader(), Gamma, GammaValue);
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:9,代码来源:CubemapUnwrapUtils.cpp
示例5: SetShaderValue
/**
* Sets all the constant parameters for this shader
*
* @param Texture - 2d tile texture
* @param Gamma - if gamma != 1.0 then a pow(color,Gamma) is applied
* @param ClipRef - reference value to compare with alpha for killing pixels
* @param SmoothWidth - The width to smooth the edge the texture
* @param EnableShadow - Toggles drop shadow rendering
* @param ShadowDirection - 2D vector specifying the direction of shadow
* @param ShadowColor - Color of the shadowed pixels
* @param ShadowSmoothWidth - The width to smooth the edge the shadow of the texture
* @param BlendMode - current batched element blend mode being rendered
*/
void FSimpleElementDistanceFieldGammaPS::SetParameters(
const FTexture* Texture,
float Gamma,
float ClipRef,
float SmoothWidthValue,
bool EnableShadowValue,
const FVector2D& ShadowDirectionValue,
const FLinearColor& ShadowColorValue,
float ShadowSmoothWidthValue,
const FDepthFieldGlowInfo& GlowInfo,
ESimpleElementBlendMode BlendMode
)
{
FSimpleElementMaskedGammaPS::SetParameters(Texture,Gamma,ClipRef,BlendMode);
SetShaderValue(GetPixelShader(),SmoothWidth,SmoothWidthValue);
SetPixelShaderBool(GetPixelShader(),EnableShadow,EnableShadowValue);
if (EnableShadowValue)
{
SetShaderValue(GetPixelShader(),ShadowDirection,ShadowDirectionValue);
SetShaderValue(GetPixelShader(),ShadowColor,ShadowColorValue);
SetShaderValue(GetPixelShader(),ShadowSmoothWidth,ShadowSmoothWidthValue);
}
SetPixelShaderBool(GetPixelShader(),EnableGlow,GlowInfo.bEnableGlow);
if (GlowInfo.bEnableGlow)
{
SetShaderValue(GetPixelShader(),GlowColor,GlowInfo.GlowColor);
SetShaderValue(GetPixelShader(),GlowOuterRadius,GlowInfo.GlowOuterRadius);
SetShaderValue(GetPixelShader(),GlowInnerRadius,GlowInfo.GlowInnerRadius);
}
// This shader does not use editor compositing
SetEditorCompositingParameters( NULL, FTexture2DRHIRef() );
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:46,代码来源:SimpleElementShaders.cpp
示例6: SetParameters
void SetParameters(FRHICommandList& RHICmdList, int32 SourceMipIndexValue, FTextureRHIRef& SourceTextureValue)
{
SetShaderValue(RHICmdList, GetPixelShader(), SourceMipIndex, SourceMipIndexValue);
SetTextureParameter(
RHICmdList,
GetPixelShader(),
SourceTexture,
SourceTextureSampler,
TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI(),
SourceTextureValue);
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:12,代码来源:ReflectionEnvironmentDiffuseIrradiance.cpp
示例7: SetParameters
void SetParameters(FRHICommandList& RHICmdList, const FSceneView& View, const FMaterialRenderProxy* MaterialProxy, const FDeferredDecalProxy& DecalProxy, const float FadeAlphaValue=1.0f)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FMaterialShader::SetParameters(RHICmdList, ShaderRHI, MaterialProxy, *MaterialProxy->GetMaterial(View.GetFeatureLevel()), View, true, ESceneRenderTargetsMode::SetTextures);
FTransform ComponentTrans = DecalProxy.ComponentTrans;
FMatrix WorldToComponent = ComponentTrans.ToInverseMatrixWithScale();
// Set the transform from screen space to light space.
if(ScreenToDecal.IsBound())
{
const FMatrix ScreenToDecalValue =
FMatrix(
FPlane(1,0,0,0),
FPlane(0,1,0,0),
FPlane(0,0,View.ViewMatrices.ProjMatrix.M[2][2],1),
FPlane(0,0,View.ViewMatrices.ProjMatrix.M[3][2],0)
) * View.InvViewProjectionMatrix * WorldToComponent;
SetShaderValue(RHICmdList, ShaderRHI, ScreenToDecal, ScreenToDecalValue);
}
// Set the transform from light space to world space
if(DecalToWorld.IsBound())
{
const FMatrix DecalToWorldValue = ComponentTrans.ToMatrixWithScale();
SetShaderValue(RHICmdList, ShaderRHI, DecalToWorld, DecalToWorldValue);
}
SetShaderValue(RHICmdList, ShaderRHI, FadeAlpha, FadeAlphaValue);
SetShaderValue(RHICmdList, ShaderRHI, WorldToDecal, WorldToComponent);
}
开发者ID:magetron,项目名称:UnrealEngine4-mod,代码行数:35,代码来源:DecalRenderingShared.cpp
示例8: SetParameters
void SetParameters(FRHICommandList& RHICmdList, const FViewInfo& View)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(RHICmdList, ShaderRHI, View );
FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(RHICmdList);
const FIntPoint GBufferSize = SceneContext.GetBufferSizeXY();
const FVector2D InvSize( 1.0f / float(GBufferSize.X), 1.0f / float(GBufferSize.Y) );
const FVector4 InputUvFactorAndOffset (
float(2 * View.HZBMipmap0Size.X) / float(GBufferSize.X),
float(2 * View.HZBMipmap0Size.Y) / float(GBufferSize.Y),
float(View.ViewRect.Min.X) / float(GBufferSize.X),
float(View.ViewRect.Min.Y) / float(GBufferSize.Y)
);
const FVector2D InputViewportMaxBound (
float(View.ViewRect.Max.X) / float(GBufferSize.X) - 0.5f * InvSize.X,
float(View.ViewRect.Max.Y) / float(GBufferSize.Y) - 0.5f * InvSize.Y
);
SetShaderValue(RHICmdList, ShaderRHI, InvSizeParameter, InvSize );
SetShaderValue(RHICmdList, ShaderRHI, InputUvFactorAndOffsetParameter, InputUvFactorAndOffset );
SetShaderValue(RHICmdList, ShaderRHI, InputViewportMaxBoundParameter, InputViewportMaxBound );
SceneTextureParameters.Set(RHICmdList, ShaderRHI, View );
}
开发者ID:dineshone,项目名称:UnrealGameEngine,代码行数:25,代码来源:SceneOcclusion.cpp
示例9: SetParameters
void SetParameters(
#if LPV_VOLUME_TEXTURE
FTextureRHIParamRef* LpvBufferSRVsIn,
#else
FShaderResourceViewRHIParamRef LpvBufferSRVIn,
#endif
FLpvReadUniformBufferRef LpvUniformBuffer,
const FRenderingCompositePassContext& Context )
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
SetUniformBufferParameter( ShaderRHI, GetUniformBufferParameter<FLpvReadUniformBufferParameters>(), LpvUniformBuffer );
#if LPV_VOLUME_TEXTURE
for ( int i=0; i<7; i++ )
{
if ( LpvBufferSRVParameters[i].IsBound() )
{
RHISetShaderTexture( ShaderRHI, LpvBufferSRVParameters[i].GetBaseIndex(), LpvBufferSRVsIn[i] );
SetTextureParameter( ShaderRHI, LpvBufferSRVParameters[i], LpvVolumeTextureSampler, TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(), LpvBufferSRVsIn[i] );
}
}
#else
if ( LpvBufferSRV.IsBound() )
{
RHISetShaderResourceViewParameter( ShaderRHI, LpvBufferSRV.GetBaseIndex(), LpvBufferSRVIn );
}
#endif
FGlobalShader::SetParameters(ShaderRHI, Context.View);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());
DeferredParameters.Set(ShaderRHI, Context.View);
SetTextureParameter( ShaderRHI, PreIntegratedGF, PreIntegratedGFSampler, TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(), GSystemTextures.PreintegratedGF->GetRenderTargetItem().ShaderResourceTexture );
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:34,代码来源:PostProcessLpvIndirect.cpp
示例10: SetParameters
void SetParameters(
FTextureRHIParamRef* LpvBufferSRVsIn,
FTextureRHIParamRef AOVolumeTextureSRVIn,
FLpvReadUniformBufferRef LpvUniformBuffer,
const FRenderingCompositePassContext& Context )
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
SetUniformBufferParameter(Context.RHICmdList, ShaderRHI, GetUniformBufferParameter<FLpvReadUniformBufferParameters>(), LpvUniformBuffer);
for ( int i=0; i<7; i++ )
{
if ( LpvBufferSRVParameters[i].IsBound() )
{
Context.RHICmdList.SetShaderTexture(ShaderRHI, LpvBufferSRVParameters[i].GetBaseIndex(), LpvBufferSRVsIn[i]);
SetTextureParameter(Context.RHICmdList, ShaderRHI, LpvBufferSRVParameters[i], LpvVolumeTextureSampler, TStaticSamplerState<SF_Bilinear, AM_Border, AM_Border, AM_Border>::GetRHI(), LpvBufferSRVsIn[i]);
}
}
if ( AOVolumeTextureSRVParameter.IsBound() )
{
Context.RHICmdList.SetShaderTexture(ShaderRHI, AOVolumeTextureSRVParameter.GetBaseIndex(), AOVolumeTextureSRVIn );
}
FGlobalShader::SetParameters(Context.RHICmdList, ShaderRHI, Context.View);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI());
DeferredParameters.Set(Context.RHICmdList, ShaderRHI, Context.View);
SetTextureParameter(Context.RHICmdList, ShaderRHI, PreIntegratedGF, PreIntegratedGFSampler, TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI(), GSystemTextures.PreintegratedGF->GetRenderTargetItem().ShaderResourceTexture);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:28,代码来源:PostProcessLpvIndirect.cpp
示例11: GetPixelShader
void FSlateMaterialShaderPS::SetParameters(FRHICommandList& RHICmdList, const FSceneView& View, const FMaterialRenderProxy* MaterialRenderProxy, const FMaterial* Material, float InDisplayGamma, const FVector4& InShaderParams )
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
EBlendMode BlendMode = Material->GetBlendMode();
switch (BlendMode)
{
default:
case BLEND_Opaque:
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
break;
case BLEND_Masked:
RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
break;
case BLEND_Translucent:
RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_SourceAlpha, BF_InverseSourceAlpha, BO_Add, BF_Zero, BF_InverseSourceAlpha>::GetRHI());
break;
case BLEND_Additive:
// Add to the existing scene color
RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_One, BF_One, BO_Add, BF_Zero, BF_InverseSourceAlpha>::GetRHI());
break;
case BLEND_Modulate:
// Modulate with the existing scene color
RHICmdList.SetBlendState(TStaticBlendState<CW_RGB, BO_Add, BF_DestColor, BF_Zero>::GetRHI());
break;
};
SetShaderValue( RHICmdList, ShaderRHI, DisplayGamma, InDisplayGamma );
SetShaderValue( RHICmdList, ShaderRHI, ShaderParams, InShaderParams );
const bool bDeferredPass = false;
FMaterialShader::SetParameters<FPixelShaderRHIParamRef>(RHICmdList, ShaderRHI, MaterialRenderProxy, *Material, View, bDeferredPass, ESceneRenderTargetsMode::SetTextures);
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:35,代码来源:SlateMaterialShader.cpp
示例12: GetPixelShader
void FIESLightProfilePS::SetParameters( FRHICommandList& RHICmdList, const FTexture* Texture, float InBrightnessInLumens )
{
FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
SetTextureParameter(RHICmdList, ShaderRHI, IESTexture, IESTextureSampler, Texture);
SetShaderValue(RHICmdList, ShaderRHI, BrightnessInLumens, InBrightnessInLumens);
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:7,代码来源:CubemapUnwrapUtils.cpp
示例13: SetParameters
void SetParameters(const FRenderingCompositePassContext& Context)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(Context.RHICmdList, ShaderRHI, Context.View);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Bilinear,AM_Border,AM_Border,AM_Border>::GetRHI());
}
开发者ID:johndpope,项目名称:UE4,代码行数:7,代码来源:PostProcessBloomSetup.cpp
示例14: SetParameters
void SetParameters(const FSceneView& View)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(ShaderRHI, View);
DeferredParameters.Set(ShaderRHI, View);
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:7,代码来源:PostProcessDeferredDecals.cpp
示例15: SetParameters
void SetParameters(FRHICommandList& RHICmdList, const FRenderingCompositePassContext& Context, const FMaterialRenderProxy* Material )
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FMaterialShader::SetParameters(RHICmdList, ShaderRHI, Material, *Material->GetMaterial(Context.View.GetFeatureLevel()), Context.View, true, ESceneRenderTargetsMode::SetTextures);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:7,代码来源:PostProcessMaterial.cpp
示例16: SetPS
void SetPS(const FRenderingCompositePassContext& Context, FIntRect SrcRect, FIntPoint SrcBufferSize, EStereoscopicPass StereoPass, FMatrix& QuadTexTransform)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(Context.RHICmdList, ShaderRHI, Context.View);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());
DeferredParameters.Set(Context.RHICmdList, ShaderRHI, Context.View);
{
check(GEngine->HMDDevice.IsValid());
TSharedPtr< class IHeadMountedDisplay > HMDDevice = GEngine->HMDDevice;
check (StereoPass != eSSP_FULL);
if (StereoPass == eSSP_LEFT_EYE)
{
FTexture* TextureLeft = HMDDevice->GetDistortionTextureLeft();
SetTextureParameter(Context.RHICmdList, ShaderRHI, DistortionTextureParam, DistortionTextureSampler, TextureLeft->SamplerStateRHI, TextureLeft->TextureRHI);
SetShaderValue(Context.RHICmdList, ShaderRHI, TextureScale, HMDDevice->GetTextureScaleLeft());
SetShaderValue(Context.RHICmdList, ShaderRHI, TextureOffset, HMDDevice->GetTextureOffsetLeft());
SetShaderValue(Context.RHICmdList, ShaderRHI, TextureUVOffset, 0.0f);
}
else
{
FTexture* TextureRight = HMDDevice->GetDistortionTextureRight();
SetTextureParameter(Context.RHICmdList, ShaderRHI, DistortionTextureParam, DistortionTextureSampler, TextureRight->SamplerStateRHI, TextureRight->TextureRHI);
SetShaderValue(Context.RHICmdList, ShaderRHI, TextureScale, HMDDevice->GetTextureScaleRight());
SetShaderValue(Context.RHICmdList, ShaderRHI, TextureOffset, HMDDevice->GetTextureOffsetRight());
SetShaderValue(Context.RHICmdList, ShaderRHI, TextureUVOffset, -0.5f);
}
QuadTexTransform = FMatrix::Identity;
}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:34,代码来源:PostProcessMorpheus.cpp
示例17: SetPS
void SetPS(const FRenderingCompositePassContext& Context, uint32 LoopSizeValue)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(Context.RHICmdList, ShaderRHI, Context.View);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());
SetShaderValue(Context.RHICmdList, ShaderRHI, LoopSize, LoopSizeValue);
if(EyeAdaptationTexture.IsBound())
{
if (Context.View.HasValidEyeAdaptation())
{
IPooledRenderTarget* EyeAdaptationRT = Context.View.GetEyeAdaptation();
SetTextureParameter(Context.RHICmdList, ShaderRHI, EyeAdaptationTexture, EyeAdaptationRT->GetRenderTargetItem().TargetableTexture);
}
else
{
// some views don't have a state, thumbnail rendering?
SetTextureParameter(Context.RHICmdList, ShaderRHI, EyeAdaptationTexture, GWhiteTexture->TextureRHI);
}
}
// todo
FVector4 EyeAdapationTemporalParamsValue(0, 0, 0, 0);
SetShaderValue(Context.RHICmdList, ShaderRHI, EyeAdapationTemporalParams, EyeAdapationTemporalParamsValue);
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:28,代码来源:PostProcessHistogramReduce.cpp
示例18: SetParameters
void SetParameters(const FRenderingCompositePassContext& Context)
{
const FFinalPostProcessSettings& Settings = Context.View.FinalPostProcessSettings;
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(Context.RHICmdList, ShaderRHI, Context.View);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI());
DeferredParameters.Set(Context.RHICmdList, ShaderRHI, Context.View);
{
float MaxRoughness = FMath::Clamp(Context.View.FinalPostProcessSettings.ScreenSpaceReflectionMaxRoughness, 0.01f, 1.0f);
// f(x) = x * Scale + Bias
// f(MaxRoughness) = 0
// f(MaxRoughness/2) = 1
float RoughnessMaskScale = -2.0f / MaxRoughness;
RoughnessMaskScale *= SSRQuality < 3 ? 2.0f : 1.0f;
FLinearColor Value(
FMath::Clamp(Context.View.FinalPostProcessSettings.ScreenSpaceReflectionIntensity * 0.01f, 0.0f, 1.0f),
RoughnessMaskScale,
0,
0);
SetShaderValue(Context.RHICmdList, ShaderRHI, SSRParams, Value);
}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:29,代码来源:ScreenSpaceReflections.cpp
示例19: SetParameters
void SetParameters(const FRenderingCompositePassContext& Context)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(ShaderRHI, Context.View);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());
{
const float SizeX = Context.View.ViewRect.Width();
const float SizeY = Context.View.ViewRect.Height();
const float InvAspectRatio = SizeY / SizeX;
const FSceneViewState* ViewState = (FSceneViewState*) Context.View.State;
const float MotionBlurTimeScale = ViewState ? ViewState->MotionBlurTimeScale : 1.0f;
const float ViewMotionBlurScale = 0.5f * MotionBlurTimeScale * Context.View.FinalPostProcessSettings.MotionBlurAmount;
// 0:no 1:full screen width
float MaxVelocity = Context.View.FinalPostProcessSettings.MotionBlurMax / 100.0f;
float InvMaxVelocity = 1.0f / MaxVelocity;
float ObjectScaleX = ViewMotionBlurScale * InvMaxVelocity;
float ObjectScaleY = ViewMotionBlurScale * InvMaxVelocity * InvAspectRatio;
SetShaderValue( ShaderRHI, VelocityScale, FVector4( ObjectScaleX, -ObjectScaleY, 0, 0 ) );
}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:27,代码来源:PostProcessMotionBlur.cpp
示例20: SetPS
void SetPS(const FRenderingCompositePassContext& Context)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(ShaderRHI, Context.View);
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.GPUBusyWait"));
uint32 PixelCount = Context.View.ViewRect.Size().X * Context.View.ViewRect.Size().Y;
float CVarValue = FMath::Clamp(CVar->GetValueOnRenderThread(), 0.0f, 500.0f);
// multiply with large number to get more human friendly number range
// calibrated on a NV580 to be roughly a millisecond
// divide by viewport pixel count
uint32 Value = (uint32)(CVarValue * 1000000000.0 / 6.12 / PixelCount);
SetShaderValue(ShaderRHI, GPUBusyWait, Value);
}
#endif
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:25,代码来源:PostProcessBusyWait.cpp
注:本文中的GetPixelShader函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论