AmplifyCreations / AmplifyShaderEditor-Feedback

4 stars 0 forks source link

ASE Instanced Terrain Option #300

Closed Dawie3565 closed 6 months ago

Dawie3565 commented 6 months ago

HDRP Instanced Terrain option is adding: --- #pragma multi_compile_instancing --- #pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd

image

this behavior is different than BIRP and URP it should not add pragma for instancing

///////////////// Note it is also adding the incorrect one for terrain, use incorrect instancing can result is errors within some unity versions for LOD cross fade sharing the same constant buffers.

pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd

for terrain should be

pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap

//////////////

please make behavior same as BIRP and URP and do not add instancing pragma

Note within terrain we only add the below in defined passes

instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap Forward, GBuffer

multi_compile_instancing Forward,GBuffer,ShadowCaster,DepthOnly,DepthNormals

image

Dawie3565 commented 6 months ago

more Updates requested by Cristain

TerrainDrawInstancedHelper.cs ---- BIRP Only ----

Line 128

/ 0 - tex coords/"\t{0} = float4( (patchVertex.xy * uvscale.zw + uvoffset.zw), 0, 0 );\n",

change to

/ 0 - tex coords/"\t{0} = float4(sampleCoords, 0, 0 );\n",

BOXOPHOBIC commented 6 months ago

Fixed TerrainDrawInstancedHelper.cs instanced terrain code generation for BIRP Template Only TerrainDrawInstancedHelper.zip

diogovtx commented 6 months ago

Thanks for the contribution @BOXOPHOBIC !

This is now fixed in v1.9.4 (previously v1.9.3.4)

Dawie3565 commented 6 months ago

re open as not closed yet

tested in HDRP 12x 2021.3.38

when enable option for Instance terrain ase is still adding:

pragma multi_compile_instancing

pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd

this condition results is duplication and also ASE is adding the incorrect instancing option for terrain image

diogovtx commented 6 months ago

Fixed "forwardadd" being added to HDRP and URP. It's not used by Unity's URP/HDRP terrain shaders.

Everything else is pretty much a duplication problem, not specifically related only to "Instanced Terrain". I've created a new issue to address these problems => #305

Closing this issue.