Files
UnrealEngineUWP/Engine/Shaders/VectorFieldVisualizationVertexFactory.usf
Andrew Grant 98ee5066e7 Copying //UE4/Orion-Staging to //UE4/Main (Origin //Orion/Dev-General @ 2861092)
#lockdown Nick.Penwarden

==========================
MAJOR FEATURES + CHANGES
==========================

Change 2861045 on 2016/02/09 by Marcus.Wassmer

	Fix debug editor crash from async compute creating commands when it shouldn't.
	#rb none
	#test debug editor

Change 2861030 on 2016/02/09 by Michael.Noland

	Engine: Added support for debugging safe zones (visualization on any platform and simulation on platforms that don't natively provide safe zone information)

	r.DebugSafeZone.Mode controls the debug visualization overlay (0..2, default 0)
	- 0: Do not display the safe zone overlay
	- 1: Display the overlay for the title safe zone
	- 2: Display the overlay for the action safe zone

	r.DebugSafeZone.OverlayAlpha controls how opaque the debug visualization overlay is (0..1, default 0.3)

	On platforms that don't natively support safe zones, you can simulate a safe zone for quick/easy testing in the editor:
	- r.DebugSafeZone.TitleRatio controls the title safe zone margins returned in FDisplayMetrics
	- r.DebugActionZone.ActionRatio controls the action safe zone margins returned in FDisplayMetrics
	- These both range from 0..1, and default to 1 indicating 100% of the display is safe. A typical test value would be 0.9

	#codereview josh.adams
	#rb marcus.wassmer
	#tests Tested on Win64 uncooked and PS4 cooked (front-end and game)

Change 2860923 on 2016/02/09 by Andrew.Grant

	Fix client warning about HTTPChunkInstaller module not existing
	#rb none
	#tests ran Win64 client

Change 2860852 on 2016/02/09 by Daniel.Wright

	Fixed crash enabling capsule direct shadows in BP
	#rb Nick.Penwarden
	#tests Editor

Change 2860842 on 2016/02/09 by Marcus.Wassmer

	MallocLeakDetection proxy
	#rb Steve.Robb
	#test PS4/PC testing all commands.

Change 2860744 on 2016/02/09 by Josh.Markiewicz

	#UE4 - fixed possible crash when refresh auth with invalid response
	#rb sam.zamani
	#tests login flow
	#codereview justin.sargent, joe.wilcox, pter.knepley, ben.zeigler

Change 2860739 on 2016/02/09 by Laurent.Delayen

	Sync Markers
	- Reset SyncGroups every frame.
	- ::GetSyncGroupPosition() makes sure there is a valid MarkerSyncContext.

	=> Fixes SyncGroup returning 'valid' positions for TransitionLeaders that were not in between sync markers.

	#rb martin.wilson
	#codereview lina.halper
	#tests new riftmage and kurohane networked in PIE

Change 2860736 on 2016/02/09 by Daniel.Lamb

	Fixed issue with iterative cook on the fly invalidating cooked content all the time.
	#rb Marcus.Wassmer
	#test Cook on the fly iterative ps4

Change 2860598 on 2016/02/09 by Joe.Graf

	Simple log category change to match existing log messages in LoadMap

	#rb: n/a
	#test: loading, cooking, game

Change 2860559 on 2016/02/09 by Zak.Middleton

	#orion - Add flag to AIController to control whether it copies the Pawn rotation to ControlRotation if there is no focus point.

	#rb Lukasz.Furman
	#tests PIE ded server AI with lanes

Change 2860462 on 2016/02/09 by Marc.Audy

	Build system improvements
	* Added details to Empty manifest file save error
	* Removed redundent pseudo-dependencies from -showdependency output
	* Monolithic Kinds now a set and branch hacker can specify kind not to build
	#rb Ben.Marsh
	#tests Preflight

Change 2860434 on 2016/02/09 by David.Ratti

	NaN checks:
	-Targeting mode checks in orion code
	-Changed the AActor::SetTransform NaN check so that the logging is included in the NaN ensure (rather than getting cut off from the log afterwards).

	#rb FrankG
	#tests golden path vs bots

Change 2860390 on 2016/02/09 by Michael.Trepka

	Adjust 3D rendering resolution so that it stays approximately the same when user switches display modes

	#rb none
	#tests Tested editor build on PC

Change 2860364 on 2016/02/09 by Justin.Sargent

	Removed unused editor-only functions causing compiler errors when compiling the game.

	#rb keli
	#tests none

Change 2860242 on 2016/02/09 by Justin.Sargent

	Made a number of DialogueWave quality of life improvements to the editor and specifically SoundCue editing.

	New right-click option on SoundWaves to create a DialogueWave

[CL 2863630 by Andrew Grant in Main branch]
2016-02-11 14:39:50 -05:00

192 lines
6.4 KiB
Plaintext

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
VectorFieldVisualizationVertexFactory.usf: Vertex factory for GPU simulated particles.
=============================================================================*/
#define PARTICLE_SPRITE_FACTORY 1
#include "VertexFactoryCommon.usf"
/** Texture containing the vector field. */
Texture3D VectorFieldTexture;
SamplerState VectorFieldTextureSampler;
/**
* Vertex attributes to fetch.
*/
struct FVertexFactoryInput
{
/** Unique vertex ID. */
uint VertexId : SV_VertexID;
/** Unique instance ID. */
uint InstanceId : SV_InstanceID;
};
/**
* Attributes to interpolate from the vertex shader to the pixel shader.
*/
struct FVertexFactoryInterpolantsVSToPS
{
/** Dummy value to interpolate. */
float2 DummyTexCoord : TEXCOORD0;
#if INSTANCED_STEREO
nointerpolation uint PackedEyeIndex : PACKED_EYE_INDEX;
#endif
};
/**
* Intermediate values computed in the vertex shader.
*/
struct FVertexFactoryIntermediates
{
/** Dummy value. */
float4 WorldPosition;
};
/**
* Computes intermediates for the given vertex.
* @param Input - Vertex attributes.
* @returns the computed intermediate values.
*/
FVertexFactoryIntermediates GetVertexFactoryIntermediates( FVertexFactoryInput Input )
{
// Determine how to index in to the volume texture.
const float3 VoxelSize = VectorFieldVis.VoxelSize.xyz;
const float3 HalfVoxelOffset = VoxelSize.xyz * 0.5f;
const float3 VoxelMultipliers = float3(1, VoxelSize.x, VoxelSize.x * VoxelSize.y);
const float3 VoxelIndex = floor(float3(GetLayerInstanceID(Input.InstanceId).xxx) * VoxelMultipliers.xyz);
const float3 VoxelUV = frac(VoxelIndex.xyz * VoxelSize.xyz) + HalfVoxelOffset;
// Read vector for this voxel.
const float3 Force = Texture3DSampleLevel(VectorFieldTexture, VectorFieldTextureSampler, VoxelUV, 0).xyz;
const float ForceScale = min(length(Force) * VectorFieldVis.Scale, 10.0f);
const float3 Vec = normalize(Force) * ForceScale;
// The base position for this vector.
const float3 BasePosition = mul(float4(VoxelUV.xyz,1), VectorFieldVis.VolumeToWorld).xyz - ResolvedView.WorldCameraOrigin;
const float3 Position = BasePosition + float(Input.VertexId) *
mul(float4(Vec,0), VectorFieldVis.VolumeToWorldNoScale).xyz;
// Build and return the set of intermediates.
FVertexFactoryIntermediates Intermediates;
Intermediates.WorldPosition = float4(Position.xyz,1);
return Intermediates;
}
/**
* Computes material parameterss for a given pixel.
* @param Interpolants - Attributes interpolated from the vertex shader.
* @returns per-pixel material parameters.
*/
FMaterialPixelParameters GetMaterialPixelParameters( FVertexFactoryInterpolantsVSToPS Interpolants, float4 SvPosition )
{
// GetMaterialPixelParameters is responsible for fully initializing the result
FMaterialPixelParameters Result = MakeInitializedMaterialPixelParameters();
// Note that a non-zero texture coordinate is used to prevent the compiler
// from optimizing out texture lookups that can cause mandatory requirements
// to not be bound.
#if NUM_MATERIAL_TEXCOORDS
UNROLL
for(int CoordinateIndex = 0;CoordinateIndex < NUM_MATERIAL_TEXCOORDS;CoordinateIndex++)
{
Result.TexCoords[CoordinateIndex] = Interpolants.DummyTexCoord;
}
#endif //NUM_MATERIAL_TEXCOORDS
Result.VertexColor = 1;
Result.TwoSidedSign = 1;
return Result;
}
/**
* Computes material parameters for a given vertex.
* @param Input - Attributes for this vertex.
* @param Intermediates - Intermediates computed for this vertex.
* @param WorldPosition - The position of this vertex in world space.
* @param TangentToLocal - The tangent basis for this vertex.
* @returns per-vertex material parameters.
*/
FMaterialVertexParameters GetMaterialVertexParameters(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 WorldPosition, float3x3 TangentToLocal)
{
FMaterialVertexParameters Result = (FMaterialVertexParameters)0;
Result.WorldPosition = WorldPosition;
Result.VertexColor = float4(1,1,1,1);
Result.TangentToWorld = mul(TangentToLocal, GetLocalToWorld3x3());
return Result;
}
/**
* Computes the world space position of this vertex.
* @param Input - Vertex attributes.
* @param Intermediates - Intermediates computed for this vertex.
* @returns the position of this vertex in world space.
*/
float4 VertexFactoryGetWorldPosition( FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates )
{
return Intermediates.WorldPosition;
}
float4 VertexFactoryGetRasterizedWorldPosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float4 TranslatedWorldPosition)
{
return TranslatedWorldPosition;
}
float3 VertexFactoryGetPositionForVertexLighting(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, float3 TranslatedWorldPosition)
{
return TranslatedWorldPosition;
}
/**
* Constructs values that need to be interpolated from the vertex shader to the pixel shader.
* @param Input - Vertex attributes.
* @param Intermediates - Intermediates computed for this vertex.
* @returns interpolants.
*/
FVertexFactoryInterpolantsVSToPS VertexFactoryGetInterpolantsVSToPS( FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates, FMaterialVertexParameters VertexParameters )
{
FVertexFactoryInterpolantsVSToPS Interpolants;
Interpolants.DummyTexCoord = float2(0,0);
#if INSTANCED_STEREO
Interpolants.PackedEyeIndex = 0;
#endif
return Interpolants;
}
/**
* Computes the position of this vertex last frame in world space.
* @param Input - Vertex attributes.
* @param Intermediates - Intermediates computed for this vertex.
* @returns the previous position of this vertex in world space.
*/
float4 VertexFactoryGetPreviousWorldPosition( FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates )
{
return Intermediates.WorldPosition;
}
/**
* Computes the tangent basis for this vertex in world space.
* @param Input - Vertex attributes.
* @param Intermediates - Intermediates computed for this vertex.
* @returns the tangent basis for this vertex in world space.
*/
float3x3 VertexFactoryGetTangentToLocal( FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates )
{
float3x3 TangentToLocal;
TangentToLocal[0] = float3(1,0,0);
TangentToLocal[1] = float3(0,1,0);
TangentToLocal[2] = float3(0,0,1);
return TangentToLocal;
}
#if INSTANCED_STEREO
uint VertexFactoryGetEyeIndex(uint InstanceId)
{
return 0;
}
#endif