Commit Graph

20 Commits

Author SHA1 Message Date
Jeremy Moore
2cb1820437 Remove INVARIANT from passes that don't need to be precise
#fyi krzysztof.narkowicz
#preflight 62742e33ca0ad32a96896145

[CL 20076319 by Jeremy Moore in ue5-main branch]
2022-05-06 11:14:05 -04:00
Ben Ingram
14ea9b00e5 Merging Dev-LWCRendering into Main, this includes initial work to support rendering with LWC-scale position
Basic approach is to add HLSL types FLWCScalar, FLWCMatrix, FLWCVector, etc.  Inside shaders, absolute world space position values should be represented as FLWCVector3.  Matrices that transform *into* absolute world space become FLWCMatrix.  Matrices that transform *from* world space become FLWCInverseMatrix.  Generally LWC values work by extending the regular 'float' value with an additional tile coordinate.  Final tile size will be a trade-off between scale/accuracy; I'm using 256k for now, but may need to be adjusted.  Value represented by a FLWCVector thus becomes V.Tile * TileSize + V.Offset.  Most operations can be performed directly on LWC values.  There are HLSL functions like LWCAdd, LWCSub, LWCMultiply, LWCDivide (operator overloading would be really nice here).  The goal is to stay with LWC values for as long as needed, then convert to regular float values when possible.  One thing that comes up a lot is working in translated (rather than absolute) world space.  WorldSpace + View.PrevPreViewTranslation = TranslatedWorldspace.  Except 'View.PrevPreViewTranslation' is now a FLWCVector3, and WorldSpace quantities should be as well.  So that becomes LWCAdd(WorldSpace, View.PrevPreViewTranslation) = TranslatedWorldspace.  Assuming that we're talking about a position that's "reasonably close" to the camera, it should be safe to convert the translated WS value to float.  The 'tile' coordinate of the 2 LWC values should cancel out when added together in this case.  I've done some work throughout the shader code to do this.  Materials are fully supporting LWC-values as well.  Projective texturing and vertex animation materials that I've tested work correctly even when positioned "far away" from the origin.

Lots of work remains to fully convert all of our shader code.  There's a function LWCHackToFloat(), which is a simple wrapper for LWCToFloat().  The idea of HackToFloat is to mark places that need further attention, where I'm simply converting absolute WS positions to float, to get shaders to compile.  Shaders converted in this way should continue to work for all existing content (without LWC-scale values), but they will break if positions get too large.

General overview of changed files:
LargeWorldCoordinates.ush - This defines the FLWC types and operations
GPUScene.cpp, SceneData.ush - Primitives add an extra 'float3' tile coordinate.  Instance data is unchanged, so instances need to stay within single-precision range of the primitive origin.  Could potentially split instances behind the scenes (I think) if we don't want this limitation
HLSLMaterialDerivativeAutogen.cpp, HLSLMaterialTranslator.cpp, Preshader.cpp - Translated materials to use LWC values
SceneView.cpp, SceneRelativeViewMatrices.cpp, ShaderCompiler.cpp, InstancedStereo.ush - View uniform buffer includes LWC values where appropriate
#jira UE-117101
#rb arne.schober, Michael.Galetzka

[CL 17787435 by Ben Ingram in ue5-main branch]
2021-10-12 13:29:45 -04:00
yangke li
1731093fe0 Add a Mobile friendly RVT MaterialType BaseColor_Normal_Roughness with basecolor in RT0, NormalXY and roughness in RT1, NormalZ is considered always a positive number( which is the situation for local space normal)
Add A  flag bUseLowQualityCompression to BaseColor_Normal_Roughness, which fakes compression by 16bit format(RGB565)

#rb Dmitriy.Dyomin

[CL 16977982 by yangke li in ue5-main branch]
2021-07-27 22:06:06 -04:00
Jeremy Moore
b581f50658 Set the IS_VIRTUAL_TEXTURE_MATERIAL define in Runtime Virtual Texture rendering.
Makes everything compatible with new shader generation work.
#rb John.Hable

[CL 14561854 by Jeremy Moore in ue5-main branch]
2020-10-23 15:56:17 -04:00
Marc Audy
4c1bb11c29 Merge UE5/Release-Engine-Staging to UE5/Main @ 14548662
This represents UE4/Main @ 14525125 + cherrypicked fixes
#skipundocheck

[CL 14551026 by Marc Audy in ue5-main branch]
2020-10-22 19:19:16 -04:00
john hable
5f3ff39aed First major checkin for flexible GBuffer.
#rb kevin.ortegren, arciel.rekman

[CL 14547614 by john hable in ue5-main branch]
2020-10-22 14:41:45 -04:00
Michal Valient
95d19f95b1 [REVERB] Merging //UE4/Private-Reverb-Development@13832732
#rb graham.wihlidal, rune.stubbe, brian.karis, andrew.lauritzen, jeff.farris

[CL 13834854 by Michal Valient in ue5-main branch]
2020-07-06 18:58:26 -04:00
jeremy moore
8d944d513c Runtime virtual texture world height packing now depends on the volume extents.
Fixes precision issues raised by a number of licensees (for example UDN558460).
#jira none
#rb none

#ROBOMERGE-SOURCE: CL 12237042 in //UE4/Release-4.25/... via CL 12237054
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v664-12234175)

[CL 12239488 by jeremy moore in Main branch]
2020-03-17 23:19:30 -04:00
Marc Audy
360d078ca3 Second batch of remaining Engine copyright updates.
#rnx
#rb none

[CL 10871248 by Marc Audy in Main branch]
2019-12-27 09:26:59 -05:00
jeremy moore
926e22dac5 Add new RVT format: BaseColor_Normal_Specular_Mask_YCoCg
This adds an aditional 8 bit "mask" channel for generic use in RVT materials.
[FYI] Robert.Osborne


#ROBOMERGE-SOURCE: CL 10376418 via CL 10376623 via CL 10376632
#ROBOMERGE-BOT: (v594-10333955)

[CL 10377559 by jeremy moore in Main branch]
2019-11-22 14:27:37 -05:00
jeremy moore
86fcbf3980 Remove unused runtime virtual texture formats
Default to world space normals when writing to virtual texture through standard material attributes
Will require shader change for impacted materials, but almost all of our current VT materials use the VT output node and so are unaffected
This is necessary ground work for channel selection when writing to runtime virtual textures


#ROBOMERGE-SOURCE: CL 9746080 via CL 9746836 via CL 9747019
#ROBOMERGE-BOT: (v542-9736015)

[CL 9747167 by jeremy moore in Main branch]
2019-10-22 13:18:38 -04:00
jeremy moore
a992d139f5 Fix for rendering of 16bit height on platforms where output RT needs specifying in shader compile
Also touch the relevant shader to force recompile
#jira
[CODEREVIEW] Mickael.Gilabert


#ROBOMERGE-SOURCE: CL 9449112 via CL 9449598 via CL 9449613 via CL 9450296 via CL 9450439
#ROBOMERGE-BOT: (v495-9448618)

[CL 9452131 by jeremy moore in Main branch]
2019-10-07 13:39:30 -04:00
Marcus Wassmer
6517c68ef5 Copying //UE4/Dev-RenderPlat-Staging@8684824 to Dev-Main (//UE4/Dev-Main)
#rb none

[CL 8684840 by Marcus Wassmer in Main branch]
2019-09-14 09:45:25 -04:00
jeremy moore
6aaada744e Touch shader which needs recompile for tests to pass
#ROBOMERGE-SOURCE: CL 8658957 via CL 8667400
#ROBOMERGE-BOT: (v417-8656536)

[CL 8668547 by jeremy moore in Main branch]
2019-09-12 20:16:54 -04:00
jeremy moore
dbe8b70d6f Support sign of Normal Z in [BC3|BC3] runtime virtual texture format
This allows storage of world space normals if required
[FYI] Robert.Osborne


#ROBOMERGE-SOURCE: CL 8433385 via CL 8441057
#ROBOMERGE-BOT: (v404-8404397)

[CL 8443191 by jeremy moore in Main branch]
2019-09-03 18:44:16 -04:00
jeremy moore
c8436fc306 Use 2xBC3 textures for BaseColor+Normal+Specular runtime virtual texture
Better normal quality then BC1+BC3
Old layout kept for now in a deprecated enum. Will probably remove after any comparisons are carried out.


#ROBOMERGE-SOURCE: CL 8288591 via CL 8288894
#ROBOMERGE-BOT: (v401-8057353)

[CL 8288898 by jeremy moore in Main branch]
2019-08-25 17:04:30 -04:00
jeremy moore
67ce261d84 Making RuntimeVirtualTextureRender.h public so that it can be called by incoming thumbnail and baking systems
Add very simple debug shading mode to runtime virtual texture
Will extend to other modes later


#ROBOMERGE-SOURCE: CL 8126086 via CL 8131842
#ROBOMERGE-BOT: (v401-8057353)

[CL 8156543 by jeremy moore in Main branch]
2019-08-21 08:42:06 -04:00
jeremy moore
632ab01e8e Add WorldHeight layer type to Runtime Virtual Texture
#ROBOMERGE-SOURCE: CL 7933374 via CL 7938581
#ROBOMERGE-BOT: (v391-7919777)

[CL 7938765 by jeremy moore in Main branch]
2019-08-09 20:17:44 -04:00
jeremy moore
540f456b67 #jira UE-76356
Remove unused height pins from RVT material nodes
Change default name of RuntimeVirtualTextureVolume actor
Integrated from //UE4/Dev-Rendering
#rb none
#rnx

#ROBOMERGE-SOURCE: CL 7049434 in //UE4/Release-4.23/...
#ROBOMERGE-BOT: RELEASE (Release-4.23 -> Main) (v367-6836689)

[CL 7049483 by jeremy moore in Main branch]
2019-06-17 14:20:02 -04:00
Rolando Caloca
aa0d2303d6 Copying //UE4/Dev-Rendering to Dev-Main (//UE4/Dev-Main) @ 6944469
#rb none
#rnx

[CL 6944849 by Rolando Caloca in Main branch]
2019-06-11 18:27:07 -04:00