[Core] Remove unused shaders [2]
This commit is contained in:
parent
abd57b7b5b
commit
3beea443e6
15 changed files with 0 additions and 10618 deletions
|
@ -1,345 +0,0 @@
|
||||||
group = "Output"
|
|
||||||
display_name = "Anisostropic Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"aee6e47b-be7b-4d67-a123-2ab5d660b94e" = {
|
|
||||||
name = "vertex_offset"
|
|
||||||
display_name = "Position offset"
|
|
||||||
is_required = false
|
|
||||||
type = { vector3: ["HAS_VERTEX_OFFSET"] }
|
|
||||||
domain = "vertex"
|
|
||||||
}
|
|
||||||
|
|
||||||
"aca690cb-6305-4a2f-bf3d-69183a493db3" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"34259752-b962-4b65-92c3-903a57338519" = {
|
|
||||||
name = "opacity"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity"
|
|
||||||
type = { scalar: ["HAS_OPACITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"7a9306c6-95ae-4cdb-9fef-0eedacce4e83" = {
|
|
||||||
name = "opacity_threshold"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity Threshold"
|
|
||||||
type = { scalar: ["HAS_OPACITY_THRESHOLD"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"b1c86408-aacb-4466-b754-ddcf37a3a2c8" = {
|
|
||||||
is_required = false
|
|
||||||
name = "normal"
|
|
||||||
display_name = "Normal"
|
|
||||||
type = { vector3: ["HAS_NORMAL"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"ad5e052f-d316-4a0f-8b79-53c38204d61b" = {
|
|
||||||
is_required = false
|
|
||||||
name = "metallic"
|
|
||||||
display_name = "Metallic"
|
|
||||||
type = { scalar: ["HAS_METALLIC"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"36ba46d2-f6ea-4e60-a428-fdc17c75bc62" = {
|
|
||||||
is_required = false
|
|
||||||
name = "roughness"
|
|
||||||
display_name = "Roughness"
|
|
||||||
type = { scalar: ["HAS_ROUGHNESS"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"e142ce4c-8a75-4602-a079-2996646bf37b" = {
|
|
||||||
is_required = false
|
|
||||||
name = "anisotropy"
|
|
||||||
display_name = "Anisotropy"
|
|
||||||
type = { scalar: ["HAS_ANISOTROPY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"1164a5ef-4563-4795-b3b5-42825d6df037" = {
|
|
||||||
is_required = false
|
|
||||||
name = "emissive"
|
|
||||||
display_name = "Emissive"
|
|
||||||
type = { vector3: ["HAS_EMISSIVE" ] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"59fd1cf4-f736-470d-8510-1dd7c016639e" = {
|
|
||||||
is_required = false
|
|
||||||
name = "ambient_occlusion"
|
|
||||||
display_name = "Ambient Occlusion"
|
|
||||||
type = { scalar: ["HAS_AMBIENT_OCCLUSION"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"b2c7c0d2-beff-4b1a-a9d4-068a507625a2" = "USE_FBX_PERMUTATIONS"
|
|
||||||
"d1a42a54-0794-4d57-9aa0-eb35acb6b35c" = "INSTANCED"
|
|
||||||
"8df1b8f7-17c2-4ae4-8c4e-25517ec1df46" = "CULL_NONE"
|
|
||||||
"c198c109-2cdf-49ee-af18-a982c23e2729" = "CULL_FRONT"
|
|
||||||
"2b136447-676e-4943-997b-04a28ae68497" = "WORLD_SPACE_NORMAL"
|
|
||||||
"dd7fcf97-0627-48ab-b29a-95b5685bb123" = "TRANSPARENT"
|
|
||||||
"3b55d6c6-4398-4dbc-b9ef-570aff8696ae" = "TRANSPARENT_FADE"
|
|
||||||
"b5bb2062-c8fa-43c5-8657-493a0be6860c" = "SKINNED_DISABLED"
|
|
||||||
"901b44ce-d128-498a-9912-32cd9635c556" = "HAS_FOV"
|
|
||||||
"da4e717b-5d0d-47fa-93b0-01c988f8f3ff" = "LOCK_NORMAL_ROTATION"
|
|
||||||
"979cb7cf-c255-42d0-a389-78fc0fb0539f" = "DEFERRED_DECALS_GROUP_1"
|
|
||||||
"d557b597-fa90-46b4-a751-eb51ae61ba5b" = "DEFERRED_DECALS_GROUP_2"
|
|
||||||
"fe20cc01-4cec-4217-98a0-07220ad3add9" = "DEFERRED_DECALS_GROUP_3"
|
|
||||||
"524a5842-23b7-46d1-ab22-cb3a14746ce0" = "USE_GLOBAL_ROUGHNESS_MULTIPLIER"
|
|
||||||
"11256995-4805-4018-bd6b-9214414fd363" = "NORMAL_FLIP_DISABLED"
|
|
||||||
"580cc6eb-3591-4c71-aa50-528af18ba160" = "JITTER_TRANSPARENCY"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Normals In"
|
|
||||||
options = {
|
|
||||||
"Tangent Space" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"World Space" = "2b136447-676e-4943-997b-04a28ae68497"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Blend Mode"
|
|
||||||
options = {
|
|
||||||
"Opaque" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Transparent" = "dd7fcf97-0627-48ab-b29a-95b5685bb123"
|
|
||||||
"Transparent Fade" = "3b55d6c6-4398-4dbc-b9ef-570aff8696ae"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Face Culling"
|
|
||||||
options = {
|
|
||||||
"Back" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Front" = "c198c109-2cdf-49ee-af18-a982c23e2729"
|
|
||||||
"None (double sided)" = "8df1b8f7-17c2-4ae4-8c4e-25517ec1df46"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{ type = "checkbox" display_name = "Disable Skinning" option = "b5bb2062-c8fa-43c5-8657-493a0be6860c" }
|
|
||||||
{ type = "checkbox" display_name = "Instancing" option = "d1a42a54-0794-4d57-9aa0-eb35acb6b35c" }
|
|
||||||
{ type = "checkbox" display_name = "Custom FOV" option = "901b44ce-d128-498a-9912-32cd9635c556" }
|
|
||||||
{ type = "checkbox" display_name = "Avoid Tangent Space Transform" option = "da4e717b-5d0d-47fa-93b0-01c988f8f3ff" }
|
|
||||||
{ type = "checkbox" display_name = "Use Global Roughness Multiplier" option = "524a5842-23b7-46d1-ab22-cb3a14746ce0" }
|
|
||||||
{ type = "checkbox" display_name = "Normal Flip Disabled (double sided)" option = "11256995-4805-4018-bd6b-9214414fd363" }
|
|
||||||
{ type = "checkbox" display_name = "Jitter Transparency" option = "580cc6eb-3591-4c71-aa50-528af18ba160" }
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
}
|
|
||||||
|
|
||||||
sampler_state = {
|
|
||||||
}
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
"(defined(HAS_NORMAL) && !defined(WORLD_SPACE_NORMAL)) || defined(NEEDS_TANGENT_SPACE) || defined(HAS_ANISOTROPY)": {
|
|
||||||
vertex_tangent = { type = "float3" semantic = "TANGENT" domain = "vertex" }
|
|
||||||
vertex_binormal = { type = "float3" semantic = "BINORMAL" domain = "vertex" }
|
|
||||||
|
|
||||||
tsm0 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
tsm1 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
tsm2 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"!defined(HAS_NORMAL) || defined(NEEDS_WORLD_SPACE_NORMAL)": {
|
|
||||||
world_space_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MOTION_BLUR)": {
|
|
||||||
last_clip_position = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex_position = { type = "float4" domain = "vertex" }
|
|
||||||
vertex_normal = { type = "float3" semantic = "NORMAL" domain = "vertex" }
|
|
||||||
|
|
||||||
"defined(HAS_VERTEX_BAKED_DIFFUSE_LIGHTING)": {
|
|
||||||
vertex_color1 = { type = "float4" semantic = "COLOR1" domains = ["vertex"] }
|
|
||||||
baked_light = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(HAS_LIGHTMAP_BAKED_DIFFUSE_LIGHTING)": {
|
|
||||||
lightmap_uv_input = { type = "float2" semantic="TEXCOORD1" domains = ["vertex"] }
|
|
||||||
lightmap_uv = { type = "float2" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MATERIAL_TRANSFER)": {
|
|
||||||
lightmap_uv = { type = "float2" semantic="TEXCOORD1" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_UNSKINNED_WORLD_POS)": {
|
|
||||||
unskinned_world_pos = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
unskinned_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_PIXEL_DEPTH)": {
|
|
||||||
pixel_depth = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SCREEN_POS)": {
|
|
||||||
screen_pos = { type = "float2" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SUN_SHADOW_MASK)": {
|
|
||||||
//"defined(NEEDS_SUN_SHADOW_MASK) && (defined(EMISSIVE_PASS) || defined(TRANSPARENT) || defined(TRANSPARENT_FADE))": {
|
|
||||||
sun_shadow_mask = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//log_permutations = true
|
|
||||||
permutation_sets = {
|
|
||||||
vertex_modifiers = [
|
|
||||||
{ if: "num_skin_weights() == 4" define: { "macros": ["SKINNED_4WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 3" define: { "macros": ["SKINNED_3WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 2" define: { "macros": ["SKINNED_2WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 1" define: { "macros": ["SKINNED_1WEIGHT"] stages: ["vertex"] } }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
instanced_modifiers = [
|
|
||||||
// { if: "mesh_baked_lighting_type() == lightmap" define: ["HAS_LIGHTMAP_BAKED_DIFFUSE_LIGHTING"] }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
lightmap_modifiers = [
|
|
||||||
{ if: "lightmap_format() == directional_irradiance" define: ["HAS_DIRECTIONAL_LIGHTMAPS"] }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
non_instanced_modifiers = [
|
|
||||||
// { if: "mesh_baked_lighting_type() == lightmap" define: ["HAS_LIGHTMAP_BAKED_DIFFUSE_LIGHTING"] permute_with: "lightmap_modifiers" }
|
|
||||||
// { if: "mesh_baked_lighting_type() == vertex" define: ["HAS_VERTEX_BAKED_DIFFUSE_LIGHTING"] }
|
|
||||||
{ permute_with: "vertex_modifiers" }
|
|
||||||
]
|
|
||||||
|
|
||||||
instanced_and_non_instanced = [
|
|
||||||
{ if: "defined(INSTANCED)" permute_with: "instanced_modifiers" }
|
|
||||||
{ if: "!defined(INSTANCED)" permute_with: "non_instanced_modifiers" }
|
|
||||||
]
|
|
||||||
|
|
||||||
default = [
|
|
||||||
// FBX Standard material exclusive permutations, these will only compile of the
|
|
||||||
// 'USE_FBX_PERMUTATIONS' option is set, which it is in the shader used for imported fbx files.
|
|
||||||
{ if: "defined(USE_FBX_PERMUTATIONS) && is_any_material_variable_set(use_emissive_map, emissive)" define: ["FBX_EMISSIVE"] permute_with: "instanced_and_non_instanced" }
|
|
||||||
|
|
||||||
// Normal default permutation set
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL) && (defined(TRANSPARENT) || defined(TRANSPARENT_FADE)) && render_setting(low_res_transparency)" defines=["LOW_RES_ENABLED"] permute_with: "instanced_and_non_instanced" }
|
|
||||||
{ permute_with: "instanced_and_non_instanced" }
|
|
||||||
]
|
|
||||||
|
|
||||||
shadow_caster = [
|
|
||||||
{ if: "defined(INSTANCED)" }
|
|
||||||
{ if: "!defined(INSTANCED)" permute_with: "vertex_modifiers" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
shadow_caster = {
|
|
||||||
passes_sort_mode = "immediate"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" permute_with: "shadow_caster" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ code_block="core/stingray_renderer/output_nodes/standard_base#depth_only" render_state="core/stingray_renderer/output_nodes/standard_base#shadow_caster" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
material_transfer = {
|
|
||||||
passes_sort_mode = "immediate"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12)" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "defined(HAS_ANISOTROPY)" then: [
|
|
||||||
{ code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines=["MATERIAL_TRANSFER" "TRANSPARENT_FADE"] render_state="core/stingray_renderer/output_nodes/standard_base#material_transfer" }
|
|
||||||
] else: [
|
|
||||||
{ code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines=["MATERIAL_TRANSFER"] render_state="core/stingray_renderer/output_nodes/standard_base#material_transfer" }
|
|
||||||
]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" permute_with: [
|
|
||||||
// TODO: create permutation for when local lights is off.
|
|
||||||
{ permute_with: "default" }
|
|
||||||
] }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "defined(HAS_ANISOTROPY)" then: [
|
|
||||||
{ if: "defined(TRANSPARENT) || defined(TRANSPARENT_FADE)" then: [
|
|
||||||
{ if: "defined(CULL_NONE)" then: [
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" render_state="core/stingray_renderer/output_nodes/standard_base#transparent_double_sided_ccw" }
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" render_state="core/stingray_renderer/output_nodes/standard_base#transparent_double_sided_cw" }
|
|
||||||
] else: [
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" render_state="core/stingray_renderer/output_nodes/standard_base#transparent" }
|
|
||||||
]}
|
|
||||||
] else: [
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines=["TRANSPARENT_FADE"] render_state="core/stingray_renderer/output_nodes/standard_base#gbuffer_material" } // TODO: write o another layer
|
|
||||||
]}
|
|
||||||
// todo has fov?
|
|
||||||
] else: [
|
|
||||||
// Standard base logic.
|
|
||||||
{ if: "defined(TRANSPARENT) || defined(TRANSPARENT_FADE)" then: [
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" render_state="core/stingray_renderer/output_nodes/standard_base#transparent" }
|
|
||||||
] else: [
|
|
||||||
{ if: "defined(HAS_FOV)" then: [
|
|
||||||
{ layer="gbuffer_fpr" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines="MOTION_BLUR" render_state="core/stingray_renderer/output_nodes/standard_base#gbuffer_material" }
|
|
||||||
] else: [
|
|
||||||
{ if: "defined(HAS_OPACITY)" then: [
|
|
||||||
{ layer="gbuffer_alpha_masked" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines="MOTION_BLUR" render_state="core/stingray_renderer/output_nodes/standard_base#gbuffer_material" }
|
|
||||||
] else: [
|
|
||||||
{ layer="gbuffer" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines="MOTION_BLUR" render_state="core/stingray_renderer/output_nodes/standard_base#gbuffer_material" }
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
|
|
||||||
// This bit of logic is a bit complicated. The gist of it is that we want to disable this pass
|
|
||||||
// for materials that has a value connected on emissive for all permutations, but should have it
|
|
||||||
// discarded for all but the special permutations with the define FBX_EMISSIVE
|
|
||||||
{ if: "defined(HAS_EMISSIVE) && (!defined(USE_FBX_PERMUTATIONS) || defined(FBX_EMISSIVE))" then: [
|
|
||||||
{ layer="emissive" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines={ macros: ["EMISSIVE_PASS"] stages: ["pixel"] } render_state="core/stingray_renderer/output_nodes/standard_base#emissive" }
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
|
|
||||||
{ if: "!on_renderer(GL)" then: [
|
|
||||||
{ layer="wireframe" code_block="core/stingray_renderer/output_nodes/standard_base#depth_only" define="DRAW_WIREFRAME" render_state="core/stingray_renderer/output_nodes/standard_base#wireframe" branch_key="dev_wireframe" }
|
|
||||||
]}
|
|
||||||
|
|
||||||
{ layer="outline" code_block="core/stingray_renderer/output_nodes/standard_base#depth_only" define="DRAW_OUTLINE" render_state="core/stingray_renderer/output_nodes/standard_base#outline_stencil_write" branch_key="outline_unit" }
|
|
||||||
{ layer="outline" code_block="core/stingray_renderer/output_nodes/standard_base#depth_only" define="DRAW_OUTLINE" render_state="core/stingray_renderer/output_nodes/standard_base#outline_stencil_write_z" branch_key="outline_unit_z" }
|
|
||||||
|
|
||||||
{ layer="outline_mask" code_block="core/stingray_renderer/output_nodes/standard_base#depth_only" defines=["DRAW_OUTLINE" "OUTLINE_MASK_WRITE"] render_state="core/stingray_renderer/output_nodes/standard_base#outline_mask_write" branch_key="outline_unit_z_fail" }
|
|
||||||
{ layer="outline" code_block="core/stingray_renderer/output_nodes/standard_base#depth_only" defines=["DRAW_OUTLINE" "OUTLINE_MASK_READ"] render_state="core/stingray_renderer/output_nodes/standard_base#outline_stencil_write" branch_key="outline_unit_z_fail" }
|
|
||||||
|
|
||||||
{ layer="cascade_visualizer" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" define="CASCADE_VISUALIZER" render_state="core/stingray_renderer/output_nodes/standard_base#cascade_visualizer" branch_key="cascade_visualizer" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,361 +0,0 @@
|
||||||
group = "Output"
|
|
||||||
display_name = "Billboard Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"aee6e47b-be7b-4d67-a123-2ab5d660b94e" = {
|
|
||||||
name = "vertex_offset"
|
|
||||||
display_name = "Position offset"
|
|
||||||
is_required = false
|
|
||||||
type = { vector3: ["HAS_VERTEX_OFFSET"] }
|
|
||||||
domain = "vertex"
|
|
||||||
}
|
|
||||||
|
|
||||||
"aca690cb-6305-4a2f-bf3d-69183a493db3" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"34259752-b962-4b65-92c3-903a57338519" = {
|
|
||||||
name = "opacity"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity"
|
|
||||||
type = { scalar: ["HAS_OPACITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"7a9306c6-95ae-4cdb-9fef-0eedacce4e83" = {
|
|
||||||
name = "opacity_threshold"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity Threshold"
|
|
||||||
type = { scalar: ["HAS_OPACITY_THRESHOLD"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"b1c86408-aacb-4466-b754-ddcf37a3a2c8" = {
|
|
||||||
is_required = false
|
|
||||||
name = "normal"
|
|
||||||
display_name = "Normal"
|
|
||||||
type = { vector3: ["HAS_NORMAL"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"ad5e052f-d316-4a0f-8b79-53c38204d61b" = {
|
|
||||||
is_required = false
|
|
||||||
name = "metallic"
|
|
||||||
display_name = "Metallic"
|
|
||||||
type = { scalar: ["HAS_METALLIC"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"36ba46d2-f6ea-4e60-a428-fdc17c75bc62" = {
|
|
||||||
is_required = false
|
|
||||||
name = "roughness"
|
|
||||||
display_name = "Roughness"
|
|
||||||
type = { scalar: ["HAS_ROUGHNESS"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"1164a5ef-4563-4795-b3b5-42825d6df037" = {
|
|
||||||
is_required = false
|
|
||||||
name = "emissive"
|
|
||||||
display_name = "Emissive"
|
|
||||||
type = { vector3: ["HAS_EMISSIVE" ] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"59fd1cf4-f736-470d-8510-1dd7c016639e" = {
|
|
||||||
is_required = false
|
|
||||||
name = "ambient_occlusion"
|
|
||||||
display_name = "Ambient Occlusion"
|
|
||||||
type = { scalar: ["HAS_AMBIENT_OCCLUSION"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"0544ddb6-e168-452d-86f2-42a79e8c98e3" = {
|
|
||||||
is_required = false
|
|
||||||
name = "sss_strength"
|
|
||||||
display_name = "Skin SSS"
|
|
||||||
type = { scalar: ["SKIN", "HAS_SKIN_SSS_STRENGTH"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"b2c7c0d2-beff-4b1a-a9d4-068a507625a2" = "USE_FBX_PERMUTATIONS"
|
|
||||||
"d1a42a54-0794-4d57-9aa0-eb35acb6b35c" = "INSTANCED"
|
|
||||||
"8df1b8f7-17c2-4ae4-8c4e-25517ec1df46" = "CULL_NONE"
|
|
||||||
"c198c109-2cdf-49ee-af18-a982c23e2729" = "CULL_FRONT"
|
|
||||||
"34994d84-9d51-48ac-af85-bc053b2c65c3" = "SKIN"
|
|
||||||
"2b136447-676e-4943-997b-04a28ae68497" = "WORLD_SPACE_NORMAL"
|
|
||||||
"dd7fcf97-0627-48ab-b29a-95b5685bb123" = "TRANSPARENT"
|
|
||||||
"3b55d6c6-4398-4dbc-b9ef-570aff8696ae" = "TRANSPARENT_FADE"
|
|
||||||
"b5bb2062-c8fa-43c5-8657-493a0be6860c" = "SKINNED_DISABLED"
|
|
||||||
"901b44ce-d128-498a-9912-32cd9635c556" = "HAS_FOV"
|
|
||||||
"da4e717b-5d0d-47fa-93b0-01c988f8f3ff" = "LOCK_NORMAL_ROTATION"
|
|
||||||
"979cb7cf-c255-42d0-a389-78fc0fb0539f" = "DEFERRED_DECALS_GROUP_1"
|
|
||||||
"d557b597-fa90-46b4-a751-eb51ae61ba5b" = "DEFERRED_DECALS_GROUP_2"
|
|
||||||
"fe20cc01-4cec-4217-98a0-07220ad3add9" = "DEFERRED_DECALS_GROUP_3"
|
|
||||||
"524a5842-23b7-46d1-ab22-cb3a14746ce0" = "USE_GLOBAL_ROUGHNESS_MULTIPLIER"
|
|
||||||
"11256995-4805-4018-bd6b-9214414fd363" = "NORMAL_FLIP_DISABLED"
|
|
||||||
"580cc6eb-3591-4c71-aa50-528af18ba160" = "JITTER_TRANSPARENCY"
|
|
||||||
|
|
||||||
"a669a3b8-2bf0-4b3f-ba67-aebdeaf0e0d1" = "BILLBOARD_TANGENT_ALIGNED"
|
|
||||||
"b2df1da0-8e59-4ad4-9ab7-7a4d5ddcf998" = "BILLBOARD_CAMERA_ALIGNED"
|
|
||||||
"f0642710-b291-4a17-80d0-1319d0decfd9" = "BILLBOARD_TANGENT_ALIGNED_X_LOCKED"
|
|
||||||
"32b48986-5602-4157-8a25-44fc7f71ee47" = "BILLBOARD_TANGENT_ALIGNED_Y_LOCKED"
|
|
||||||
"5bdca8b0-737e-417e-a2b4-d35cc935f605" = "BILLBOARD_SPHERICAL_NORMAL"
|
|
||||||
"c1c06809-56d3-4a8e-882c-7d84c31299ba" = "SECONDARY_SUN_DIRECTION"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Billboard Option"
|
|
||||||
options = {
|
|
||||||
"Screen Aligned" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Camera Aligned" = "b2df1da0-8e59-4ad4-9ab7-7a4d5ddcf998"
|
|
||||||
"Tangent Aligned" = "a669a3b8-2bf0-4b3f-ba67-aebdeaf0e0d1"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Tangent Aligned Axis"
|
|
||||||
options = {
|
|
||||||
"Z-Axis" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Y-Axis" = "32b48986-5602-4157-8a25-44fc7f71ee47"
|
|
||||||
"X-Axis" = "f0642710-b291-4a17-80d0-1319d0decfd9"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Normal Options"
|
|
||||||
options = {
|
|
||||||
"Plane Normal" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Spherical Plane Normal" = "5bdca8b0-737e-417e-a2b4-d35cc935f605"
|
|
||||||
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Normals In"
|
|
||||||
options = {
|
|
||||||
"Tangent Space" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"World Space" = "2b136447-676e-4943-997b-04a28ae68497"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Blend Mode"
|
|
||||||
options = {
|
|
||||||
"Opaque" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Transparent" = "dd7fcf97-0627-48ab-b29a-95b5685bb123"
|
|
||||||
"Transparent Fade" = "3b55d6c6-4398-4dbc-b9ef-570aff8696ae"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Decal Group"
|
|
||||||
options = {
|
|
||||||
"Group 0" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Group 1" = "979cb7cf-c255-42d0-a389-78fc0fb0539f"
|
|
||||||
"Group 2" = "d557b597-fa90-46b4-a751-eb51ae61ba5b"
|
|
||||||
"Group 3" = "fe20cc01-4cec-4217-98a0-07220ad3add9"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{ type = "checkbox" display_name = "Disable Skinning" option = "b5bb2062-c8fa-43c5-8657-493a0be6860c" }
|
|
||||||
{ type = "checkbox" display_name = "Instancing" option = "d1a42a54-0794-4d57-9aa0-eb35acb6b35c" }
|
|
||||||
{ type = "checkbox" display_name = "Custom FOV" option = "901b44ce-d128-498a-9912-32cd9635c556" }
|
|
||||||
{ type = "checkbox" display_name = "Avoid Tangent Space Transform" option = "da4e717b-5d0d-47fa-93b0-01c988f8f3ff" }
|
|
||||||
{ type = "checkbox" display_name = "Use Global Roughness Multiplier" option = "524a5842-23b7-46d1-ab22-cb3a14746ce0" }
|
|
||||||
{ type = "checkbox" display_name = "Normal Flip Disabled (double sided)" option = "11256995-4805-4018-bd6b-9214414fd363" }
|
|
||||||
{ type = "checkbox" display_name = "Jitter Transparency" option = "580cc6eb-3591-4c71-aa50-528af18ba160" }
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
}
|
|
||||||
|
|
||||||
sampler_state = {
|
|
||||||
}
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
"(defined(HAS_NORMAL) && !defined(WORLD_SPACE_NORMAL)) || defined(NEEDS_TANGENT_SPACE)": {
|
|
||||||
vertex_tangent = { type = "float3" semantic = "TANGENT" domain = "vertex" }
|
|
||||||
vertex_binormal = { type = "float3" semantic = "BINORMAL" domain = "vertex" }
|
|
||||||
|
|
||||||
tsm0 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
tsm1 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
tsm2 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"!defined(HAS_NORMAL) || defined(NEEDS_WORLD_SPACE_NORMAL)": {
|
|
||||||
world_space_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MOTION_BLUR)": {
|
|
||||||
last_clip_position = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex_position = { type = "float4" domain = "vertex" }
|
|
||||||
vertex_normal = { type = "float3" semantic = "NORMAL" domain = "vertex" }
|
|
||||||
|
|
||||||
"defined(HAS_VERTEX_BAKED_DIFFUSE_LIGHTING)": {
|
|
||||||
vertex_color1 = { type = "float4" semantic = "COLOR1" domains = ["vertex"] }
|
|
||||||
baked_light = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(HAS_LIGHTMAP_BAKED_DIFFUSE_LIGHTING)": {
|
|
||||||
lightmap_uv_input = { type = "float2" semantic="TEXCOORD1" domains = ["vertex"] }
|
|
||||||
lightmap_uv = { type = "float2" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MATERIAL_TRANSFER)": {
|
|
||||||
lightmap_uv = { type = "float2" semantic="TEXCOORD1" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_UNSKINNED_WORLD_POS)": {
|
|
||||||
unskinned_world_pos = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
unskinned_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_PIXEL_DEPTH)": {
|
|
||||||
pixel_depth = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SCREEN_POS)": {
|
|
||||||
screen_pos = { type = "float2" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SUN_SHADOW_MASK)": {
|
|
||||||
//"defined(NEEDS_SUN_SHADOW_MASK) && (defined(EMISSIVE_PASS) || defined(TRANSPARENT) || defined(TRANSPARENT_FADE))": {
|
|
||||||
sun_shadow_mask = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//log_permutations = true
|
|
||||||
permutation_sets = {
|
|
||||||
vertex_modifiers = [
|
|
||||||
{ if: "num_skin_weights() == 4" define: { "macros": ["SKINNED_4WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 3" define: { "macros": ["SKINNED_3WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 2" define: { "macros": ["SKINNED_2WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 1" define: { "macros": ["SKINNED_1WEIGHT"] stages: ["vertex"] } }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
instanced_modifiers = [
|
|
||||||
// { if: "mesh_baked_lighting_type() == lightmap" define: ["HAS_LIGHTMAP_BAKED_DIFFUSE_LIGHTING"] }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
lightmap_modifiers = [
|
|
||||||
{ if: "lightmap_format() == directional_irradiance" define: ["HAS_DIRECTIONAL_LIGHTMAPS"] }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
non_instanced_modifiers = [
|
|
||||||
// { if: "mesh_baked_lighting_type() == lightmap" define: ["HAS_LIGHTMAP_BAKED_DIFFUSE_LIGHTING"] permute_with: "lightmap_modifiers" }
|
|
||||||
// { if: "mesh_baked_lighting_type() == vertex" define: ["HAS_VERTEX_BAKED_DIFFUSE_LIGHTING"] }
|
|
||||||
{ permute_with: "vertex_modifiers" }
|
|
||||||
]
|
|
||||||
|
|
||||||
instanced_and_non_instanced = [
|
|
||||||
{ if: "defined(INSTANCED)" permute_with: "instanced_modifiers" }
|
|
||||||
{ if: "!defined(INSTANCED)" permute_with: "non_instanced_modifiers" }
|
|
||||||
]
|
|
||||||
|
|
||||||
default = [
|
|
||||||
// FBX Standard material exclusive permutations, these will only compile of the
|
|
||||||
// 'USE_FBX_PERMUTATIONS' option is set, which it is in the shader used for imported fbx files.
|
|
||||||
{ if: "defined(USE_FBX_PERMUTATIONS) && is_any_material_variable_set(use_emissive_map, emissive)" define: ["FBX_EMISSIVE"] permute_with: "instanced_and_non_instanced" }
|
|
||||||
|
|
||||||
// Normal default permutation set
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL) && (defined(TRANSPARENT) || defined(TRANSPARENT_FADE)) && render_setting(low_res_transparency)" defines=["LOW_RES_ENABLED"] permute_with: "instanced_and_non_instanced" }
|
|
||||||
{ permute_with: "instanced_and_non_instanced" }
|
|
||||||
]
|
|
||||||
|
|
||||||
shadow_caster = [
|
|
||||||
{ if: "defined(INSTANCED)" }
|
|
||||||
{ if: "!defined(INSTANCED)" permute_with: "vertex_modifiers" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
shadow_caster = {
|
|
||||||
passes_sort_mode = "immediate"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" permute_with: "shadow_caster" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ code_block="core/stingray_renderer/output_nodes/standard_base#depth_only" defines={ macros: ["BILLBOARD"] stages: ["vertex"] } render_state="core/stingray_renderer/output_nodes/standard_base#shadow_caster" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
material_transfer = {
|
|
||||||
passes_sort_mode = "immediate"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12)" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines=["BILLBOARD" "MATERIAL_TRANSFER"] render_state="core/stingray_renderer/output_nodes/standard_base#material_transfer" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" permute_with: [
|
|
||||||
// TODO: create permutation for when local lights is off.
|
|
||||||
{ permute_with: "default" }
|
|
||||||
] }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "(defined(TRANSPARENT) || defined(TRANSPARENT_FADE))" then: [
|
|
||||||
{ if: "defined(CULL_NONE)" then: [
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines={ macros: ["BILLBOARD"] stages: ["vertex"] } render_state="core/stingray_renderer/output_nodes/standard_base#transparent_double_sided_ccw" }
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines={ macros: ["BILLBOARD"] stages: ["vertex"] } render_state="core/stingray_renderer/output_nodes/standard_base#transparent_double_sided_cw" }
|
|
||||||
] else: [
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines={ macros: ["BILLBOARD"] stages: ["vertex"] } render_state="core/stingray_renderer/output_nodes/standard_base#transparent" }
|
|
||||||
]}
|
|
||||||
] else: [
|
|
||||||
{ if: "defined(HAS_FOV)" then: [
|
|
||||||
{ layer="gbuffer_fpr" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines=["BILLBOARD" "MOTION_BLUR"] render_state="core/stingray_renderer/output_nodes/standard_base#gbuffer_material" }
|
|
||||||
] else: [
|
|
||||||
{ if: "defined(HAS_OPACITY)" then: [
|
|
||||||
{ layer="gbuffer_alpha_masked" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines=["BILLBOARD" "MOTION_BLUR"] render_state="core/stingray_renderer/output_nodes/standard_base#gbuffer_material" }
|
|
||||||
] else: [
|
|
||||||
{ layer="gbuffer" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines=["BILLBOARD" "MOTION_BLUR"] render_state="core/stingray_renderer/output_nodes/standard_base#gbuffer_material" }
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
|
|
||||||
// This bit of logic is a bit complicated. The gist of it is that we want to disable this pass
|
|
||||||
// for materials that has a value connected on emissive for all permutations, but should have it
|
|
||||||
// discarded for all but the special permutations with the define FBX_EMISSIVE
|
|
||||||
{ if: "defined(HAS_EMISSIVE) && (!defined(USE_FBX_PERMUTATIONS) || defined(FBX_EMISSIVE))" then: [
|
|
||||||
{ layer="emissive" code_block="core/stingray_renderer/output_nodes/standard_base#gbuffer_base" defines=["BILLBOARD" "EMISSIVE_PASS"] render_state="core/stingray_renderer/output_nodes/standard_base#emissive" }
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
|
|
||||||
{ if: "!on_renderer(GL)" then: [
|
|
||||||
{ layer="wireframe" code_block="core/stingray_renderer/output_nodes/standard_base#depth_only" defines=["BILLBOARD" "DRAW_WIREFRAME"] render_state="core/stingray_renderer/output_nodes/standard_base#wireframe" branch_key="dev_wireframe" }
|
|
||||||
]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,243 +0,0 @@
|
||||||
group = "Output"
|
|
||||||
display_name = "Billboard Unlit Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"aee6e47b-be7b-4d67-a123-2ab5d660b94e" = {
|
|
||||||
name = "vertex_offset"
|
|
||||||
display_name = "Position offset"
|
|
||||||
is_required = false
|
|
||||||
type = { vector3: ["HAS_VERTEX_OFFSET"] }
|
|
||||||
domain = "vertex"
|
|
||||||
}
|
|
||||||
|
|
||||||
"aca690cb-6305-4a2f-bf3d-69183a493db3" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"34259752-b962-4b65-92c3-903a57338519" = {
|
|
||||||
name = "opacity"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity"
|
|
||||||
type = { scalar: ["HAS_OPACITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"d1a42a54-0794-4d57-9aa0-eb35acb6b35c" = "INSTANCED"
|
|
||||||
"8df1b8f7-17c2-4ae4-8c4e-25517ec1df46" = "DOUBLE_SIDED"
|
|
||||||
"34994d84-9d51-48ac-af85-bc053b2c65c3" = "SKIN"
|
|
||||||
"e1bfa889-2503-4ac3-9134-c08a7fa04568" = "PROJECT_TO_FAR_PLANE"
|
|
||||||
"6a6241cc-7d21-4e2e-87c8-8d9c7bdcd322" = "CAMERA_TRANSLATION_LOCK"
|
|
||||||
"435e14e4-556d-4ac1-af14-8dafe63aff8f" = "BLEND_TRANSPARENT"
|
|
||||||
"52c7ce01-ee57-4770-914e-727fc1966962" = "LAYER_EMISSIVE"
|
|
||||||
"da09a694-b81f-4684-9912-61294914fd70" = "LAYER_SKYDOME_BILLBOARD"
|
|
||||||
"4c3163d4-c086-4645-ba1c-0d68a98022a1" = "LAYER_HDR_TRANSPARENT"
|
|
||||||
"c8d8b754-c567-4c7b-9cbd-8acab22beff5" = "LAYER_TRANSPARENT"
|
|
||||||
"afe47c59-33c4-43b2-af4a-817085b1113c" = "DEPTH_TEST_INVERTED"
|
|
||||||
"774556cd-2d1e-4df8-8ae2-5e84800f0c04" = "DEPTH_TEST_DISABLED"
|
|
||||||
"7b8bc0bf-c453-49d2-9415-0e80fec1039f" = "DISABLE_DEPTH_WRITE"
|
|
||||||
"b2556764-e8e9-47cf-9ecc-f53b5d5d73c7" = "HAS_CUSTOM_FOV"
|
|
||||||
"72ecf75c-f85f-49a2-8708-cd3158c1afa8" = "BILLBOARD_TANGENT_ALIGNED"
|
|
||||||
"33aec36d-02fd-4494-81b5-02b9d6ebf4bb" = "BILLBOARD_CAMERA_ALIGNED"
|
|
||||||
"7ae0cdd4-6508-433d-a994-9f2d4ba7b336" = "BILLBOARD_TANGENT_ALIGNED_X_LOCKED"
|
|
||||||
"774ef841-1d96-4a1f-8b6d-da8007bfe93e" = "BILLBOARD_TANGENT_ALIGNED_Y_LOCKED"
|
|
||||||
"d8ad7502-a44d-4cf0-920e-957a477f5c86" = "BILLBOARD_SPHERICAL_NORMAL"
|
|
||||||
"7afd3648-ebd1-4a40-94b4-a07e59a6fbb2" = "DISABLE_WRITE_DEPTH"
|
|
||||||
"7fb0b18d-1725-4e76-b3fe-f7a59b607f98" = "SECONDARY_SUN_DIRECTION"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Billboard Option"
|
|
||||||
options = {
|
|
||||||
"Screen Aligned" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Camera Aligned" = "33aec36d-02fd-4494-81b5-02b9d6ebf4bb"
|
|
||||||
"Tangent Aligned" = "72ecf75c-f85f-49a2-8708-cd3158c1afa8"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Tangent Aligned Axis"
|
|
||||||
options = {
|
|
||||||
"Z-Axis" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Y-Axis" = "774ef841-1d96-4a1f-8b6d-da8007bfe93e"
|
|
||||||
"X-Axis" = "7ae0cdd4-6508-433d-a994-9f2d4ba7b336"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Skydome Billboard Direction"
|
|
||||||
options = {
|
|
||||||
"Sun Direction" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Secondary Sun Direction" = "7fb0b18d-1725-4e76-b3fe-f7a59b607f98"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Normal Options"
|
|
||||||
options = {
|
|
||||||
"Plane Normal" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Spherical Plane Normal" = "d8ad7502-a44d-4cf0-920e-957a477f5c86"
|
|
||||||
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Layer"
|
|
||||||
options = {
|
|
||||||
"Emissive" = "52c7ce01-ee57-4770-914e-727fc1966962"
|
|
||||||
"Skydome Billboard" = "da09a694-b81f-4684-9912-61294914fd70"
|
|
||||||
"HDR Transparent" = "4c3163d4-c086-4645-ba1c-0d68a98022a1"
|
|
||||||
"LDR Transparent" = "c8d8b754-c567-4c7b-9cbd-8acab22beff5"
|
|
||||||
}
|
|
||||||
default = "4c3163d4-c086-4645-ba1c-0d68a98022a1"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Depth Testing"
|
|
||||||
options = {
|
|
||||||
"Normal" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Inverted" = "afe47c59-33c4-43b2-af4a-817085b1113c"
|
|
||||||
"Disabled" = "774556cd-2d1e-4df8-8ae2-5e84800f0c04"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Blend Mode"
|
|
||||||
options = {
|
|
||||||
"Opaque" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Transparent" = "435e14e4-556d-4ac1-af14-8dafe63aff8f"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{ type = "checkbox" display_name = "Disable Depth Writes" option = "7b8bc0bf-c453-49d2-9415-0e80fec1039f" }
|
|
||||||
{ type = "checkbox" display_name = "Double Sided" option = "8df1b8f7-17c2-4ae4-8c4e-25517ec1df46" }
|
|
||||||
{ type = "checkbox" display_name = "Instancing" option = "d1a42a54-0794-4d57-9aa0-eb35acb6b35c" }
|
|
||||||
{ type = "checkbox" display_name = "Project to Far Plane" option = "e1bfa889-2503-4ac3-9134-c08a7fa04568" }
|
|
||||||
{ type = "checkbox" display_name = "Camera Translation Lock" option = "6a6241cc-7d21-4e2e-87c8-8d9c7bdcd322" }
|
|
||||||
{ type = "checkbox" display_name = "Custom FOV" option = "b2556764-e8e9-47cf-9ecc-f53b5d5d73c7" }
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
skydome_billboard = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
state: {
|
|
||||||
write_mask0 = "red|green|blue"
|
|
||||||
|
|
||||||
"defined(BLEND_TRANSPARENT)" = {
|
|
||||||
blend_enable = "true"
|
|
||||||
blend_op = "blend_op_add"
|
|
||||||
dest_blend = "blend_inv_src_alpha"
|
|
||||||
src_blend = "blend_one"
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(DEPTH_TEST_DISABLED)" = {
|
|
||||||
z_enable = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
z_write_enable = "false"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sampler_state = { }
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_WORLD_SPACE_NORMAL)": {
|
|
||||||
world_space_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MOTION_BLUR)": {
|
|
||||||
last_clip_position = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MATERIAL_TRANSFER)": {
|
|
||||||
lightmap_uv = { type = "float2" semantic="TEXCOORD1" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SCREEN_POS)": {
|
|
||||||
screen_pos = { type = "float2" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_PIXEL_DEPTH)": {
|
|
||||||
pixel_depth = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex_position = { type = "float4" domain = "vertex" }
|
|
||||||
vertex_normal = { type = "float3" semantic = "NORMAL" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
permutation_sets = {
|
|
||||||
vertex_modifiers = [
|
|
||||||
{ if: "num_skin_weights() == 4" define: { "macros": ["SKINNED_4WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 3" define: { "macros": ["SKINNED_3WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 2" define: { "macros": ["SKINNED_2WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 1" define: { "macros": ["SKINNED_1WEIGHT"] stages: ["vertex"] } }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
instanced_modifiers = [
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
non_instanced_modifiers = [
|
|
||||||
{ permute_with: "vertex_modifiers" }
|
|
||||||
]
|
|
||||||
|
|
||||||
default = [
|
|
||||||
{ if: "defined(INSTANCED)" permute_with: "instanced_modifiers" }
|
|
||||||
{ if: "!defined(INSTANCED)" permute_with: "non_instanced_modifiers" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL) && defined(BLEND_TRANSPARENT) && defined(LAYER_HDR_TRANSPARENT) && render_setting(low_res_transparency)" defines=["LOW_RES_ENABLED"] permute_with: "default" }
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" permute_with: "default" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "defined(LAYER_EMISSIVE)" then: [
|
|
||||||
{ layer="emissive" code_block="core/stingray_renderer/output_nodes/unlit_base#unlit" defines=["BILLBOARD" "MOTION_BLUR"] render_state="core/stingray_renderer/output_nodes/unlit_base#unlit" }
|
|
||||||
]}
|
|
||||||
{ if: "defined(LAYER_SKYDOME_BILLBOARD)" then: [
|
|
||||||
{ layer="skydome_billboard" code_block="core/stingray_renderer/output_nodes/unlit_base#unlit" defines={ macros: ["BILLBOARD"] stages: ["vertex"] } render_state="skydome_billboard" }
|
|
||||||
]}
|
|
||||||
{ if: "defined(LAYER_HDR_TRANSPARENT)" then: [
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/unlit_base#unlit" defines={ macros: ["BILLBOARD"] stages: ["vertex"] } render_state="core/stingray_renderer/output_nodes/unlit_base#unlit" }
|
|
||||||
]}
|
|
||||||
|
|
||||||
{ if: "defined(LAYER_TRANSPARENT)" then: [
|
|
||||||
{ layer="transparent" code_block="core/stingray_renderer/output_nodes/unlit_base#unlit" defines={ macros: ["BILLBOARD"] stages: ["vertex"] } render_state="core/stingray_renderer/output_nodes/unlit_base#unlit" }
|
|
||||||
] else: [
|
|
||||||
{ if: "!on_renderer(GL)" then: [
|
|
||||||
{ layer="wireframe" code_block="core/stingray_renderer/output_nodes/unlit_base#unlit" defines=["BILLBOARD" "DRAW_WIREFRAME"] render_state="core/stingray_renderer/output_nodes/unlit_base#wireframe" branch_key="dev_wireframe" }
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,434 +0,0 @@
|
||||||
group = "Output"
|
|
||||||
display_name = "Light Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"c09a9bb3-95e4-41b6-92af-33c5865fc691" = {
|
|
||||||
name = "light_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Light Color"
|
|
||||||
type = { vector3: ["HAS_LIGHT_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
light_source = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
state: {
|
|
||||||
z_enable = "true"
|
|
||||||
z_write_enable = "false"
|
|
||||||
z_func = "greater_equal"
|
|
||||||
|
|
||||||
cull_mode = "cull_ccw"
|
|
||||||
|
|
||||||
blend_enable = "true"
|
|
||||||
blend_op = "blend_op_add"
|
|
||||||
dest_blend = "blend_one"
|
|
||||||
src_blend = "blend_one"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
light_shadow_mask_write = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
state: {
|
|
||||||
z_enable = "true"
|
|
||||||
z_write_enable = "false"
|
|
||||||
z_func = "greater_equal"
|
|
||||||
cull_mode = "cull_ccw"
|
|
||||||
|
|
||||||
blend_enable = "false"
|
|
||||||
|
|
||||||
"defined(WRITE_R)" = {
|
|
||||||
write_mask0 = "red"
|
|
||||||
}
|
|
||||||
"defined(WRITE_G)" = {
|
|
||||||
write_mask0 = "green"
|
|
||||||
}
|
|
||||||
"defined(WRITE_B)" = {
|
|
||||||
write_mask0 = "blue"
|
|
||||||
}
|
|
||||||
"defined(WRITE_A)" = {
|
|
||||||
write_mask0 = "alpha"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
light_stencil = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
state: {
|
|
||||||
z_enable = "true"
|
|
||||||
z_write_enable = "false"
|
|
||||||
z_func = "less_equal"
|
|
||||||
|
|
||||||
cull_mode = "cull_none"
|
|
||||||
|
|
||||||
write_mask0 = "0x0"
|
|
||||||
write_mask1 = "0x0"
|
|
||||||
write_mask2 = "0x0"
|
|
||||||
write_mask3 = "0x0"
|
|
||||||
|
|
||||||
stencil_enable = "true"
|
|
||||||
stencil_func = "always"
|
|
||||||
stencil_fail = "stencil_op_keep"
|
|
||||||
stencil_pass = "stencil_op_keep"
|
|
||||||
stencil_ref = "0x0"
|
|
||||||
stencil_func_back_side = "always"
|
|
||||||
stencil_fail_back_side = "stencil_op_keep"
|
|
||||||
stencil_pass_back_side = "stencil_op_keep"
|
|
||||||
stencil_z_fail = "stencil_op_incr"
|
|
||||||
stencil_z_fail_back_side = "stencil_op_decr"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
vertex_position = { type = "float4" domain = "vertex" }
|
|
||||||
light_vector = { type="float3" domain="pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
permutation_sets = {
|
|
||||||
shadow_modifiers = [
|
|
||||||
{ if: "light_cast_shadows() == true" define: ["SHADOW_MAPPING"] }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
default = [
|
|
||||||
{ if: "light_type() == omni" define: ["OMNI"] permute_with: "shadow_modifiers" }
|
|
||||||
{ if: "light_type() == spot" define: ["SPOT"] permute_with: "shadow_modifiers" }
|
|
||||||
{ if: "light_type() == box" define: ["BOX"] permute_with: "shadow_modifiers" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "immediate"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM)" permute_with: "default" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
// TODO: skin shading
|
|
||||||
{ code_block="light_source" render_state="light_source" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code_blocks = {
|
|
||||||
light_source = {
|
|
||||||
include:[
|
|
||||||
"core/stingray_renderer/shader_libraries/common#common",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#gbuffer_access",
|
|
||||||
"core/stingray_renderer/shader_libraries/lighting_common#brdf",
|
|
||||||
"core/stingray_renderer/shader_libraries/shadow_map_common#shadow_bias",
|
|
||||||
"core/stingray_renderer/shader_libraries/shadow_map_common#shadow_map_filtering",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#taa_offsets"
|
|
||||||
]
|
|
||||||
|
|
||||||
samplers = {
|
|
||||||
gbuffer0 = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_point"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "gbuffer0"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
|
|
||||||
gbuffer1 = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_point"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "gbuffer1"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
|
|
||||||
linear_depth = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_point"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "linear_depth"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
|
|
||||||
local_lights_shadow_atlas = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/shadow_map_common#shadow_map"
|
|
||||||
slot_name = "shadow_map_sampler"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
|
|
||||||
fullscreen_shadow_mask = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_point"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "fullscreen_shadow_mask"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code = {
|
|
||||||
hlsl = """
|
|
||||||
DECLARE_SAMPLER_2D(gbuffer0);
|
|
||||||
DECLARE_SAMPLER_2D(gbuffer1);
|
|
||||||
DECLARE_SAMPLER_2D(linear_depth);
|
|
||||||
|
|
||||||
#if defined(SHADOW_MASK)
|
|
||||||
DECLARE_SAMPLER_2D(fullscreen_shadow_mask);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SHADOW_MAPPING) && (defined(D3D11) || defined(D3D12) || defined(GNM))
|
|
||||||
DECLARE_COMPARISON_SAMPLER_2D(local_lights_shadow_atlas);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct VS_INPUT {
|
|
||||||
float4 position : POSITION;
|
|
||||||
GRAPH_VERTEX_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PS_INPUT {
|
|
||||||
float4 position : SV_POSITION;
|
|
||||||
#if !defined(STENCIL_MARK)
|
|
||||||
float4 w : TEXCOORD1;
|
|
||||||
#endif
|
|
||||||
GRAPH_PIXEL_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
CBUFFER_START(c0)
|
|
||||||
#if defined(SPOT) || defined(BOX) || defined(NEEDS_WORLD_POSE)
|
|
||||||
float4x4 world;
|
|
||||||
#endif
|
|
||||||
#if defined(SPOT) || defined(BOX) || defined(NEEDS_INVERSE_WORLD_POSE)
|
|
||||||
float4x4 inv_world;
|
|
||||||
#endif
|
|
||||||
float4x4 world_view_proj;
|
|
||||||
GRAPH_MATERIAL_EXPORTS
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
CBUFFER_START(light)
|
|
||||||
float3 light_position;
|
|
||||||
float3 light_color;
|
|
||||||
#if defined(OMNI) || defined(SPOT) || defined(PYRAMID)
|
|
||||||
// start, 1.f/(end-start), exp
|
|
||||||
float3 light_falloff;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SPOT)
|
|
||||||
// scale + bias
|
|
||||||
float2 light_spot_falloff;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SHADOW_MAPPING)
|
|
||||||
#if defined(OMNI)
|
|
||||||
float4x4 world_to_shadow_maps[6];
|
|
||||||
#else
|
|
||||||
float4x4 world_to_shadow_map;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SHADOW_MASK)
|
|
||||||
float4 shadow_mask;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PYRAMID)
|
|
||||||
float3 face_normal_right;
|
|
||||||
float3 face_normal_left;
|
|
||||||
float3 face_normal_up;
|
|
||||||
float3 face_normal_down;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(BOX)
|
|
||||||
float3 light_box_min;
|
|
||||||
float3 light_box_max;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float3 light_proxy_scale;
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_INPUT vs_main(VS_INPUT input) {
|
|
||||||
PS_INPUT o;
|
|
||||||
|
|
||||||
GraphVertexParams params;
|
|
||||||
GraphVertexResults results;
|
|
||||||
|
|
||||||
// Write automatic params
|
|
||||||
GRAPH_VERTEX_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
float4 position;
|
|
||||||
#if defined(BOX)
|
|
||||||
float3 p = input.position.xyz * light_proxy_scale;
|
|
||||||
p += (light_box_max + light_box_min) * 0.5;
|
|
||||||
position = mul(float4(p, 1), world_view_proj);
|
|
||||||
#else
|
|
||||||
position = mul(float4(input.position.xyz * light_proxy_scale, 1), world_view_proj);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRAPH_VERTEX_PARAM(params, vertex_position) = position;
|
|
||||||
|
|
||||||
o.position = position;
|
|
||||||
#if !defined(STENCIL_MARK)
|
|
||||||
#if defined(SHADOW_MAPPING)
|
|
||||||
// When using temporal antialiasing we try to cancel out the jitter
|
|
||||||
// that was introduced in the depth buffer. This is to minimize self occlusion
|
|
||||||
// that can arrise when performing a depth test beween the jittered depth buffer
|
|
||||||
// and a non jittered shadow map.
|
|
||||||
float4 tmp = o.position;
|
|
||||||
float4 view_space = tmp / tmp.w;
|
|
||||||
view_space.xy -= get_vs_halton_offset(frame_number);
|
|
||||||
tmp = view_space * tmp.w;
|
|
||||||
o.w = encode_world_pos(tmp);
|
|
||||||
#else
|
|
||||||
o.w = encode_world_pos(o.position);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Evaluate all pieces of the graph that should run per-vertex.
|
|
||||||
GRAPH_EVALUATE_VERTEX(results, params);
|
|
||||||
|
|
||||||
// Write results
|
|
||||||
GRAPH_VERTEX_WRITE(o, results, params);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct PS_OUTPUT {
|
|
||||||
half4 base : SV_TARGET0;
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(STENCIL_MARK)
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
half4 ps_main(PS_INPUT input) : SV_TARGET0 {
|
|
||||||
return half4(0,0,0,0);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_OUTPUT ps_main(PS_INPUT input
|
|
||||||
#if defined(GL2)
|
|
||||||
, float2 wpos : VPOS
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PS_OUTPUT o;
|
|
||||||
o.base = half4(0,0,0,0);
|
|
||||||
|
|
||||||
half2 uv = input.position.xy / back_buffer_size;
|
|
||||||
float d = gbuffer_decode_depth(TEX2D(linear_depth, uv));
|
|
||||||
|
|
||||||
float3 wp = decode_world_pos(input.w, d);
|
|
||||||
float3 V = normalize(camera_world._m30_m31_m32 - wp);
|
|
||||||
float3 L = float3(0,0,1);
|
|
||||||
float attn = 1.f;
|
|
||||||
|
|
||||||
#if defined(OMNI) || defined(SPOT)
|
|
||||||
L = light_position - wp;
|
|
||||||
float len_L = length(L) + 0.00001f;
|
|
||||||
attn = light_attenuation(len_L, light_falloff.x, light_falloff.y);
|
|
||||||
L *= 1.0/len_L;
|
|
||||||
|
|
||||||
float normalized_distance = (len_L - light_falloff.x) * light_falloff.y;
|
|
||||||
[branch]
|
|
||||||
if (normalized_distance > 1.0f) discard;
|
|
||||||
|
|
||||||
#if defined(OMNI) && defined(SHADOW_MAPPING)
|
|
||||||
// The shadows from the faces of an onmni light are populated in the following order and directions.
|
|
||||||
// float3(-1.0f, 0.0f, 0.0f),
|
|
||||||
// float3( 1.0f, 0.0f, 0.0f),
|
|
||||||
// float3( 0.0f, -1.0f, 0.0f),
|
|
||||||
// float3( 0.0f, 1.0f, 0.0f),
|
|
||||||
// float3( 0.0f, 0.0f, -1.0f)
|
|
||||||
// float3( 0.0f, 0.0f, 1.0f),
|
|
||||||
|
|
||||||
// Based on the biggest component of the vector from the shaded position to the light source and its sign, chose the correct
|
|
||||||
// shadow map index to get the correct world position to shadow map matrix.
|
|
||||||
const float3 shadow_L = -L;
|
|
||||||
const int3 is_positive = shadow_L > 0;
|
|
||||||
const float3 abs_shadow_L = abs(shadow_L);
|
|
||||||
int test_index = (abs_shadow_L.x > abs_shadow_L.y && abs_shadow_L.x > abs_shadow_L.z) ? 0 + is_positive[0]: (abs_shadow_L.y > abs_shadow_L.z) ? 2 + is_positive[1] : 4 + is_positive[2];
|
|
||||||
|
|
||||||
// On the cpu side, the whole matrix will be full of zeroes if the face is not casting any shadows. Just test the first element.
|
|
||||||
const float shadow_active = world_to_shadow_maps[uint(test_index)]._m00 != 0.0f? 1.0f : 0.0f;
|
|
||||||
float4 ls = mul(float4(wp, 1), world_to_shadow_maps[uint(test_index)]);
|
|
||||||
#elif defined(SPOT)
|
|
||||||
float spot_attenuation = spot_angle_attenuation(dot(-L, world._m10_m11_m12), light_spot_falloff.x, light_spot_falloff.y);
|
|
||||||
if (spot_attenuation == 0.0f) discard;
|
|
||||||
attn *= spot_attenuation;
|
|
||||||
#endif
|
|
||||||
#elif defined(BOX)
|
|
||||||
L = -world._m10_m11_m12;
|
|
||||||
float3 op = mul(float4(wp, 1), inv_world).xyz;
|
|
||||||
float3 containment = (op > light_box_min) * (op < light_box_max);
|
|
||||||
float mask = dot(containment, containment) == 3;
|
|
||||||
attn = light_attenuation(op.y, light_box_min.y, 1.f / (light_box_max.y - light_box_min.x)) * mask;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SHADOW_MAPPING)
|
|
||||||
#if !defined(OMNI)
|
|
||||||
float4 ls = mul(float4(wp,1), world_to_shadow_map);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(D3D11) || defined(D3D12) || defined(GNM)
|
|
||||||
ls.xyz /= ls.w;
|
|
||||||
ls.z = apply_shadow_depth_comparison_bias(d, ls.z, local_shadow_map_bias);
|
|
||||||
float2 sm_resolution;
|
|
||||||
local_lights_shadow_atlas.tex.GetDimensions(sm_resolution.x, sm_resolution.y);
|
|
||||||
float2 tscale = float2(1.f / sm_resolution.x, 1.f / sm_resolution.y);
|
|
||||||
half shadow = shadow_intensity_2d(local_lights_shadow_atlas, sm_resolution, ls.xy, ls.z);
|
|
||||||
#if defined(OMNI)
|
|
||||||
shadow = (1.0f - shadow_active) + (shadow * 0.25f * shadow_active);
|
|
||||||
#else
|
|
||||||
shadow = (shadow * 0.25);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if defined(SHADOW_MASK)
|
|
||||||
attn *= dot(TEX2D(fullscreen_shadow_mask, uv), shadow_mask);
|
|
||||||
#elif defined(SHADOW_MAPPING)
|
|
||||||
attn *= shadow;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WRITE_R) || defined(WRITE_G)|| defined(WRITE_B)|| defined(WRITE_A)
|
|
||||||
o.base = shadow * 0.25;
|
|
||||||
#else
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
|
|
||||||
GRAPH_PIXEL_PARAM(params, light_vector) = L;
|
|
||||||
|
|
||||||
#if defined(HAS_LIGHT_COLOR)
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
|
|
||||||
float3 light_col = graph.light_color;
|
|
||||||
#else
|
|
||||||
float3 light_col = light_color;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
half4 gbuffer_0 = TEX2D(gbuffer0, uv);
|
|
||||||
half4 gbuffer_1 = TEX2D(gbuffer1, uv);
|
|
||||||
|
|
||||||
float3 N = normalize(gbuffer_decode_normal(gbuffer_1));
|
|
||||||
half roughness = gbuffer_decode_roughness(gbuffer_1);
|
|
||||||
|
|
||||||
float3 base_color = gbuffer_decode_base_color(gbuffer_0);
|
|
||||||
half metallic = gbuffer_decode_metallic_mask(gbuffer_0);
|
|
||||||
// 0.04 is taken as a common value for dielectrics. Source: Real-time rendering 3rd edition.
|
|
||||||
float3 specular_color = lerp(float3(0.04,0.04,0.04), base_color, metallic);
|
|
||||||
float3 diffuse_color = lerp(base_color, new_half3(0,0,0), metallic);
|
|
||||||
|
|
||||||
float3 acc_diff = float3(0,0,0);
|
|
||||||
float3 acc_spec = float3(0,0,0);
|
|
||||||
|
|
||||||
bsdf(L, V, N, light_col, diffuse_color, specular_color, roughness, attn, acc_diff, acc_spec);
|
|
||||||
|
|
||||||
o.base = half4(acc_diff + acc_spec, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,175 +0,0 @@
|
||||||
group = "Output/Particles"
|
|
||||||
display_name = "Distortion Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"1570ceed-8c40-4b7d-ba45-1bfe7722fed2" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"cdc6c110-5859-461a-9934-17e54089c764" = {
|
|
||||||
name = "opacity"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity"
|
|
||||||
type = { scalar: ["HAS_OPACITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"c050103c-1b43-4fbc-9547-d0c0d3f40ba6" = {
|
|
||||||
is_required = true
|
|
||||||
name = "distortion_normal"
|
|
||||||
display_name = "Distortion Normal"
|
|
||||||
domain = "pixel"
|
|
||||||
type = "vector3"
|
|
||||||
}
|
|
||||||
|
|
||||||
"402a4a8d-b721-4746-9a2d-90027c4aad68" = {
|
|
||||||
is_required = true
|
|
||||||
name = "distortion_strength"
|
|
||||||
display_name = "Distortion Strength"
|
|
||||||
domain = "pixel"
|
|
||||||
type = "vector2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"2b136447-676e-4943-997b-04a28ae68497" = "WORLD_SPACE_NORMAL"
|
|
||||||
"a5733c57-be1f-457f-a6fc-366d9c0e3c8c" = "EXTERNAL_ROTATION"
|
|
||||||
"d63603f1-8cc0-4b03-a9aa-b787902c6997" = "TANGENT_LOCKED"
|
|
||||||
"f38425db-9f78-4f2c-95ba-634a367b7aed" = "SCREEN_SPACE"
|
|
||||||
"cae9d51b-35c3-40f7-9805-119d7932cfcf" = "PIVOT"
|
|
||||||
"6ce8aa19-350e-49b8-bb39-444a60db482d" = "ROTATION"
|
|
||||||
"b770b6bb-1e81-4937-8032-fec369a05ea3" = "HAS_CUSTOM_FOV"
|
|
||||||
"fea9af88-d417-433a-b475-346b6b03e249" = "HIGH_QUALITY"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Resolution"
|
|
||||||
options = {
|
|
||||||
"Low" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Full" = "fea9af88-d417-433a-b475-346b6b03e249"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Turn-up Algorithms"
|
|
||||||
options = {
|
|
||||||
"Disabled" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Screen Space" = "f38425db-9f78-4f2c-95ba-634a367b7aed"
|
|
||||||
"Aligned" = "d63603f1-8cc0-4b03-a9aa-b787902c6997"
|
|
||||||
"Facing" = "a5733c57-be1f-457f-a6fc-366d9c0e3c8c"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{ type = "checkbox" display_name = "Pivot" option = "cae9d51b-35c3-40f7-9805-119d7932cfcf" }
|
|
||||||
{ type = "checkbox" display_name = "Rotation" option = "6ce8aa19-350e-49b8-bb39-444a60db482d" }
|
|
||||||
{ type = "checkbox" display_name = "Custom FOV" option = "b770b6bb-1e81-4937-8032-fec369a05ea3" }
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
shadow_caster = {
|
|
||||||
inherit: ["core/stingray_renderer/output_nodes/particle_base#shadow_caster"]
|
|
||||||
}
|
|
||||||
|
|
||||||
opacity = {
|
|
||||||
inherit: ["core/stingray_renderer/output_nodes/particle_base#opacity"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_WORLD_SPACE_NORMAL)": {
|
|
||||||
world_space_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_PIXEL_DEPTH)": {
|
|
||||||
pixel_depth = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SCREEN_POS)": {
|
|
||||||
screen_pos = { type = "float2" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"on_platform(GL)": {
|
|
||||||
vertex_corner_info = { type = "float2" semantic = "COLOR1" domain = "vertex" }
|
|
||||||
}
|
|
||||||
"!on_platform(GL)": {
|
|
||||||
vertex_corner_info = { type = "float2" semantic = "POSITION1" domain = "vertex" }
|
|
||||||
}
|
|
||||||
vertex_size = { type = "float2" semantic = "TEXCOORD7" domain = "vertex" }
|
|
||||||
"defined(ROTATION)": {
|
|
||||||
vertex_rotation = { type = "float" semantic = "TEXCOORD1" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"defined(NEEDS_UV_SCALE)": {
|
|
||||||
"defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_data = { type = "float3" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
uv_frame = { type = "float" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"!defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_data = { type = "float2" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
uv_scale = { type = "float2" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"!defined(NEEDS_UV_SCALE)": {
|
|
||||||
"defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_frame = { type = "float" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
uv_frame = { type = "float" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"defined(PIVOT)": {
|
|
||||||
vertex_pivot = { type = "float2" semantic = "TEXCOORD6" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"defined(EXTERNAL_ROTATION) || defined(TANGENT_LOCKED)": {
|
|
||||||
vertex_tangent = { type = "float3" semantic = "TANGENT" domains = ["vertex"] }
|
|
||||||
"defined(EXTERNAL_ROTATION)": {
|
|
||||||
vertex_binormal = { type = "float3" semantic = "BINORMAL" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL) && render_cap(development) && render_setting(particle_visualization)" defines=["PARTICLE_DEBUG"] }
|
|
||||||
//{ if: "on_renderer(D3D11, D3D12, GNM, GL) && render_setting(low_res_transparency)" defines=["LOW_RES_ENABLED"] }
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "defined(PARTICLE_DEBUG)" then: [
|
|
||||||
{ if: "defined(SCREEN_SPACE)" then: [
|
|
||||||
{ layer="hdr_transparent_screen_space_low_res" code_block="core/stingray_renderer/output_nodes/particle_base#billboard" defines=["DISTORTION"] render_state="opacity" }
|
|
||||||
] else: [
|
|
||||||
{ layer="hdr_transparent_low_res" code_block="core/stingray_renderer/output_nodes/particle_base#billboard" defines=["DISTORTION"] render_state="opacity" }
|
|
||||||
]}
|
|
||||||
] else: [
|
|
||||||
{ if: "defined(LOW_RES_ENABLED) && !defined(HIGH_QUALITY)" then: [
|
|
||||||
{ if: "defined(SCREEN_SPACE)" then: [
|
|
||||||
{ layer="hdr_transparent_screen_space_low_res" code_block="core/stingray_renderer/output_nodes/particle_base#billboard" defines=["DISTORTION" "LOW_RES"] render_state="opacity" }
|
|
||||||
] else: [
|
|
||||||
{ layer="hdr_transparent_low_res" code_block="core/stingray_renderer/output_nodes/particle_base#billboard" defines=["DISTORTION" "LOW_RES"] render_state="opacity" }
|
|
||||||
]}
|
|
||||||
] else: [
|
|
||||||
{ if: "defined(SCREEN_SPACE)" then: [
|
|
||||||
{ layer="hdr_transparent_screen_space" code_block="core/stingray_renderer/output_nodes/particle_base#billboard" defines=["DISTORTION"] render_state="opacity" }
|
|
||||||
] else: [
|
|
||||||
{ layer="hdr_transparent" code_block="core/stingray_renderer/output_nodes/particle_base#billboard" defines=["DISTORTION"] render_state="opacity" }
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,198 +0,0 @@
|
||||||
group = "Output/Particles"
|
|
||||||
display_name = "GBuffer Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"f47209cb-36b0-499c-8c37-857888098e1c" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"2edbfd6b-4985-4acd-ad0e-cbafb0272a27" = {
|
|
||||||
name = "opacity"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity"
|
|
||||||
type = { scalar: ["HAS_OPACITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"9b191b4d-05f1-4f21-b883-d34d9c440b99" = {
|
|
||||||
name = "opacity_threshold"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity Threshold"
|
|
||||||
type = { scalar: ["HAS_OPACITY_THRESHOLD"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"4d3bf516-a2b7-4709-b973-707ebf593845" = {
|
|
||||||
is_required = false
|
|
||||||
name = "normal"
|
|
||||||
display_name = "Normal"
|
|
||||||
type = { vector3: ["HAS_NORMAL"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"98d6ab4a-2569-415d-82c4-ab8115438a28" = {
|
|
||||||
is_required = false
|
|
||||||
name = "metallic"
|
|
||||||
display_name = "Metallic"
|
|
||||||
type = { scalar: ["HAS_METALLIC"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"2a34232c-88b9-485e-b009-9d3470d02943" = {
|
|
||||||
is_required = false
|
|
||||||
name = "roughness"
|
|
||||||
display_name = "Roughness"
|
|
||||||
type = { scalar: ["HAS_ROUGHNESS"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"cfd2c734-e369-47db-b315-41a9bcacc441" = {
|
|
||||||
is_required = false
|
|
||||||
name = "ambient_occlusion"
|
|
||||||
display_name = "Ambient Occlusion"
|
|
||||||
type = { scalar: ["HAS_AMBIENT_OCCLUSION"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"2b136447-676e-4943-997b-04a28ae68497" = "WORLD_SPACE_NORMAL"
|
|
||||||
"a5733c57-be1f-457f-a6fc-366d9c0e3c8c" = "EXTERNAL_ROTATION"
|
|
||||||
"d63603f1-8cc0-4b03-a9aa-b787902c6997" = "TANGENT_LOCKED"
|
|
||||||
"f38425db-9f78-4f2c-95ba-634a367b7aed" = "SCREEN_SPACE"
|
|
||||||
"cae9d51b-35c3-40f7-9805-119d7932cfcf" = "PIVOT"
|
|
||||||
"6ce8aa19-350e-49b8-bb39-444a60db482d" = "ROTATION"
|
|
||||||
"3eca2035-4349-4d1a-ae8b-6b1d8b91033f" = "HAS_CUSTOM_FOV"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Normals In"
|
|
||||||
options = {
|
|
||||||
"Tangent Space" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"World Space" = "2b136447-676e-4943-997b-04a28ae68497"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Turn-up Algorithms"
|
|
||||||
options = {
|
|
||||||
"Disabled" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Screen Space" = "f38425db-9f78-4f2c-95ba-634a367b7aed"
|
|
||||||
"Aligned" = "d63603f1-8cc0-4b03-a9aa-b787902c6997"
|
|
||||||
"Facing" = "a5733c57-be1f-457f-a6fc-366d9c0e3c8c"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{ type = "checkbox" display_name = "Pivot" option = "cae9d51b-35c3-40f7-9805-119d7932cfcf" }
|
|
||||||
{ type = "checkbox" display_name = "Rotation" option = "6ce8aa19-350e-49b8-bb39-444a60db482d" }
|
|
||||||
{ type = "checkbox" display_name = "Custom FOV" option = "3eca2035-4349-4d1a-ae8b-6b1d8b91033f" }
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
gbuffer_material = {
|
|
||||||
inherit: ["core/stingray_renderer/output_nodes/standard_base#gbuffer_material"]
|
|
||||||
}
|
|
||||||
|
|
||||||
shadow_caster = {
|
|
||||||
inherit: ["core/stingray_renderer/output_nodes/standard_base#shadow_caster"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
"(defined(HAS_NORMAL) && !defined(WORLD_SPACE_NORMAL)) || defined(NEEDS_TANGENT_SPACE)": {
|
|
||||||
tsm0 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
tsm1 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
tsm2 = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"!defined(HAS_NORMAL) || defined(NEEDS_WORLD_SPACE_NORMAL)": {
|
|
||||||
world_space_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_PIXEL_DEPTH)": {
|
|
||||||
pixel_depth = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SCREEN_POS)": {
|
|
||||||
screen_pos = { type = "float2" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"on_platform(GL)": {
|
|
||||||
vertex_corner_info = { type = "float2" semantic = "COLOR1" domain = "vertex" }
|
|
||||||
}
|
|
||||||
"!on_platform(GL)": {
|
|
||||||
vertex_corner_info = { type = "float2" semantic = "POSITION1" domain = "vertex" }
|
|
||||||
}
|
|
||||||
vertex_size = { type = "float2" semantic = "TEXCOORD7" domain = "vertex" }
|
|
||||||
"defined(ROTATION)": {
|
|
||||||
vertex_rotation = { type = "float" semantic = "TEXCOORD1" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"defined(NEEDS_UV_SCALE)": {
|
|
||||||
"defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_data = { type = "float3" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
uv_frame = { type = "float" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"!defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_data = { type = "float2" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
uv_scale = { type = "float2" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"!defined(NEEDS_UV_SCALE)": {
|
|
||||||
"defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_frame = { type = "float" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
uv_frame = { type = "float" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"defined(PIVOT)": {
|
|
||||||
vertex_pivot = { type = "float2" semantic = "TEXCOORD6" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"defined(EXTERNAL_ROTATION) || defined(TANGENT_LOCKED)": {
|
|
||||||
vertex_tangent = { type = "float3" semantic = "TANGENT" domains = ["vertex"] }
|
|
||||||
"defined(EXTERNAL_ROTATION)": {
|
|
||||||
vertex_binormal = { type = "float3" semantic = "BINORMAL" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
shadow_caster = {
|
|
||||||
passes_sort_mode = "immediate"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ code_block="core/stingray_renderer/output_nodes/particle_base#depth_only" define="GBUFFER_PARTICLES" render_state="shadow_caster" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "defined(HAS_OPACITY)" then: [
|
|
||||||
{ layer="gbuffer_alpha_masked" code_block="core/stingray_renderer/output_nodes/particle_base#billboard" define="GBUFFER_PARTICLES" render_state="gbuffer_material" }
|
|
||||||
] else: [
|
|
||||||
{ layer="gbuffer" code_block="core/stingray_renderer/output_nodes/particle_base#billboard" define="GBUFFER_PARTICLES" render_state="gbuffer_material" }
|
|
||||||
]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,321 +0,0 @@
|
||||||
group = "Output"
|
|
||||||
display_name = "Reflection Probe Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
reflection_probe = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
state: {
|
|
||||||
z_enable = "true"
|
|
||||||
z_write_enable = "false"
|
|
||||||
z_func = "greater_equal"
|
|
||||||
|
|
||||||
cull_mode = "cull_ccw"
|
|
||||||
|
|
||||||
blend_enable = "true"
|
|
||||||
blend_op = "blend_op_add"
|
|
||||||
dest_blend = "blend_one"
|
|
||||||
src_blend = "blend_inv_dest_alpha"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debug_visualization = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#opacity"]
|
|
||||||
state: {
|
|
||||||
"defined(FRONT_CULLING)" = {
|
|
||||||
cull_mode = "cull_ccw"
|
|
||||||
}
|
|
||||||
"defined(BACK_CULLING)" = {
|
|
||||||
cull_mode = "cull_cw"
|
|
||||||
}
|
|
||||||
"defined(WIREFRAME)" = {
|
|
||||||
cull_mode = "cull_none"
|
|
||||||
fill_mode = "fill_wireframe"
|
|
||||||
"on_renderer(D3D11, D3D12)" = {
|
|
||||||
depth_bias = "-1"
|
|
||||||
depth_bias_clamp = "-0.00015"
|
|
||||||
slope_scale_depth_bias = "-2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"defined(DRAW_INFLUENCE)" = {
|
|
||||||
cull_mode = "cull_none"
|
|
||||||
z_func = "greater_equal"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sampler_state = {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
vertex_position = { type = "float4" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
permutation_sets = {
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" }
|
|
||||||
]
|
|
||||||
passes = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM)" then: [
|
|
||||||
{ layer="reflections" code_block="reflection_probe" render_state="reflection_probe" }
|
|
||||||
|
|
||||||
// { layer="wireframe" code_block="reflection_probe" defines=["DRAW_INFLUENCE_VOLUME" "FRONT_CULLING"] render_state="dev_volume_visualization" }
|
|
||||||
|
|
||||||
{ layer="wireframe" code_block="reflection_probe" defines=["DRAW_INFLUENCE"] render_state="debug_visualization" branch_key="dev_volume_visualization" }
|
|
||||||
|
|
||||||
{ layer="wireframe" code_block="reflection_probe" defines=["DRAW_TRACE_VOLUME" "FRONT_CULLING"] render_state="debug_visualization" branch_key="dev_volume_visualization" }
|
|
||||||
{ layer="wireframe" code_block="reflection_probe" defines=["DRAW_TRACE_VOLUME" "BACK_CULLING"] render_state="debug_visualization" branch_key="dev_volume_visualization" }
|
|
||||||
{ layer="wireframe" code_block="reflection_probe" defines=["DRAW_TRACE_VOLUME" "WIREFRAME"] render_state="debug_visualization" branch_key="dev_volume_visualization" }
|
|
||||||
|
|
||||||
{ layer="wireframe" code_block="reflection_probe" defines=["DRAW_INFLUENCE_VOLUME" "BACK_CULLING"] render_state="debug_visualization" branch_key="dev_volume_visualization" }
|
|
||||||
{ layer="wireframe" code_block="reflection_probe" defines=["DRAW_INFLUENCE_VOLUME" "WIREFRAME"] render_state="debug_visualization" branch_key="dev_volume_visualization" }
|
|
||||||
] }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code_blocks = {
|
|
||||||
reflection_probe = {
|
|
||||||
include:[
|
|
||||||
"core/stingray_renderer/shader_libraries/common#common",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#gbuffer_access",
|
|
||||||
"core/stingray_renderer/shader_libraries/lighting_common#brdf",
|
|
||||||
"core/stingray_renderer/shader_libraries/shadow_map_common#shadow_bias"
|
|
||||||
]
|
|
||||||
|
|
||||||
samplers = {
|
|
||||||
gbuffer1 = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_point"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "gbuffer1"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
|
|
||||||
linear_depth = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_point"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "linear_depth"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
|
|
||||||
reflection_map = {
|
|
||||||
display_name = "Reflection Map"
|
|
||||||
type = "cube"
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
source = "material"
|
|
||||||
slot_name = "reflection_map"
|
|
||||||
}
|
|
||||||
|
|
||||||
radiation_map = {
|
|
||||||
display_name = "Reflection Map"
|
|
||||||
type = "cube"
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
source = "material"
|
|
||||||
slot_name = "radiation_map"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code = {
|
|
||||||
hlsl = """
|
|
||||||
DECLARE_SAMPLER_2D(gbuffer1);
|
|
||||||
DECLARE_SAMPLER_2D(linear_depth);
|
|
||||||
DECLARE_SAMPLER_CUBE(reflection_map);
|
|
||||||
DECLARE_SAMPLER_CUBE(radiation_map);
|
|
||||||
|
|
||||||
struct VS_INPUT {
|
|
||||||
float4 position : POSITION;
|
|
||||||
GRAPH_VERTEX_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PS_INPUT {
|
|
||||||
float4 position : SV_POSITION;
|
|
||||||
float4 w : TEXCOORD1;
|
|
||||||
GRAPH_PIXEL_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
CBUFFER_START(c0)
|
|
||||||
float4x4 world;
|
|
||||||
float4x4 inv_world;
|
|
||||||
float4x4 world_view_proj;
|
|
||||||
GRAPH_MATERIAL_EXPORTS
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
CBUFFER_START(light)
|
|
||||||
float3 light_position;
|
|
||||||
float3 light_proxy_scale;
|
|
||||||
float3 light_box_min;
|
|
||||||
float3 light_box_max;
|
|
||||||
|
|
||||||
// controlled from script data on probe unit propagated through the light material.
|
|
||||||
float3 trace_box_min;
|
|
||||||
float3 trace_box_max;
|
|
||||||
float3 falloff;
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_INPUT vs_main(VS_INPUT input) {
|
|
||||||
PS_INPUT o;
|
|
||||||
|
|
||||||
GraphVertexParams params;
|
|
||||||
GraphVertexResults results;
|
|
||||||
|
|
||||||
// Write automatic params
|
|
||||||
GRAPH_VERTEX_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
#if defined(DRAW_TRACE_VOLUME)
|
|
||||||
float3 scale = trace_box_max - trace_box_min;
|
|
||||||
float4 position = float4(input.position.xyz * scale, 1);
|
|
||||||
position.xyz += (trace_box_min + trace_box_max) * 0.5f;
|
|
||||||
#else
|
|
||||||
float4 position = float4(input.position.xyz * light_proxy_scale, 1);
|
|
||||||
position.xyz += (light_box_min + light_box_max) * 0.5f;
|
|
||||||
#endif
|
|
||||||
GRAPH_VERTEX_PARAM(params, vertex_position) = position;
|
|
||||||
|
|
||||||
o.position = mul(position, world_view_proj);
|
|
||||||
#if !defined(STENCIL_MARK)
|
|
||||||
o.w = encode_world_pos(o.position);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Evaluate all pieces of the graph that should run per-vertex.
|
|
||||||
GRAPH_EVALUATE_VERTEX(results, params);
|
|
||||||
|
|
||||||
// Write results
|
|
||||||
GRAPH_VERTEX_WRITE(o, results, params);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DRAW_INFLUENCE_VOLUME) || defined(DRAW_TRACE_VOLUME)
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
float4 ps_main() : SV_TARGET0
|
|
||||||
{
|
|
||||||
#if defined(WIREFRAME)
|
|
||||||
#if defined(DRAW_INFLUENCE_VOLUME)
|
|
||||||
return float4(1,0.8,0.8,0.5);
|
|
||||||
#else
|
|
||||||
return float4(0.8,1,0.8,0.5);
|
|
||||||
#endif
|
|
||||||
#elif defined(DRAW_INFLUENCE_VOLUME)
|
|
||||||
return float4(1,0,0,0.1);
|
|
||||||
#else
|
|
||||||
return float4(0,1,0,0.1);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
// TODO: does not support scaling atm.
|
|
||||||
|
|
||||||
#if defined(DRAW_INFLUENCE)
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
float4 ps_main(PS_INPUT input
|
|
||||||
#if defined(GL2)
|
|
||||||
, float2 wpos : VPOS
|
|
||||||
#endif
|
|
||||||
) : SV_TARGET0
|
|
||||||
#else
|
|
||||||
struct PS_OUTPUT {
|
|
||||||
float4 reflection : SV_TARGET0;
|
|
||||||
float4 radiation : SV_TARGET1;
|
|
||||||
};
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_OUTPUT ps_main(PS_INPUT input
|
|
||||||
#if defined(GL2)
|
|
||||||
, float2 wpos : VPOS
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#if defined(GL2)
|
|
||||||
half2 uv = wpos.xy / back_buffer_size;
|
|
||||||
#else
|
|
||||||
half2 uv = input.position.xy / back_buffer_size;
|
|
||||||
#endif
|
|
||||||
float d = gbuffer_decode_depth(TEX2D(linear_depth, uv));
|
|
||||||
|
|
||||||
float3 wp = decode_world_pos(input.w, d);
|
|
||||||
float3 op = mul(float4(wp, 1), inv_world).xyz;
|
|
||||||
float3 V = mul(normalize(camera_world._m30_m31_m32 - wp), (float3x3)inv_world);
|
|
||||||
|
|
||||||
#if defined(HAS_LIGHT_COLOR)
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
#else
|
|
||||||
//float3 light_col = light_color;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
half4 gbuffer_1 = TEX2D(gbuffer1, uv);
|
|
||||||
|
|
||||||
float3 gbuffer_normal = gbuffer_decode_normal(gbuffer_1);
|
|
||||||
float3 N = mul(gbuffer_normal, (float3x3)inv_world);
|
|
||||||
half roughness = gbuffer_decode_roughness(gbuffer_1);
|
|
||||||
float mipmap_index = roughness * 7;
|
|
||||||
|
|
||||||
float3 reflection_dir;
|
|
||||||
{
|
|
||||||
reflection_dir = reflect(-V, N);
|
|
||||||
float3 r_max = (trace_box_max - op) / reflection_dir;
|
|
||||||
float3 r_min = (trace_box_min - op) / reflection_dir;
|
|
||||||
float3 r_min_max = max(r_max, r_min);
|
|
||||||
float intersect_dist = min(min(r_min_max.x, r_min_max.y), r_min_max.z);
|
|
||||||
reflection_dir = mul(op + reflection_dir * intersect_dist, (float3x3)world);
|
|
||||||
}
|
|
||||||
|
|
||||||
float3 reflection = rgbm_decode(TEXCUBELOD(reflection_map, reflection_dir, mipmap_index));
|
|
||||||
|
|
||||||
float3 radiation_dir = gbuffer_normal;
|
|
||||||
/*{
|
|
||||||
radiation_dir = N;
|
|
||||||
float3 r_max = (trace_box_max - op) / radiation_dir;
|
|
||||||
float3 r_min = (trace_box_min - op) / radiation_dir;
|
|
||||||
float3 r_min_max = max(r_max, r_min);
|
|
||||||
float intersect_dist = min(min(r_min_max.x, r_min_max.y), r_min_max.z);
|
|
||||||
radiation_dir = mul(op + radiation_dir * intersect_dist, (float3x3)world);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// TODO: this might be wanted, but requires more probes in order to get good result.
|
|
||||||
// float diff_attn = saturate(dot(gbuffer_normal, normalize(world._m30_m31_m32 - wp)));
|
|
||||||
float3 radiation = rgbm_decode(TEXCUBELOD(radiation_map, radiation_dir, 0));
|
|
||||||
|
|
||||||
// Attenuate
|
|
||||||
float3 distances = min(op - light_box_min, light_box_max - op) / falloff;
|
|
||||||
float attn = saturate(min(distances.x, min(distances.y, distances.z)));
|
|
||||||
|
|
||||||
#if defined(DRAW_INFLUENCE)
|
|
||||||
bool3 inside = (distances > 0.0);
|
|
||||||
if(!all(inside))
|
|
||||||
discard;
|
|
||||||
return float4(0, 0, 1, (1.0 - attn) * 0.5);
|
|
||||||
#else
|
|
||||||
PS_OUTPUT o;
|
|
||||||
o.reflection = float4(reflection * attn, attn);
|
|
||||||
o.radiation = float4(radiation * attn, attn);
|
|
||||||
return o;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,532 +0,0 @@
|
||||||
group = "Particle Ribbon/Output"
|
|
||||||
display_name = "Ribbon Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
// TODO: disable sun if it's disabled in environment settings.
|
|
||||||
// TODO: options to disable shadows, local lights, sun_light.
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"e1d24468-d03e-4884-9b0d-dba23aaa94d6" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"0752e133-0c01-4fc4-b45a-a629cad4f850" = {
|
|
||||||
name = "opacity"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity"
|
|
||||||
type = { scalar: ["HAS_OPACITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
"6fd5ebe2-4d15-4ecc-abad-ab9731ea861a" = {
|
|
||||||
name = "fade_range"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Angle Fade Range"
|
|
||||||
type = { vector2: ["HAS_ANGLE_FADE" "NEEDS_EYE_VECTOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"e6347231-6647-4bc3-a1d0-f24e1b3e0562" = "EXTERNAL_ROTATION"
|
|
||||||
"914232a9-5352-43d7-a877-cedfe798541d" = "TANGENT_LOCKED"
|
|
||||||
"e8e86308-83cd-47a1-ab84-82776b3cf0ca" = "SCREEN_SPACE"
|
|
||||||
"9775d054-ef17-4ca4-b5a4-8751c6e1eec6" = "PIVOT"
|
|
||||||
"aaebf627-efab-4c86-8244-359d29d00f33" = "ROTATION"
|
|
||||||
"47a74b09-1932-40d4-ab90-0ec090fb9643" = "BLEND_ADDITIVE"
|
|
||||||
"e267562a-65dc-4547-a9fa-6a605b451cae" = "BLEND_PREMULTIPLIED_ALPHA"
|
|
||||||
"4a42f2e1-1069-4afe-a93f-c7558572780f" = "EMISSIVE_PARTICLES"
|
|
||||||
"5e380f16-5cc6-482b-9df6-af0d2b3bda3c" = "HAS_CUSTOM_FOV"
|
|
||||||
"fea9af88-d417-433a-b475-346b6b03e249" = "HIGH_QUALITY"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Blend Mode"
|
|
||||||
options = {
|
|
||||||
"Alpha Blend" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Additive Blend" = "47a74b09-1932-40d4-ab90-0ec090fb9643"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{ type = "checkbox" display_name = "Emissive particles" option = "4a42f2e1-1069-4afe-a93f-c7558572780f" }
|
|
||||||
{ type = "checkbox" display_name = "Custom FOV" option = "5e380f16-5cc6-482b-9df6-af0d2b3bda3c" }
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
|
|
||||||
ribbon_opacity = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#opacity"]
|
|
||||||
state: {
|
|
||||||
blend_op = "blend_op_add"
|
|
||||||
src_blend = "blend_one"
|
|
||||||
dest_blend = "blend_inv_src_alpha"
|
|
||||||
write_mask0 = "red|green|blue"
|
|
||||||
z_enable = "true"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sampler_state = {
|
|
||||||
}
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
|
|
||||||
"defined(PARTICLE_LIGHTING)": {
|
|
||||||
basis0 = { type = "float4" domains = ["vertex", "pixel"] }
|
|
||||||
basis1 = { type = "float4" domains = ["vertex", "pixel"] }
|
|
||||||
basis2 = { type = "float4" domains = ["vertex", "pixel"] }
|
|
||||||
back_lighting = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
"defined(HAS_ANGLE_FADE)": {
|
|
||||||
world_space_plane_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_WORLD_SPACE_NORMAL)": {
|
|
||||||
world_space_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_PIXEL_DEPTH)": {
|
|
||||||
pixel_depth = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SCREEN_POS)": {
|
|
||||||
screen_pos = { type = "float2" domain = "pixel" }
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
strip_info = { type = "float" semantic = "POSITION1" domain = "vertex" }
|
|
||||||
vertex_size = { type = "float2" semantic = "TEXCOORD7" domain = "vertex" }
|
|
||||||
|
|
||||||
|
|
||||||
"defined(NEEDS_UV_SCALE)": {
|
|
||||||
"defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_data = { type = "float3" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
uv_frame = { type = "float" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"!defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_data = { type = "float2" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
uv_scale = { type = "float2" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
"!defined(NEEDS_UV_SCALE)": {
|
|
||||||
"defined(NEEDS_UV_ANIMATION)": {
|
|
||||||
vertex_uv_frame = { type = "float" semantic = "TEXCOORD0" domains = ["vertex"] }
|
|
||||||
uv_frame = { type = "float" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vertex_tangent = { type = "float3" semantic = "TANGENT" domains = ["vertex"] }
|
|
||||||
ribbon_distance = { type = "float" semantic = "TEXCOORD6" domains = ["vertex"] }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
log_permutations = false
|
|
||||||
permutation_sets = {
|
|
||||||
vertex_modifiers = [
|
|
||||||
]
|
|
||||||
|
|
||||||
default = [
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" defines=["LOCAL_LIGHTS"] }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "defined(EMISSIVE_PARTICLES)" then: [
|
|
||||||
{ layer="hdr_transparent" code_block="ribbon" render_state="ribbon_opacity" }
|
|
||||||
] else: [
|
|
||||||
{ layer="hdr_transparent" code_block="ribbon" render_state="ribbon_opacity" defines=["PARTICLE_LIGHTING" "VS_FOG"] }
|
|
||||||
]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code_blocks = {
|
|
||||||
particle_lighting = {
|
|
||||||
code="""
|
|
||||||
#if defined(PARTICLE_LIGHTING)
|
|
||||||
#if defined(D3D11) || defined(GNM)
|
|
||||||
#define BACK_LIGHTING
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SHADOW_RECEIVING)
|
|
||||||
#define CALCULATE_LIGHTING
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
|
|
||||||
ribbon = {
|
|
||||||
language = "hlsl"
|
|
||||||
|
|
||||||
include:[
|
|
||||||
"particle_lighting"
|
|
||||||
"core/stingray_renderer/shader_libraries/common#common",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#gbuffer_access",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#fog",
|
|
||||||
"core/stingray_renderer/shader_libraries/lighting_common#brdf",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#taa_offsets",
|
|
||||||
"core/stingray_renderer/shader_libraries/shadow_map_common#shadow_bias"
|
|
||||||
"core/stingray_renderer/shader_libraries/shadow_map_common#shadow_map_filtering"
|
|
||||||
"core/stingray_renderer/shader_libraries/lighting_common#clustered_shading"
|
|
||||||
"core/stingray_renderer/shader_libraries/particle_lighting_common#radiosity_normal_mapping"
|
|
||||||
"core/stingray_renderer/shader_libraries/particle_lighting_common#particle_debug" ]
|
|
||||||
|
|
||||||
instance_data = {
|
|
||||||
}
|
|
||||||
|
|
||||||
stage_conditions = {
|
|
||||||
}
|
|
||||||
|
|
||||||
samplers = {
|
|
||||||
"defined(DISTORTION)": {
|
|
||||||
hdr0 = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "hdr0"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"defined(PARTICLE_LIGHTING)": {
|
|
||||||
global_diffuse_map = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "global_diffuse_map"
|
|
||||||
type = "cube"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"defined(NEEDS_LINEAR_DEPTH)": {
|
|
||||||
linear_depth = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_point"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "linear_depth"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
code = """
|
|
||||||
#if defined(HAS_NORMAL) && !defined(WORLD_SPACE_NORMAL)
|
|
||||||
#define NEEDS_TANGENT_SPACE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_PIXEL_DEPTH) || defined(PARTICLE_LIGHTING)
|
|
||||||
#define PS_NEEDS_WP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_LINEAR_DEPTH)
|
|
||||||
DECLARE_SAMPLER_2D(linear_depth);
|
|
||||||
#define HAS_LINEAR_DEPTH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct VS_INPUT {
|
|
||||||
float4 position : POSITION;
|
|
||||||
GRAPH_VERTEX_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PS_INPUT {
|
|
||||||
float4 position : SV_POSITION;
|
|
||||||
#if defined(PS_NEEDS_WP)
|
|
||||||
float3 world_pos : TEXCOORD15;
|
|
||||||
#endif
|
|
||||||
#if defined(VS_FOG)
|
|
||||||
float4 fog_params : TEXCOORD16;
|
|
||||||
#endif
|
|
||||||
GRAPH_PIXEL_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
CBUFFER_START(c_ribbon)
|
|
||||||
float4x4 view;
|
|
||||||
float4x4 view_proj;
|
|
||||||
#if defined(EMISSIVE_PARTICLES)
|
|
||||||
float emissive_particle_intensity;
|
|
||||||
#endif
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
CBUFFER_START(c_material_exports)
|
|
||||||
GRAPH_MATERIAL_EXPORTS
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_INPUT vs_main(VS_INPUT input)
|
|
||||||
{
|
|
||||||
PS_INPUT o;
|
|
||||||
|
|
||||||
GraphVertexParams params;
|
|
||||||
GraphVertexResults results;
|
|
||||||
|
|
||||||
// Write automatic params
|
|
||||||
GRAPH_VERTEX_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
|
|
||||||
float3 y = GRAPH_VERTEX_DATA(input, vertex_tangent);
|
|
||||||
float3 x = normalize(cross(normalize(input.position.xyz - camera_pos), y));
|
|
||||||
|
|
||||||
float3 x_axis = x;
|
|
||||||
float3 y_axis = y;
|
|
||||||
|
|
||||||
float strip_info = GRAPH_VERTEX_DATA(input, strip_info);
|
|
||||||
float2 size = GRAPH_VERTEX_DATA(input, vertex_size);
|
|
||||||
float corner = strip_info * (size.x * 0.5);
|
|
||||||
|
|
||||||
float3 wp = input.position.xyz + (x_axis * corner);
|
|
||||||
|
|
||||||
#if defined(HAS_CUSTOM_FOV)
|
|
||||||
float4 p = mul(float4(wp, 1),camera_custom_fov_view_projection);
|
|
||||||
#else
|
|
||||||
float4 p = mul(float4(wp, 1), view_proj);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(NEEDS_EYE_VECTOR)
|
|
||||||
GRAPH_VERTEX_PARAM(params, eye_vector).rgb = camera_pos - wp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TOOD: Move this code to its own shader node!
|
|
||||||
#if defined(NEEDS_UV_SCALE)
|
|
||||||
#if defined(NEEDS_UV_ANIMATION)
|
|
||||||
GRAPH_VERTEX_PARAM(params, uv_frame) = GRAPH_VERTEX_DATA(input, vertex_uv_data).z;
|
|
||||||
#endif
|
|
||||||
GRAPH_VERTEX_PARAM(params, uv_scale) = GRAPH_VERTEX_DATA(input, vertex_uv_data).xy;
|
|
||||||
#elif defined(NEEDS_UV_ANIMATION)
|
|
||||||
GRAPH_VERTEX_PARAM(params, uv_frame) = GRAPH_VERTEX_DATA(input, vertex_uv_frame);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PARTICLE_LIGHTING)
|
|
||||||
float3 normal = normalize(lerp(wp - input.position.xyz, -view._m01_m11_m21, 0.2));
|
|
||||||
normal = mul(normal, (float3x3)view);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PARTICLE_LIGHTING)
|
|
||||||
float4 basis0 = float4(0,0,0,1);
|
|
||||||
float4 basis1 = float4(0,0,0,1);
|
|
||||||
float4 basis2 = float4(0,0,0,1);
|
|
||||||
float3 back_lighting = float3(0,0,0);
|
|
||||||
calc_basis_lighting(basis0, basis1, basis2, back_lighting, wp, normal, view, p);
|
|
||||||
GRAPH_VERTEX_PARAM(params, basis0) = basis0;
|
|
||||||
GRAPH_VERTEX_PARAM(params, basis1) = basis1;
|
|
||||||
GRAPH_VERTEX_PARAM(params, basis2) = basis2;
|
|
||||||
#if defined(BACK_LIGHTING)
|
|
||||||
GRAPH_VERTEX_PARAM(params, back_lighting) = back_lighting;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Evaluate all pieces of the graph that should run per-vertex.
|
|
||||||
GRAPH_EVALUATE_VERTEX(results, params);
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PS_NEEDS_WP)
|
|
||||||
o.world_pos = wp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(VS_FOG)
|
|
||||||
const float3 view_dir = camera_world._m30_m31_m32 - wp.xyz;
|
|
||||||
const float3 camera_dir = camera_world._m10_m11_m12;
|
|
||||||
const float depth = dot(-view_dir, camera_dir);
|
|
||||||
o.fog_params = calc_fog_vs(wp, depth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
o.position = p;
|
|
||||||
|
|
||||||
// Write results
|
|
||||||
GRAPH_VERTEX_WRITE(o, results, params);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
#elif defined(DISTORTION) // TODO: avoid sample from objects infront of the "distortion"
|
|
||||||
DECLARE_SAMPLER_2D(hdr0);
|
|
||||||
#if !defined(LOW_RES) && defined(LOW_RES_ENABLED)
|
|
||||||
DECLARE_SAMPLER_2D(hdr_transparent_div4);
|
|
||||||
DECLARE_SAMPLER_2D(hdr_linear_depth_div4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LOW_RES
|
|
||||||
struct PS_OUTPUT {
|
|
||||||
half4 color : SV_TARGET0;
|
|
||||||
half4 depth : SV_TARGET1;
|
|
||||||
};
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_OUTPUT ps_main(PS_INPUT input)
|
|
||||||
#else
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
half4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
#if (!defined(LOW_RES) && defined(LOW_RES_ENABLED)) || defined(NEEDS_SCREEN_POS)
|
|
||||||
#if defined(LOW_RES)
|
|
||||||
float2 screen_position = input.position.xy / (back_buffer_size * 0.25);
|
|
||||||
#else
|
|
||||||
float2 screen_position = (input.position.xy / back_buffer_size);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_SCREEN_POS)
|
|
||||||
GRAPH_PIXEL_PARAM(params, screen_pos) = screen_position;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PS_NEEDS_WP)
|
|
||||||
const float3 world_pos = input.world_pos;
|
|
||||||
const float3 view_dir = camera_world._m30_m31_m32 - world_pos;
|
|
||||||
const float3 camera_dir = camera_world._m10_m11_m12;
|
|
||||||
|
|
||||||
const float depth = dot(-view_dir, camera_dir);
|
|
||||||
#endif
|
|
||||||
#if defined(NEEDS_PIXEL_DEPTH)
|
|
||||||
GRAPH_PIXEL_PARAM(params, pixel_depth) = depth;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
|
|
||||||
float3 normal = graph.distortion_normal;
|
|
||||||
normal.rg = normal.rg * 2 - 1;
|
|
||||||
half2 distortion = normal.xy / back_buffer_size;
|
|
||||||
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
half opacity = saturate(graph.opacity);
|
|
||||||
#else
|
|
||||||
half opacity = 0.5;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(LOW_RES) && defined(LOW_RES_ENABLED)
|
|
||||||
// Fade out high resolution particle if the low resolution particles is infront of the high resolution particle
|
|
||||||
float2 particle_depth_values = TEX2D(hdr_linear_depth_div4, screen_position).rg;
|
|
||||||
float depth_mean = particle_depth_values.x;
|
|
||||||
float depth_variance = particle_depth_values.y - depth_mean*depth_mean;
|
|
||||||
float background_depth = depth;
|
|
||||||
|
|
||||||
float diff = max(background_depth - depth_mean, 0.0);
|
|
||||||
float C = 1.38629436112; // 2 * ln(2)
|
|
||||||
float T = exp2(-diff*diff / (C * max(depth_variance, 0.001)));
|
|
||||||
float alpha_modifier = TEX2D(hdr_transparent_div4, screen_position).a * (1.0 - T);
|
|
||||||
opacity *= 1.0 - alpha_modifier;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float3 color = TEX2D(hdr0, screen_position + (distortion * graph.distortion_strength)).rgb;
|
|
||||||
|
|
||||||
#if defined(HAS_BASE_COLOR)
|
|
||||||
color *= graph.base_color;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LOW_RES
|
|
||||||
PS_OUTPUT o;
|
|
||||||
o.color = half4(color * opacity, opacity);
|
|
||||||
float alpha_depth = depth * opacity;
|
|
||||||
o.depth = half4(alpha_depth, alpha_depth * alpha_depth, 0.0, opacity);
|
|
||||||
return o;
|
|
||||||
#else
|
|
||||||
#if defined(PARTICLE_DEBUG)
|
|
||||||
return DISTORTION_PARTICLES_DEBUG_COLOR;
|
|
||||||
#else
|
|
||||||
return half4(color * opacity, opacity);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
*/
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
half4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
{
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
#if defined(PS_NEEDS_WP)
|
|
||||||
const float3 world_pos = input.world_pos;
|
|
||||||
const float3 view_dir = camera_world._m30_m31_m32 - world_pos;
|
|
||||||
const float3 camera_dir = camera_world._m10_m11_m12;
|
|
||||||
|
|
||||||
const float depth = dot(-view_dir, camera_dir);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_PIXEL_DEPTH)
|
|
||||||
GRAPH_PIXEL_PARAM(params, pixel_depth) = depth;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
half opacity = saturate(graph.opacity);
|
|
||||||
#else
|
|
||||||
half opacity = 0.5;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAS_BASE_COLOR)
|
|
||||||
float4 color = float4(graph.base_color, opacity);
|
|
||||||
#else
|
|
||||||
float4 color = float4(1,1,1, opacity);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PARTICLE_LIGHTING)
|
|
||||||
float4 basis0 = GRAPH_PIXEL_DATA(input, basis0);
|
|
||||||
float4 basis1 = GRAPH_PIXEL_DATA(input, basis1);
|
|
||||||
float4 basis2 = GRAPH_PIXEL_DATA(input, basis2);
|
|
||||||
#if defined(BACK_LIGHTING)
|
|
||||||
float3 back_lighting = GRAPH_PIXEL_DATA(input, back_lighting);
|
|
||||||
#endif
|
|
||||||
float3 normal = normalize(float3(basis0.w, basis1.w, basis2.w));
|
|
||||||
color.rgb = calc_lighting(color, normal, back_lighting, basis0.xyz, basis1.xyz, basis2.xyz);
|
|
||||||
#if defined(VS_FOG)
|
|
||||||
// apply vs calculated fog
|
|
||||||
color.rgb = lerp(color.rgb, input.fog_params.rgb, input.fog_params.a);
|
|
||||||
#else
|
|
||||||
color = apply_fog(color, world_pos, depth);
|
|
||||||
#endif
|
|
||||||
#elif defined(EMISSIVE_PARTICLES)
|
|
||||||
color.rgb *= emissive_particle_intensity;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
#if defined(HAS_ANGLE_FADE)
|
|
||||||
float3 plane_wn = normalize(GRAPH_PIXEL_DATA(input, world_space_plane_normal));
|
|
||||||
float3 eye_dir = normalize(GRAPH_PIXEL_DATA(input, eye_vector));
|
|
||||||
float fade = dot(plane_wn, eye_dir);
|
|
||||||
opacity *= saturate((fade - graph.fade_range.x) / (graph.fade_range.y - graph.fade_range.x));
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
half4 output_color = half4(color.rgb * opacity, opacity);
|
|
||||||
#if defined(BLEND_ADDITIVE)
|
|
||||||
output_color.a = 0.0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return output_color;
|
|
||||||
}
|
|
||||||
//#endif
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,207 +0,0 @@
|
||||||
group = "Output"
|
|
||||||
display_name = "Skydome Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"19499850-aa42-40f8-a51e-75abb592e92b" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = true
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"582dd9e3-a746-4913-8eae-d8569b6d7b39" = "CAMERA_LOCK_XY"
|
|
||||||
"1e637d96-cadf-4d3c-a1c6-fc31ce81adf8" = "CAMERA_LOCK_Z"
|
|
||||||
"efe865a9-2225-4b9b-92dd-6080d4bfa417" = "SKYDOME_RGBM"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
{ type = "checkbox" display_name = "Lock Camera in XY-plane" option = "582dd9e3-a746-4913-8eae-d8569b6d7b39" }
|
|
||||||
{ type = "checkbox" display_name = "Lock Camera in Z-plane" option = "1e637d96-cadf-4d3c-a1c6-fc31ce81adf8" }
|
|
||||||
{ type = "checkbox" display_name = "Skydome Texture RGBM encoded" option = "efe865a9-2225-4b9b-92dd-6080d4bfa417" }
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
ambient_no_depth_write = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#ambient"]
|
|
||||||
states = {
|
|
||||||
z_write_enable = "false"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
filter = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
states = {
|
|
||||||
cull_mode = "cull_none"
|
|
||||||
z_write_enable = "false"
|
|
||||||
z_enable = "false"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sampler_state = { }
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex_position = { type = "float4" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
log_permutations = false
|
|
||||||
permutation_sets = {
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
material_transfer = {
|
|
||||||
passes_sort_mode = "immediate"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ code_block="skydome" defines=["MATERIAL_TRANSFER"] render_state="filter" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ layer="skydome" code_block="skydome" defines=["PROJECT_TO_FAR_PLANE"] render_state="ambient_no_depth_write" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code_blocks = {
|
|
||||||
skydome = {
|
|
||||||
include:[
|
|
||||||
"core/stingray_renderer/shader_libraries/common#common",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#gbuffer_access"]
|
|
||||||
|
|
||||||
instance_data = {
|
|
||||||
}
|
|
||||||
|
|
||||||
stage_conditions = {
|
|
||||||
}
|
|
||||||
|
|
||||||
samplers = {
|
|
||||||
}
|
|
||||||
|
|
||||||
code = {
|
|
||||||
hlsl = """
|
|
||||||
#if defined(NEEDS_EYE_VECTOR) || defined(CAMERA_LOCK_XY) || defined(CAMERA_LOCK_Z)
|
|
||||||
#define NEEDS_WORLD_SPACE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct VS_INPUT {
|
|
||||||
float4 position : POSITION;
|
|
||||||
GRAPH_VERTEX_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PS_INPUT {
|
|
||||||
float4 position : SV_POSITION;
|
|
||||||
GRAPH_PIXEL_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
CBUFFER_START(c0)
|
|
||||||
#if defined(CAMERA_LOCK_XY) || defined(NEEDS_WORLD_SPACE)
|
|
||||||
float4x4 world;
|
|
||||||
#endif
|
|
||||||
#if defined(CAMERA_LOCK_XY)
|
|
||||||
float4x4 view;
|
|
||||||
float4x4 proj;
|
|
||||||
#endif
|
|
||||||
float4x4 world_view_proj;
|
|
||||||
GRAPH_MATERIAL_EXPORTS
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_INPUT vs_main(VS_INPUT input)
|
|
||||||
{
|
|
||||||
PS_INPUT o;
|
|
||||||
float4 p;
|
|
||||||
|
|
||||||
GraphVertexParams params;
|
|
||||||
GraphVertexResults results;
|
|
||||||
|
|
||||||
// Write automatic params
|
|
||||||
GRAPH_VERTEX_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
// Write output channels
|
|
||||||
float4 position = input.position;
|
|
||||||
#if defined(NEEDS_WORLD_SPACE)
|
|
||||||
float4 wp = mul(position, world);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRAPH_VERTEX_PARAM(params, vertex_position) = position;
|
|
||||||
|
|
||||||
#if defined(NEEDS_EYE_VECTOR)
|
|
||||||
// TODO: this eye_vector can't be used to calculate distance (length(eye_vector) in this case
|
|
||||||
GRAPH_VERTEX_PARAM(params, eye_vector).rgb = -wp.rgb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Evaluate all pieces of the graph that should run per-vertex.
|
|
||||||
GRAPH_EVALUATE_VERTEX(results, params);
|
|
||||||
|
|
||||||
#if defined(CAMERA_LOCK_XY)
|
|
||||||
#if defined(CAMERA_LOCK_Z)
|
|
||||||
view._m30_m31_m32 = float3(0,0,0);
|
|
||||||
#else
|
|
||||||
view._m30_m31 = float2(0,0);
|
|
||||||
#endif
|
|
||||||
p = mul(mul(wp, view), proj);
|
|
||||||
#else
|
|
||||||
p = mul(position, world_view_proj);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PROJECT_TO_FAR_PLANE)
|
|
||||||
p.z = p.w;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
o.position = p;
|
|
||||||
|
|
||||||
/*
|
|
||||||
// TODO: try import uv again!
|
|
||||||
#if defined(MATERIAL_TRANSFER)
|
|
||||||
float2 tmp = GRAPH_VERTEX_DATA(input, uv);
|
|
||||||
tmp.y = 1 - tmp.y;
|
|
||||||
o.position = float4(tmp * 2 - 1, 0, 1);
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Write results
|
|
||||||
GRAPH_VERTEX_WRITE(o, results, params);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
half4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
{
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
|
|
||||||
half4 c = half4(graph.base_color, 1.0);
|
|
||||||
|
|
||||||
//#if defined(MATERIAL_TRANSFER)
|
|
||||||
// c.rgb = pow(c.rgb, 1.f / 2.2f);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,764 +0,0 @@
|
||||||
group = "Output"
|
|
||||||
display_name = "Terrain Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"aca690cb-6305-4a2f-bf3d-69183a493db3" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"34259752-b962-4b65-92c3-903a57338519" = {
|
|
||||||
name = "opacity"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity"
|
|
||||||
type = { scalar: ["HAS_OPACITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"7a9306c6-95ae-4cdb-9fef-0eedacce4e83" = {
|
|
||||||
name = "opacity_threshold"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity Threshold"
|
|
||||||
type = { scalar: ["HAS_OPACITY_THRESHOLD"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"b1c86408-aacb-4466-b754-ddcf37a3a2c8" = {
|
|
||||||
is_required = false
|
|
||||||
name = "normal"
|
|
||||||
display_name = "Normal"
|
|
||||||
type = { vector3: ["HAS_NORMAL"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"ad5e052f-d316-4a0f-8b79-53c38204d61b" = {
|
|
||||||
is_required = false
|
|
||||||
name = "metallic"
|
|
||||||
display_name = "Metallic"
|
|
||||||
type = { scalar: ["HAS_METALLIC"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"36ba46d2-f6ea-4e60-a428-fdc17c75bc62" = {
|
|
||||||
is_required = false
|
|
||||||
name = "roughness"
|
|
||||||
display_name = "Roughness"
|
|
||||||
type = { scalar: ["HAS_ROUGHNESS"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"59fd1cf4-f736-470d-8510-1dd7c016639e" = {
|
|
||||||
is_required = false
|
|
||||||
name = "ambient_occlusion"
|
|
||||||
display_name = "Ambient Occlusion"
|
|
||||||
type = { scalar: ["HAS_AMBIENT_OCCLUSION"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"6ae3afc3-7a2d-4572-a376-f2649241c71d" = {
|
|
||||||
is_required = false
|
|
||||||
name = "density"
|
|
||||||
display_name = "Density"
|
|
||||||
type = { scalar: ["HAS_DENSITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"a84e242a-2ee2-4542-846a-3691a583e62c" = "USE_GLOBAL_ROUGHNESS_MULTIPLIER"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
{ type = "checkbox" display_name = "Use Global Roughness Multiplier" option = "a84e242a-2ee2-4542-846a-3691a583e62c" }
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
terrain = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#gbuffer_material"]
|
|
||||||
state: {
|
|
||||||
fill_mode = "fill_solid"
|
|
||||||
cull_mode = "cull_ccw"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
terrain_alpha_masked_with_prez = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#gbuffer_material"]
|
|
||||||
state: {
|
|
||||||
|
|
||||||
fill_mode = "fill_solid"
|
|
||||||
cull_mode = "cull_ccw"
|
|
||||||
z_func = "equal"
|
|
||||||
z_write_enable = "false"
|
|
||||||
z_enable = "true"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
depth_only = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
state: {
|
|
||||||
write_mask0 = "0x0"
|
|
||||||
write_mask1 = "0x0"
|
|
||||||
write_mask2 = "0x0"
|
|
||||||
write_mask3 = "0x0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
terrain_depth_prepass = {
|
|
||||||
inherit: ["depth_only"]
|
|
||||||
state: {
|
|
||||||
fill_mode = "fill_solid"
|
|
||||||
cull_mode = "cull_ccw"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wireframe = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#opacity"]
|
|
||||||
state: {
|
|
||||||
fill_mode = "fill_wireframe"
|
|
||||||
"on_renderer(D3D11, D3D12)" = {
|
|
||||||
depth_bias = "-1"
|
|
||||||
depth_bias_clamp = "-0.00015"
|
|
||||||
slope_scale_depth_bias = "-2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadow_caster = {
|
|
||||||
inherit: ["depth_only"]
|
|
||||||
state: {
|
|
||||||
"on_renderer(D3D11, D3D12)" = {
|
|
||||||
depth_bias = "0xff"
|
|
||||||
slope_scale_depth_bias = "1.0"
|
|
||||||
}
|
|
||||||
"on_renderer(GNM)" = {
|
|
||||||
offset_front = "0.0001"
|
|
||||||
offset_scale_front = "40.0"
|
|
||||||
offset_back = "0.0001"
|
|
||||||
offset_scale_back = "40.0"
|
|
||||||
}
|
|
||||||
"on_renderer(GL)" = {
|
|
||||||
offset_factor = "1.0"
|
|
||||||
offset_units = "1024.0"
|
|
||||||
depth_bias_enable = "true"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sampler_state = { }
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
"defined(NEEDS_TANGENT_SPACE)": {
|
|
||||||
tsm0 = { type = "float3" domain = "vertex" }
|
|
||||||
tsm1 = { type = "float3" domain = "vertex" }
|
|
||||||
tsm2 = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MOTION_BLUR)": {
|
|
||||||
last_clip_position = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex_position = { type = "float4" domain = "vertex" }
|
|
||||||
terrain_uv = { type = "float2" domains=["vertex" "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
permutation_sets = {
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
shadow_caster = {
|
|
||||||
passes_sort_mode = "immediate"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM)" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ code_block="terrain_depth_only" render_state="shadow_caster" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM)" permute_with: "default" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "defined(HAS_OPACITY)" then: [
|
|
||||||
{ layer="depth_prepass" code_block="terrain_depth_only" defines=["DEPTH_PREPASS"] render_state="terrain_depth_prepass" } // TODO: Make a depth shader
|
|
||||||
{ layer="gbuffer_terrain" code_block="terrain" defines="MOTION_BLUR" render_state="terrain_alpha_masked_with_prez" }
|
|
||||||
//{ layer="gbuffer_terrain" code_block="terrain" defines=["MOTION_BLUR" "SINGLE_PASS"] render_state="terrain" }
|
|
||||||
] else: [
|
|
||||||
{ layer="gbuffer_terrain" code_block="terrain" defines="MOTION_BLUR" render_state="terrain" }
|
|
||||||
]}
|
|
||||||
{ if: "!on_renderer(GL)" then: [
|
|
||||||
{ layer="wireframe" code_block="terrain_depth_only" defines=["DRAW_WIREFRAME"] render_state="wireframe" branch_key="dev_wireframe" }
|
|
||||||
]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code_blocks = {
|
|
||||||
terrain_shared = {
|
|
||||||
code = {
|
|
||||||
hlsl = """
|
|
||||||
float2 morph(float2 uv, float2 wp, float t, float gsize, float psize) {
|
|
||||||
float3 grid_size = { gsize, gsize*0.5, 2.f/gsize };
|
|
||||||
float2 frac_part = (frac(uv*grid_size.yy) * grid_size.zz) * psize.xx;
|
|
||||||
return wp - frac_part * t;
|
|
||||||
}
|
|
||||||
|
|
||||||
float3 normal_from_hmap(Sampler2D height_map, float2 uv, float2 texel_size, float texel_aspect) {
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
float4 h = {
|
|
||||||
TEX2D(height_map, uv + texel_size * float2(-1, 0)).r,
|
|
||||||
TEX2D(height_map, uv + texel_size * float2(1, 0)).r,
|
|
||||||
TEX2D(height_map, uv + texel_size * float2(0, -1)).r,
|
|
||||||
TEX2D(height_map, uv + texel_size * float2(0, 1)).r
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
h *= texel_aspect;
|
|
||||||
|
|
||||||
float3 n = {
|
|
||||||
h[0] - h[1],
|
|
||||||
h[3] - h[2],
|
|
||||||
2
|
|
||||||
};
|
|
||||||
|
|
||||||
return normalize(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
float3 normal_from_hmap(Sampler2D height_map, float4 uv_lod, float2 texel_size, float texel_aspect) {
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
float4 h = {
|
|
||||||
TEX2DLOD(height_map, uv_lod.xy + texel_size * float2(-1, 0), uv_lod.zw).r,
|
|
||||||
TEX2DLOD(height_map, uv_lod.xy + texel_size * float2(1, 0), uv_lod.zw).r,
|
|
||||||
TEX2DLOD(height_map, uv_lod.xy + texel_size * float2(0, -1), uv_lod.zw).r,
|
|
||||||
TEX2DLOD(height_map, uv_lod.xy + texel_size * float2(0, 1), uv_lod.zw).r
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
h *= texel_aspect;
|
|
||||||
|
|
||||||
float3 n = {
|
|
||||||
h[0] - h[1],
|
|
||||||
h[3] - h[2],
|
|
||||||
2
|
|
||||||
};
|
|
||||||
|
|
||||||
return normalize(n);
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
terrain = {
|
|
||||||
include:[
|
|
||||||
"core/stingray_renderer/shader_libraries/common#common",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#gbuffer_access",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#taa_offsets",
|
|
||||||
"terrain_shared" ]
|
|
||||||
|
|
||||||
samplers = {
|
|
||||||
//global_diffuse_map = {
|
|
||||||
// sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
// source = "resource_set"
|
|
||||||
// slot_name = "global_diffuse_map"
|
|
||||||
// type = "cube"
|
|
||||||
//}
|
|
||||||
hmap = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "hmap"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code = {
|
|
||||||
hlsl = """
|
|
||||||
#if defined(PS_NEEDS_WP) || defined(NEEDS_EYE_VECTOR)
|
|
||||||
#define NEEDS_WORLD_SPACE_POSITION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DECLARE_SAMPLER_2D(hmap);
|
|
||||||
|
|
||||||
struct VS_INPUT {
|
|
||||||
float4 position : POSITION;
|
|
||||||
GRAPH_VERTEX_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PS_INPUT {
|
|
||||||
float4 position : SV_POSITION;
|
|
||||||
float4 color : COLOR;
|
|
||||||
GRAPH_PIXEL_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
CBUFFER_START(c_per_object)
|
|
||||||
float4x4 world;
|
|
||||||
float4x4 world_view_proj;
|
|
||||||
float3 terrain_size;
|
|
||||||
float3 lod_camera_pos;
|
|
||||||
float4x4 last_world;
|
|
||||||
|
|
||||||
#if defined(USE_GLOBAL_ROUGHNESS_MULTIPLIER)
|
|
||||||
float global_roughness_multiplier;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float4 dev_wireframe_color;
|
|
||||||
GRAPH_MATERIAL_EXPORTS
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
Buffer<float4> idata;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_INPUT vs_main(VS_INPUT input, uint instance_id : SV_InstanceId)
|
|
||||||
{
|
|
||||||
PS_INPUT o;
|
|
||||||
float4 p;
|
|
||||||
|
|
||||||
GraphVertexParams params;
|
|
||||||
GraphVertexResults results;
|
|
||||||
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
float4 pos_scale = idata.Load(instance_id * 2 + 0);
|
|
||||||
float4 tile_info = idata.Load(instance_id * 2 + 1);
|
|
||||||
#endif
|
|
||||||
float2 half_size = terrain_size.xy * 0.5;
|
|
||||||
float2 mip = input.position.xy;
|
|
||||||
float2 pos = (mip.xy - 0.5) * pos_scale.zw + pos_scale.xy;
|
|
||||||
|
|
||||||
float3 temp_wp = mul(float4(pos, 0, 1), world);
|
|
||||||
float t = 1-saturate((distance(temp_wp, camera_pos) - (tile_info.x - pos_scale.z*0.5)) / tile_info.y);
|
|
||||||
|
|
||||||
float2 huv = ((pos.xy / half_size) * 0.5 + 0.5);
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
huv.y = 1-huv.y;
|
|
||||||
#endif
|
|
||||||
float h = TEX2DLOD(hmap, huv, 0).r * terrain_size.z;
|
|
||||||
|
|
||||||
// Write automatic params
|
|
||||||
GRAPH_VERTEX_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
// Write output channels
|
|
||||||
float4 position = float4(pos.xy, h, 1);
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_POSITION)
|
|
||||||
float4 wp = mul(position, world);
|
|
||||||
// TODO: Expose output channel here
|
|
||||||
#endif
|
|
||||||
GRAPH_VERTEX_PARAM(params, vertex_position) = position;
|
|
||||||
|
|
||||||
#if defined(NEEDS_EYE_VECTOR)
|
|
||||||
GRAPH_VERTEX_PARAM(params, eye_vector).rgb = camera_pos - wp.rgb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRAPH_VERTEX_PARAM(params, terrain_uv) = huv;
|
|
||||||
|
|
||||||
#if defined(NEEDS_TANGENT_SPACE)
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
float2 res;
|
|
||||||
TEXTURE_NAME(hmap).GetDimensions(res.x, res.y);
|
|
||||||
float2 inv_hmap_size = 1.0/res;
|
|
||||||
#endif
|
|
||||||
float3 normal = normal_from_hmap(hmap, float4(huv, 0, 0), inv_hmap_size, terrain_size.z);
|
|
||||||
|
|
||||||
// create tangentspace vectors
|
|
||||||
normal = mul(normal, (float3x3)world);
|
|
||||||
float3 tangent = normalize(cross(world._m10_m11_m12, normal)); // TODO: redundant normalize?
|
|
||||||
float3 binormal = normalize(cross(normal, tangent)); // TODO: redundant normalize?
|
|
||||||
|
|
||||||
tspace_transpose(
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm0),
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm1),
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm2),
|
|
||||||
tangent, binormal, normal);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Evaluate all pieces of the graph that should run per-vertex.
|
|
||||||
GRAPH_EVALUATE_VERTEX(results, params);
|
|
||||||
|
|
||||||
p = mul(position, world_view_proj);
|
|
||||||
|
|
||||||
#if defined(MOTION_BLUR)
|
|
||||||
float4 last_wp = mul(position, last_world);
|
|
||||||
float4 last_clip_pos = mul(last_wp, camera_last_view_projection);
|
|
||||||
float4 last_view_space = last_clip_pos / last_clip_pos.w;
|
|
||||||
last_view_space.xy += get_vs_halton_offset(frame_number);
|
|
||||||
last_view_space.xy = last_view_space.xy * 0.5 + 0.5;
|
|
||||||
last_view_space.y = 1.0 - last_view_space.y;
|
|
||||||
last_clip_pos = last_view_space * last_clip_pos.w;
|
|
||||||
GRAPH_VERTEX_PARAM(params, last_clip_position) = last_clip_pos.xyw;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DRAW_WIREFRAME)
|
|
||||||
o.position = p;
|
|
||||||
#else
|
|
||||||
float4 view_space = p / p.w;
|
|
||||||
view_space.xy += get_vs_halton_offset(frame_number);
|
|
||||||
o.position = view_space * p.w;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const float3 lod_cols[8] = {
|
|
||||||
float3(1,0,0),
|
|
||||||
float3(0,1,0),
|
|
||||||
float3(0,0,1),
|
|
||||||
float3(1,1,0),
|
|
||||||
float3(0,1,1),
|
|
||||||
float3(1,1,0.5),
|
|
||||||
float3(1,0,0.5),
|
|
||||||
float3(0,1,0.5)
|
|
||||||
};
|
|
||||||
|
|
||||||
o.color = float4(lod_cols[(uint)tile_info.w], t);
|
|
||||||
|
|
||||||
// Write results
|
|
||||||
GRAPH_VERTEX_WRITE(o, results, params);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DRAW_WIREFRAME)
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
float4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
{
|
|
||||||
return dev_wireframe_color;
|
|
||||||
}
|
|
||||||
#elif defined(DEPTH_ONLY)
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
float4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
{
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
|
|
||||||
#if defined(HAS_OPACITY_THRESHOLD)
|
|
||||||
float threshold = graph.opacity_threshold;
|
|
||||||
#else
|
|
||||||
float threshold = 0.5f;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (graph.opacity < threshold)
|
|
||||||
discard;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return float4(1,1,1,1);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
//DECLARE_SAMPLER_CUBE(global_diffuse_map);
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
GBUFFER_OUT ps_main(PS_INPUT input)
|
|
||||||
{
|
|
||||||
GBUFFER_OUT o;
|
|
||||||
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
|
|
||||||
#if defined(HAS_OPACITY) && defined(SINGLE_PASS)
|
|
||||||
#if defined(HAS_OPACITY_THRESHOLD)
|
|
||||||
float threshold = graph.opacity_threshold;
|
|
||||||
#else
|
|
||||||
float threshold = 0.5f;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (graph.opacity < threshold)
|
|
||||||
discard;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAS_NORMAL)
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
float2 res;
|
|
||||||
TEXTURE_NAME(hmap).GetDimensions(res.x, res.y);
|
|
||||||
float2 inv_hmap_size = 1.0/res;
|
|
||||||
#endif
|
|
||||||
float3 tnormal = normal_from_hmap(hmap, GRAPH_PIXEL_DATA(input, terrain_uv), inv_hmap_size, terrain_size.z);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Base color
|
|
||||||
float3 base_color = float3(0,0,0);
|
|
||||||
#if defined(HAS_BASE_COLOR)
|
|
||||||
base_color = graph.base_color;
|
|
||||||
#else
|
|
||||||
base_color = float3(0.5, 0.5, 0.5);
|
|
||||||
#endif
|
|
||||||
BASE_COLOR(o) = gbuffer_encode_base_color(base_color);
|
|
||||||
|
|
||||||
// World space normal
|
|
||||||
#if defined(HAS_NORMAL)
|
|
||||||
float3 wn = graph.normal;
|
|
||||||
#else
|
|
||||||
float3 wn = tnormal;
|
|
||||||
#endif
|
|
||||||
wn = mul(wn, (float3x3)world);
|
|
||||||
|
|
||||||
NORMAL(o) = gbuffer_encode_normal(wn);
|
|
||||||
|
|
||||||
// Metallic
|
|
||||||
half metallic_ = 0.f;
|
|
||||||
#if defined(HAS_METALLIC)
|
|
||||||
metallic_ = graph.metallic;
|
|
||||||
#else
|
|
||||||
metallic_ = 0.f;
|
|
||||||
#endif
|
|
||||||
METALLIC(o) = gbuffer_encode_metallic_mask(metallic_);
|
|
||||||
|
|
||||||
// Roughness
|
|
||||||
half roughness_ = 0.f;
|
|
||||||
#if defined(HAS_ROUGHNESS)
|
|
||||||
roughness_ = graph.roughness;
|
|
||||||
#else
|
|
||||||
roughness_ = 0.5;
|
|
||||||
#endif
|
|
||||||
#if defined(USE_GLOBAL_ROUGHNESS_MULTIPLIER)
|
|
||||||
roughness_ = saturate(roughness_ * global_roughness_multiplier);
|
|
||||||
#endif
|
|
||||||
ROUGHNESS(o) = gbuffer_encode_roughness(roughness_);
|
|
||||||
|
|
||||||
#if defined(MOTION_BLUR)
|
|
||||||
float3 last_clip_pos = GRAPH_PIXEL_DATA(input, last_clip_position);
|
|
||||||
float2 screen_pos = (input.position.xy / back_buffer_size - viewport.zw) / viewport.xy;
|
|
||||||
float2 last_screen_pos = last_clip_pos.xy / last_clip_pos.z;
|
|
||||||
VELOCITY(o) = encode_velocity(viewport.xy*(screen_pos - last_screen_pos));
|
|
||||||
#else
|
|
||||||
VELOCITY(o) = encode_velocity(float2(0.0, 0.0));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Density
|
|
||||||
half density = 1.0;
|
|
||||||
#if defined(HAS_DENSITY)
|
|
||||||
density = graph.density;
|
|
||||||
#endif
|
|
||||||
DENSITY(o) = density;
|
|
||||||
|
|
||||||
// Since we don't have baked lighting, we don't use this
|
|
||||||
// // Ambient Diffuse
|
|
||||||
// float3 ambient = float3(0, 0, 0);
|
|
||||||
// #if defined(HAS_VERTEX_BAKED_DIFFUSE_LIGHTING)
|
|
||||||
// ambient = GRAPH_PIXEL_DATA(input, baked_light).rgb;
|
|
||||||
// #elif defined(HAS_LIGHTMAP_BAKED_DIFFUSE_LIGHTING) && defined(HAS_UV_UNWRAP)
|
|
||||||
// ambient = TEX2D(lightmap, GRAPH_PIXEL_DATA(input, lightmap_uv)).rgb;
|
|
||||||
// #else
|
|
||||||
// ambient = rgbm_decode(TEXCUBELOD(global_diffuse_map, wn, 0));
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// AMBIENT_DIFFUSE_LIGHT(o) = gbuffer_encode_ambient_diffuse_light(ambient);
|
|
||||||
|
|
||||||
#if defined(HAS_AMBIENT_OCCLUSION)
|
|
||||||
AMBIENT_OCCLUSION(o) = gbuffer_encode_ambient_occlusion(graph.ambient_occlusion);
|
|
||||||
#else
|
|
||||||
AMBIENT_OCCLUSION(o) = gbuffer_encode_ambient_occlusion(1.f);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
terrain_depth_only = {
|
|
||||||
include:[
|
|
||||||
"core/stingray_renderer/shader_libraries/common#common",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#gbuffer_access",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#taa_offsets",
|
|
||||||
"terrain_shared" ]
|
|
||||||
|
|
||||||
samplers = {
|
|
||||||
hmap = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "hmap"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code = {
|
|
||||||
hlsl = """
|
|
||||||
#if defined(PS_NEEDS_WP) || defined(NEEDS_EYE_VECTOR)
|
|
||||||
#define NEEDS_WORLD_SPACE_POSITION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DECLARE_SAMPLER_2D(hmap);
|
|
||||||
|
|
||||||
struct VS_INPUT {
|
|
||||||
float4 position : POSITION;
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
GRAPH_VERTEX_INPUT
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PS_INPUT {
|
|
||||||
float4 position : SV_POSITION;
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
GRAPH_PIXEL_INPUT
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: why does not this tinner buffer work?
|
|
||||||
/*CBUFFER_START(c_per_object_depth_only)
|
|
||||||
float4x4 world;
|
|
||||||
float4x4 world_view_proj;
|
|
||||||
float3 terrain_size;
|
|
||||||
|
|
||||||
float4 dev_wireframe_color;
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
GRAPH_MATERIAL_EXPORTS
|
|
||||||
#endif
|
|
||||||
CBUFFER_END*/
|
|
||||||
|
|
||||||
CBUFFER_START(c_per_object)
|
|
||||||
float4x4 world;
|
|
||||||
float4x4 world_view_proj;
|
|
||||||
float3 terrain_size;
|
|
||||||
float3 lod_camera_pos;
|
|
||||||
float4x4 last_world;
|
|
||||||
|
|
||||||
#if defined(USE_GLOBAL_ROUGHNESS_MULTIPLIER)
|
|
||||||
float global_roughness_multiplier;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float4 dev_wireframe_color;
|
|
||||||
GRAPH_MATERIAL_EXPORTS
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
Buffer<float4> idata;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_INPUT vs_main(VS_INPUT input, uint instance_id : SV_InstanceId)
|
|
||||||
{
|
|
||||||
PS_INPUT o;
|
|
||||||
float4 p;
|
|
||||||
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
GraphVertexParams params;
|
|
||||||
GraphVertexResults results;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
float4 pos_scale = idata.Load(instance_id * 2 + 0);
|
|
||||||
float4 tile_info = idata.Load(instance_id * 2 + 1);
|
|
||||||
#endif
|
|
||||||
float2 half_size = terrain_size.xy * 0.5;
|
|
||||||
float2 mip = input.position.xy;
|
|
||||||
float2 pos = (mip.xy - 0.5) * pos_scale.zw + pos_scale.xy;
|
|
||||||
|
|
||||||
float2 huv = ((pos.xy / half_size) * 0.5 + 0.5);
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
huv.y = 1-huv.y;
|
|
||||||
#endif
|
|
||||||
float h = TEX2DLOD(hmap, huv, 0).r * terrain_size.z;
|
|
||||||
|
|
||||||
float4 position = float4(pos.xy, h, 1);
|
|
||||||
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_POSITION)
|
|
||||||
float4 wp = mul(position, world);
|
|
||||||
// TODO: Expose output channel here
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Write automatic params
|
|
||||||
GRAPH_VERTEX_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
// Write output channels
|
|
||||||
GRAPH_VERTEX_PARAM(params, vertex_position) = position;
|
|
||||||
|
|
||||||
GRAPH_VERTEX_PARAM(params, terrain_uv) = huv;
|
|
||||||
|
|
||||||
#if defined(NEEDS_EYE_VECTOR)
|
|
||||||
GRAPH_VERTEX_PARAM(params, eye_vector).rgb = camera_pos - wp.rgb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_TANGENT_SPACE)
|
|
||||||
#if defined(RENDERER_D3D11) || defined(RENDERER_D3D12) || defined(RENDERER_GNM)
|
|
||||||
float2 res;
|
|
||||||
TEXTURE_NAME(hmap).GetDimensions(res.x, res.y);
|
|
||||||
float2 inv_hmap_size = 1.0/res;
|
|
||||||
#endif
|
|
||||||
float3 normal = normal_from_hmap(hmap, float4(huv, 0, 0), inv_hmap_size, terrain_size.z);
|
|
||||||
|
|
||||||
// create tangentspace vectors
|
|
||||||
normal = mul(normal, (float3x3)world);
|
|
||||||
float3 tangent = normalize(cross(world._m10_m11_m12, normal)); // TODO: redundant normalize?
|
|
||||||
float3 binormal = normalize(cross(normal, tangent)); // TODO: redundant normalize?
|
|
||||||
|
|
||||||
tspace_transpose(
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm0),
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm1),
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm2),
|
|
||||||
tangent, binormal, normal);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Evaluate all pieces of the graph that should run per-vertex.
|
|
||||||
GRAPH_EVALUATE_VERTEX(results, params);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
p = mul(position, world_view_proj);
|
|
||||||
|
|
||||||
#if defined(DEPTH_PREPASS)
|
|
||||||
float4 view_space = p / p.w;
|
|
||||||
view_space.xy += get_vs_halton_offset(frame_number);
|
|
||||||
o.position = view_space * p.w;
|
|
||||||
#else
|
|
||||||
o.position = p;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
// Write results
|
|
||||||
GRAPH_VERTEX_WRITE(o, results, params);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DRAW_WIREFRAME)
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
float4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
{
|
|
||||||
return dev_wireframe_color;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
float4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
{
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
|
|
||||||
#if defined(HAS_OPACITY_THRESHOLD)
|
|
||||||
float threshold = graph.opacity_threshold;
|
|
||||||
#else
|
|
||||||
float threshold = 0.5f;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (graph.opacity < threshold)
|
|
||||||
discard;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return float4(1,1,1,1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,746 +0,0 @@
|
||||||
group = "Output"
|
|
||||||
display_name = "Unlit Base"
|
|
||||||
output_node = true
|
|
||||||
render_configs = ["core/stingray_renderer/renderer"]
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
"aee6e47b-be7b-4d67-a123-2ab5d660b94e" = {
|
|
||||||
name = "vertex_offset"
|
|
||||||
display_name = "Position offset"
|
|
||||||
is_required = false
|
|
||||||
type = { vector3: ["HAS_VERTEX_OFFSET"] }
|
|
||||||
domain = "vertex"
|
|
||||||
}
|
|
||||||
|
|
||||||
"aca690cb-6305-4a2f-bf3d-69183a493db3" = {
|
|
||||||
name = "base_color"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Base Color"
|
|
||||||
type = { vector3: ["HAS_BASE_COLOR"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"34259752-b962-4b65-92c3-903a57338519" = {
|
|
||||||
name = "opacity"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Opacity"
|
|
||||||
type = { scalar: ["HAS_OPACITY"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
|
|
||||||
"c9a30d71-a8ad-4b9e-aedf-d785ae7e301f" = {
|
|
||||||
name = "additive"
|
|
||||||
is_required = false
|
|
||||||
display_name = "Additive"
|
|
||||||
type = { scalar: ["HAS_ADDITIVE"] }
|
|
||||||
domain = "pixel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"d1a42a54-0794-4d57-9aa0-eb35acb6b35c" = "INSTANCED"
|
|
||||||
"8df1b8f7-17c2-4ae4-8c4e-25517ec1df46" = "DOUBLE_SIDED"
|
|
||||||
"34994d84-9d51-48ac-af85-bc053b2c65c3" = "SKIN"
|
|
||||||
"e1bfa889-2503-4ac3-9134-c08a7fa04568" = "PROJECT_TO_FAR_PLANE"
|
|
||||||
"6a6241cc-7d21-4e2e-87c8-8d9c7bdcd322" = "CAMERA_TRANSLATION_LOCK"
|
|
||||||
"435e14e4-556d-4ac1-af14-8dafe63aff8f" = "BLEND_TRANSPARENT"
|
|
||||||
"52c7ce01-ee57-4770-914e-727fc1966962" = "LAYER_EMISSIVE"
|
|
||||||
"182fabd6-9a4d-4cfc-8c8f-0c45ef09a138" = "LAYER_SKYDOME"
|
|
||||||
"4c3163d4-c086-4645-ba1c-0d68a98022a1" = "LAYER_HDR_TRANSPARENT"
|
|
||||||
"c8d8b754-c567-4c7b-9cbd-8acab22beff5" = "LAYER_TRANSPARENT"
|
|
||||||
"afe47c59-33c4-43b2-af4a-817085b1113c" = "DEPTH_TEST_INVERTED"
|
|
||||||
"774556cd-2d1e-4df8-8ae2-5e84800f0c04" = "DEPTH_TEST_DISABLED"
|
|
||||||
"7b8bc0bf-c453-49d2-9415-0e80fec1039f" = "DISABLE_DEPTH_WRITE"
|
|
||||||
"b2556764-e8e9-47cf-9ecc-f53b5d5d73c7" = "HAS_CUSTOM_FOV"
|
|
||||||
}
|
|
||||||
|
|
||||||
ui = [
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Layer"
|
|
||||||
options = {
|
|
||||||
"Emissive" = "52c7ce01-ee57-4770-914e-727fc1966962"
|
|
||||||
"Skydome" = "182fabd6-9a4d-4cfc-8c8f-0c45ef09a138"
|
|
||||||
"HDR Transparent" = "4c3163d4-c086-4645-ba1c-0d68a98022a1"
|
|
||||||
"LDR Transparent" = "c8d8b754-c567-4c7b-9cbd-8acab22beff5"
|
|
||||||
}
|
|
||||||
default = "4c3163d4-c086-4645-ba1c-0d68a98022a1"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Depth Testing"
|
|
||||||
options = {
|
|
||||||
"Normal" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Inverted" = "afe47c59-33c4-43b2-af4a-817085b1113c"
|
|
||||||
"Disabled" = "774556cd-2d1e-4df8-8ae2-5e84800f0c04"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
type = "drop_down"
|
|
||||||
display_name = "Blend Mode"
|
|
||||||
options = {
|
|
||||||
"Opaque" = "00000000-0000-0000-0000-000000000000"
|
|
||||||
"Transparent" = "435e14e4-556d-4ac1-af14-8dafe63aff8f"
|
|
||||||
}
|
|
||||||
default = "00000000-0000-0000-0000-000000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
{ type = "checkbox" display_name = "Disable Depth Writes" option = "7b8bc0bf-c453-49d2-9415-0e80fec1039f" }
|
|
||||||
{ type = "checkbox" display_name = "Double Sided" option = "8df1b8f7-17c2-4ae4-8c4e-25517ec1df46" }
|
|
||||||
{ type = "checkbox" display_name = "Instancing" option = "d1a42a54-0794-4d57-9aa0-eb35acb6b35c" }
|
|
||||||
{ type = "checkbox" display_name = "Project to Far Plane" option = "e1bfa889-2503-4ac3-9134-c08a7fa04568" }
|
|
||||||
{ type = "checkbox" display_name = "Camera Translation Lock" option = "6a6241cc-7d21-4e2e-87c8-8d9c7bdcd322" }
|
|
||||||
{ type = "checkbox" display_name = "Custom FOV" option = "b2556764-e8e9-47cf-9ecc-f53b5d5d73c7" }
|
|
||||||
]
|
|
||||||
|
|
||||||
render_state = {
|
|
||||||
unlit = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
state: {
|
|
||||||
"defined(BLEND_TRANSPARENT)" = {
|
|
||||||
blend_enable = "true"
|
|
||||||
blend_op = "blend_op_add"
|
|
||||||
dest_blend = "blend_inv_src_alpha"
|
|
||||||
src_blend = "blend_one"
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(DEPTH_TEST_DISABLED)" = {
|
|
||||||
z_enable = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(DISABLE_DEPTH_WRITE)" = {
|
|
||||||
z_write_enable = "false"
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(DEPTH_TEST_INVERTED)" = {
|
|
||||||
z_func = "greater_equal"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
material_transfer = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#default"]
|
|
||||||
state: {
|
|
||||||
cull_mode = "cull_none"
|
|
||||||
z_write_enable = "false"
|
|
||||||
z_enable = "false"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wireframe = {
|
|
||||||
inherit: ["core/stingray_renderer/shader_libraries/common#opacity"]
|
|
||||||
state: {
|
|
||||||
fill_mode = "fill_wireframe"
|
|
||||||
"on_renderer(D3D11, D3D12)" = {
|
|
||||||
depth_bias = "-1"
|
|
||||||
depth_bias_clamp = "-0.00015"
|
|
||||||
slope_scale_depth_bias = "-2.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sampler_state = { }
|
|
||||||
|
|
||||||
channels = {
|
|
||||||
"defined(NEEDS_EYE_VECTOR)": {
|
|
||||||
eye_vector = { type = "float3" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_WORLD_SPACE_NORMAL)": {
|
|
||||||
world_space_normal = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MOTION_BLUR)": {
|
|
||||||
last_clip_position = { type = "float3" domains = ["vertex", "pixel"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(MATERIAL_TRANSFER)": {
|
|
||||||
lightmap_uv = { type = "float2" semantic="TEXCOORD1" domains = ["vertex"] }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_SCREEN_POS)": {
|
|
||||||
screen_pos = { type = "float2" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
"defined(NEEDS_PIXEL_DEPTH)": {
|
|
||||||
pixel_depth = { type = "float" domain = "pixel" }
|
|
||||||
}
|
|
||||||
|
|
||||||
vertex_position = { type = "float4" domain = "vertex" }
|
|
||||||
vertex_normal = { type = "float3" semantic = "NORMAL" domain = "vertex" }
|
|
||||||
}
|
|
||||||
|
|
||||||
//log_permutations = true
|
|
||||||
permutation_sets = {
|
|
||||||
vertex_modifiers = [
|
|
||||||
{ if: "num_skin_weights() == 4" define: { "macros": ["SKINNED_4WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 3" define: { "macros": ["SKINNED_3WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 2" define: { "macros": ["SKINNED_2WEIGHTS"] stages: ["vertex"] } }
|
|
||||||
{ if: "num_skin_weights() == 1" define: { "macros": ["SKINNED_1WEIGHT"] stages: ["vertex"] } }
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
instanced_modifiers = [
|
|
||||||
{ default = true }
|
|
||||||
]
|
|
||||||
|
|
||||||
non_instanced_modifiers = [
|
|
||||||
{ permute_with: "vertex_modifiers" }
|
|
||||||
]
|
|
||||||
|
|
||||||
default = [
|
|
||||||
{ if: "defined(INSTANCED)" permute_with: "instanced_modifiers" }
|
|
||||||
{ if: "!defined(INSTANCED)" permute_with: "non_instanced_modifiers" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
shader_contexts = {
|
|
||||||
default = {
|
|
||||||
passes_sort_mode = "deferred"
|
|
||||||
compile_with = [
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL) && defined(LAYER_HDR_TRANSPARENT) && render_setting(low_res_transparency)" defines=["LOW_RES_ENABLED"] permute_with: "default" }
|
|
||||||
{ if: "on_renderer(D3D11, D3D12, GNM, GL)" permute_with: "default" }
|
|
||||||
]
|
|
||||||
|
|
||||||
passes = [
|
|
||||||
{ if: "defined(LAYER_EMISSIVE)" then: [
|
|
||||||
{ layer="emissive" code_block="unlit" defines="MOTION_BLUR" render_state="unlit" }
|
|
||||||
]}
|
|
||||||
{ if: "defined(LAYER_SKYDOME)" then: [
|
|
||||||
{ layer="skydome" code_block="unlit" render_state="unlit" }
|
|
||||||
]}
|
|
||||||
{ if: "defined(LAYER_HDR_TRANSPARENT)" then: [
|
|
||||||
{ layer="hdr_transparent" code_block="unlit" render_state="unlit" }
|
|
||||||
]}
|
|
||||||
|
|
||||||
{ if: "defined(LAYER_TRANSPARENT)" then: [
|
|
||||||
{ layer="transparent" code_block="unlit" render_state="unlit" }
|
|
||||||
] else: [
|
|
||||||
{ if: "!on_renderer(GL)" then: [
|
|
||||||
{ layer="wireframe" code_block="unlit" define="DRAW_WIREFRAME" render_state="wireframe" branch_key="dev_wireframe" }
|
|
||||||
]}
|
|
||||||
]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code_blocks = {
|
|
||||||
macros = {
|
|
||||||
code = {
|
|
||||||
shared = """
|
|
||||||
#define TAA_GUI_DEPTH_BIAS_RANGE 50.0 // The [0, TAA_GUI_DEPTH_BIAS_RANGE] depth range for which we lerp the min-max depth biases for line drawing
|
|
||||||
#define TAA_GUI_MIN_DEPTH_BIAS 0.001 // The depth offset to add for lines drawn at z = 0
|
|
||||||
#define TAA_GUI_MAX_DEPTH_BIAS 0.05 // The depth offset to add for lines drawn at z >= GUI_DEPTH_BIAS_RANGE
|
|
||||||
|
|
||||||
// We need to disable instancing for the material transfer context as it doesn't use the world transform.
|
|
||||||
#if defined(INSTANCED) && defined(MATERIAL_TRANSFER)
|
|
||||||
#undef INSTANCED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PS_NEEDS_WP) || defined(NEEDS_EYE_VECTOR) || defined(HAS_VERTEX_OFFSET) || ((defined(RENDERER_D3D11) || defined(RENDERER_D3D12)) && defined(INSTANCED)) || defined(CAMERA_TRANSLATION_LOCK) || defined(BILLBOARD)
|
|
||||||
#define NEEDS_WORLD_SPACE_POSITION
|
|
||||||
#endif
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unlit = {
|
|
||||||
include:[
|
|
||||||
"core/stingray_renderer/shader_libraries/common#common",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#gbuffer_access",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#skinning",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#taa_offsets",
|
|
||||||
"macros",
|
|
||||||
"core/stingray_renderer/shader_libraries/common#billboard_transformation"]
|
|
||||||
|
|
||||||
instance_data = {
|
|
||||||
"on_renderer(D3D11, D3D12) && !defined(MATERIAL_TRANSFER) && defined(INSTANCED)": {
|
|
||||||
world = { type = "matrix4x4" }
|
|
||||||
"defined(MOTION_BLUR)": {
|
|
||||||
last_world = { type = "matrix4x4" }
|
|
||||||
}
|
|
||||||
"defined(DRAW_WIREFRAME)": {
|
|
||||||
dev_wireframe_color = { type = "vector4" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
samplers = {
|
|
||||||
"defined(NEEDS_LINEAR_DEPTH)": {
|
|
||||||
linear_depth = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_point"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "linear_depth"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"!defined(LOW_RES)": {
|
|
||||||
"defined(LOW_RES_ENABLED)": {
|
|
||||||
hdr_transparent_div4 = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "hdr_transparent_div4"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
|
|
||||||
hdr_linear_depth_div4 = {
|
|
||||||
sampler_state = "core/stingray_renderer/shader_libraries/common#clamp_linear"
|
|
||||||
source = "resource_set"
|
|
||||||
slot_name = "hdr_linear_depth_div4"
|
|
||||||
type = "2d"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
code = {
|
|
||||||
glsl = """
|
|
||||||
#if defined(STAGE_VERTEX)
|
|
||||||
layout(location = POSITION0) in highp vec4 in_pos;
|
|
||||||
|
|
||||||
CBUFFER_START(c_per_object)
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_POSITION)
|
|
||||||
#if defined(CAMERA_TRANSLATION_LOCK)
|
|
||||||
UNIFORM mat4 view;
|
|
||||||
UNIFORM mat4 proj;
|
|
||||||
#else
|
|
||||||
UNIFORM mat4 view_proj;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
UNIFORM mat4 world_view_proj;
|
|
||||||
#endif
|
|
||||||
UNIFORM mat4 world;
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
GraphManualChannels params;
|
|
||||||
GraphResults graph;
|
|
||||||
|
|
||||||
// Write output channels
|
|
||||||
#if defined(SKINNED)
|
|
||||||
vec4 position = vec4(skin_point(in_pos, blendindices, blendweights), 1);
|
|
||||||
mediump vec3 normal = skin_vector(GRAPH_DATA(vertex_normal), blendindices, blendweights);
|
|
||||||
#if defined(NEEDS_TANGENT_SPACE)
|
|
||||||
mediump vec3 tangent = skin_vector(GRAPH_DATA(vertex_tangent), blendindices, blendweights);
|
|
||||||
mediump vec3 binormal = skin_vector(GRAPH_DATA(vertex_binormal), blendindices, blendweights);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
vec4 position = in_pos;
|
|
||||||
mediump vec3 normal = GRAPH_DATA(vertex_normal);
|
|
||||||
#if defined(NEEDS_TANGENT_SPACE)
|
|
||||||
mediump vec3 tangent = GRAPH_DATA(vertex_tangent);
|
|
||||||
mediump vec3 binormal = GRAPH_DATA(vertex_binormal);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_POSITION)
|
|
||||||
vec4 wp = position * world;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRAPH_PARAM(params, vertex_position) = position;
|
|
||||||
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_NORMAL)
|
|
||||||
GRAPH_PARAM(params, world_space_normal) = normal * mat3(world);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_EYE_VECTOR)
|
|
||||||
GRAPH_PARAM(params, eye_vector) = camera_pos - wp.rgb;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_TANGENT_SPACE)
|
|
||||||
tspace_transform_transpose(
|
|
||||||
GRAPH_PARAM(params, tsm0),
|
|
||||||
GRAPH_PARAM(params, tsm1),
|
|
||||||
GRAPH_PARAM(params, tsm2),
|
|
||||||
tangent, binormal, normal,
|
|
||||||
mat3(world));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Evaluate all pieces of the graph that should run per-vertex.
|
|
||||||
graph_evaluate(graph, params);
|
|
||||||
|
|
||||||
vec4 p;
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_POSITION)
|
|
||||||
#if defined(HAS_VERTEX_OFFSET)
|
|
||||||
wp += vec4(graph.vertex_offset, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CAMERA_TRANSLATION_LOCK)
|
|
||||||
view[0][3] = 0.0;
|
|
||||||
view[1][3] = 0.0;
|
|
||||||
view[2][3] = 0.0;
|
|
||||||
p = (wp * view) * proj;
|
|
||||||
#else
|
|
||||||
p = wp * view_proj;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
p = position * world_view_proj;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PROJECT_TO_FAR_PLANE)
|
|
||||||
p.z = p.w;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gl_Position = p;
|
|
||||||
}
|
|
||||||
#elif defined(STAGE_FRAGMENT)
|
|
||||||
layout(location = 0) out mediump vec4 out_color;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
#if defined(HAS_BASE_COLOR) || defined(HAS_OPACITY)
|
|
||||||
GraphManualChannels params;
|
|
||||||
GraphResults graph;
|
|
||||||
graph_evaluate(graph, params);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vec3 color = vec3(0.5, 0.5, 0.5);
|
|
||||||
#if defined(HAS_BASE_COLOR)
|
|
||||||
color = graph.base_color;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float op = 1.0;
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
op = graph.opacity;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
out_color = vec4(color.r, color.g, color.b, op);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
"""
|
|
||||||
|
|
||||||
hlsl = """
|
|
||||||
#if defined(NEEDS_LINEAR_DEPTH)
|
|
||||||
DECLARE_SAMPLER_2D(linear_depth);
|
|
||||||
#define HAS_LINEAR_DEPTH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(LOW_RES) && defined(LOW_RES_ENABLED)
|
|
||||||
DECLARE_SAMPLER_2D(hdr_transparent_div4);
|
|
||||||
DECLARE_SAMPLER_2D(hdr_linear_depth_div4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_PIXEL_DEPTH) || (!defined(LOW_RES) && defined(LOW_RES_ENABLED))
|
|
||||||
#define PS_NEEDS_WP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PS_NEEDS_WP)
|
|
||||||
#define NEEDS_WORLD_SPACE_POSITION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct VS_INPUT {
|
|
||||||
float4 position : POSITION;
|
|
||||||
SKIN_INPUT
|
|
||||||
GRAPH_VERTEX_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PS_INPUT {
|
|
||||||
#if (defined(RENDERER_D3D11) || defined(RENDERER_D3D12)) && defined(INSTANCED) && defined(DRAW_WIREFRAME)
|
|
||||||
float4 instance_wireframe_color : COLOR0;
|
|
||||||
#endif
|
|
||||||
float4 position : SV_POSITION;
|
|
||||||
#if defined(PS_NEEDS_WP)
|
|
||||||
float3 world_pos : TEXCOORD15;
|
|
||||||
#endif
|
|
||||||
GRAPH_PIXEL_INPUT
|
|
||||||
};
|
|
||||||
|
|
||||||
CBUFFER_START(c_per_object)
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_POSITION)
|
|
||||||
#if defined(CAMERA_TRANSLATION_LOCK)
|
|
||||||
float4x4 view;
|
|
||||||
float4x4 proj;
|
|
||||||
#else
|
|
||||||
float4x4 view_proj;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
float4x4 world_view_proj;
|
|
||||||
#endif
|
|
||||||
#if defined(BILLBOARD) && defined(LAYER_SKYDOME_BILLBOARD)
|
|
||||||
#if defined(SECONDARY_SUN_DIRECTION)
|
|
||||||
float3 secondary_sun_direction;
|
|
||||||
#define billboard_direction secondary_sun_direction
|
|
||||||
#else
|
|
||||||
float3 sun_direction;
|
|
||||||
#define billboard_direction sun_direction
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
float4x4 world;
|
|
||||||
float4x4 last_world;
|
|
||||||
float4 dev_wireframe_color;
|
|
||||||
GRAPH_MATERIAL_EXPORTS
|
|
||||||
CBUFFER_END
|
|
||||||
|
|
||||||
#if defined(INSTANCED) && (defined(RENDERER_D3D11) || defined(RENDERER_D3D12))
|
|
||||||
Buffer<float4> idata;
|
|
||||||
float ioffset;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
PS_INPUT vs_main(VS_INPUT input
|
|
||||||
#if defined(INSTANCED) && (defined(RENDERER_D3D11) || defined(RENDERER_D3D12))
|
|
||||||
, uint instance_id : SV_InstanceId
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PS_INPUT o;
|
|
||||||
float4 p;
|
|
||||||
|
|
||||||
GraphVertexParams params;
|
|
||||||
GraphVertexResults results;
|
|
||||||
|
|
||||||
#if defined(INSTANCED) && (defined(RENDERER_D3D11) || defined(RENDERER_D3D12))
|
|
||||||
uint offset = (uint)ioffset + instance_id*IDATA_STRIDE;
|
|
||||||
world[0] = idata.Load(offset + IDATA_world + 0);
|
|
||||||
world[1] = idata.Load(offset + IDATA_world + 1);
|
|
||||||
world[2] = idata.Load(offset + IDATA_world + 2);
|
|
||||||
world[3] = idata.Load(offset + IDATA_world + 3);
|
|
||||||
|
|
||||||
#if defined(MOTION_BLUR)
|
|
||||||
last_world[0] = idata.Load(offset + IDATA_last_world + 0);
|
|
||||||
last_world[1] = idata.Load(offset + IDATA_last_world + 1);
|
|
||||||
last_world[2] = idata.Load(offset + IDATA_last_world + 2);
|
|
||||||
last_world[3] = idata.Load(offset + IDATA_last_world + 3);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DRAW_WIREFRAME)
|
|
||||||
o.instance_wireframe_color = idata.Load(offset + (instance_id*IDATA_STRIDE + IDATA_dev_wireframe_color));
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Write automatic params
|
|
||||||
GRAPH_VERTEX_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
// Write output channels
|
|
||||||
#if defined(SKINNED)
|
|
||||||
float4 position = float4(skin_point(input.position, input.blendindices, input.blendweights), 1);
|
|
||||||
#if defined(MOTION_BLUR)
|
|
||||||
float4 last_position = float4(skin_point_last_frame(input.position, input.blendindices, input.blendweights), 1);
|
|
||||||
#endif
|
|
||||||
#if !defined(BILLBOARD)
|
|
||||||
#if (defined(NEEDS_WORLD_SPACE_NORMAL) || defined(NEEDS_TANGENT_SPACE))
|
|
||||||
float3 normal = skin_vector(GRAPH_VERTEX_DATA(input, vertex_normal).xyz, input.blendindices, input.blendweights);
|
|
||||||
#endif
|
|
||||||
#if defined(NEEDS_TANGENT_SPACE)
|
|
||||||
float3 tangent = skin_vector(GRAPH_VERTEX_DATA(input, vertex_tangent).xyz, input.blendindices, input.blendweights);
|
|
||||||
float3 binormal = skin_vector(GRAPH_VERTEX_DATA(input, vertex_binormal).xyz, input.blendindices, input.blendweights);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
float4 position = input.position;
|
|
||||||
#if defined(MOTION_BLUR)
|
|
||||||
float4 last_position = position;
|
|
||||||
#endif
|
|
||||||
#if !defined(BILLBOARD)
|
|
||||||
#if (defined(NEEDS_WORLD_SPACE_NORMAL) || defined(NEEDS_TANGENT_SPACE))
|
|
||||||
float3 normal = GRAPH_VERTEX_DATA(input, vertex_normal).xyz;
|
|
||||||
#endif
|
|
||||||
#if defined(NEEDS_TANGENT_SPACE)
|
|
||||||
float3 tangent = GRAPH_VERTEX_DATA(input, vertex_tangent).xyz;
|
|
||||||
float3 binormal = GRAPH_VERTEX_DATA(input, vertex_binormal).xyz;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(BILLBOARD)
|
|
||||||
float4 wp;
|
|
||||||
float3 normal, tangent, binormal;
|
|
||||||
#if !defined(LAYER_SKYDOME_BILLBOARD)
|
|
||||||
get_billboard_data_from_position(world._m30_m31_m32, camera_world._m30_m31_m32, camera_view, position, wp, normal, tangent, binormal);
|
|
||||||
#else
|
|
||||||
get_billboard_data_from_direction(billboard_direction, position, wp, normal, tangent, binormal);
|
|
||||||
#endif
|
|
||||||
#elif defined(NEEDS_WORLD_SPACE_POSITION)
|
|
||||||
float4 wp = mul(position, world);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRAPH_VERTEX_PARAM(params, vertex_position) = position;
|
|
||||||
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_NORMAL)
|
|
||||||
GRAPH_VERTEX_PARAM(params, world_space_normal).rgb = mul(normal, (float3x3)world);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_EYE_VECTOR)
|
|
||||||
#if defined(BILLBOARD) && defined(LAYER_SKYDOME_BILLBOARD)
|
|
||||||
// TODO: not correct length, we can't use length(eye_vector) to determine the distance
|
|
||||||
GRAPH_VERTEX_PARAM(params, eye_vector).rgb = billboard_direction;
|
|
||||||
#else
|
|
||||||
GRAPH_VERTEX_PARAM(params, eye_vector).rgb = camera_pos - wp.rgb;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_TANGENT_SPACE)
|
|
||||||
tspace_transform_transpose(
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm0),
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm1),
|
|
||||||
GRAPH_VERTEX_PARAM(params, tsm2),
|
|
||||||
tangent, binormal, normal,
|
|
||||||
(float3x3)world);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MOTION_BLUR)
|
|
||||||
GRAPH_VERTEX_PARAM(params, last_clip_position) = float3(0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
#if defined(BILLBOARD)
|
|
||||||
float4 cur_wp = wp;
|
|
||||||
float4 last_wp;
|
|
||||||
#if !defined(LAYER_SKYDOME_BILLBOARD)
|
|
||||||
get_billboard_positions_from_position(last_world._m30_m31_m32, camera_last_world._m30_m31_m32, camera_last_view, last_position, last_wp);
|
|
||||||
#else
|
|
||||||
get_billboard_positions_from_direction(billboard_direction, last_position, last_wp);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
float4 cur_wp = mul(position, world);
|
|
||||||
float4 last_wp = mul(last_position, last_world);
|
|
||||||
#endif
|
|
||||||
if(length(cur_wp - last_wp) > 0.0) {
|
|
||||||
float4 last_clip_pos = mul(last_wp, camera_last_view_projection);
|
|
||||||
GRAPH_VERTEX_PARAM(params, last_clip_position) = last_clip_pos.xyw;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Evaluate all pieces of the graph that should run per-vertex.
|
|
||||||
GRAPH_EVALUATE_VERTEX(results, params);
|
|
||||||
|
|
||||||
#if defined(NEEDS_WORLD_SPACE_POSITION)
|
|
||||||
#if defined(HAS_VERTEX_OFFSET)
|
|
||||||
wp += float4(results.vertex_offset, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CAMERA_TRANSLATION_LOCK)
|
|
||||||
view._m30_m31_m32 = float3(0,0,0);
|
|
||||||
p = mul(mul(wp, view), proj);
|
|
||||||
#else
|
|
||||||
#if defined(HAS_CUSTOM_FOV)
|
|
||||||
p = mul(wp, camera_custom_fov_view_projection);
|
|
||||||
#else
|
|
||||||
p = mul(wp, view_proj);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#if defined(HAS_CUSTOM_FOV)
|
|
||||||
// TODO: create camera_custom_fov_world_view_projection?
|
|
||||||
p = mul(mul(position, world), camera_custom_fov_view_projection);
|
|
||||||
#else
|
|
||||||
p = mul(position, world_view_proj);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MATERIAL_TRANSFER)
|
|
||||||
float2 unwrapped_uv = GRAPH_VERTEX_DATA(input, lightmap_uv);
|
|
||||||
float2 ndc = float2(unwrapped_uv.x, unwrapped_uv.y) * 2 - 1;
|
|
||||||
ndc.y *= -1;
|
|
||||||
p = float4(ndc, 0, 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PROJECT_TO_FAR_PLANE)
|
|
||||||
p.z = p.w;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(LAYER_TRANSPARENT) && !defined(DEPTH_TEST_DISABLED)
|
|
||||||
p.z -= lerp(TAA_GUI_MIN_DEPTH_BIAS, TAA_GUI_MAX_DEPTH_BIAS, saturate((o.position.z / o.position.w) / TAA_GUI_DEPTH_BIAS_RANGE)) * taa_enabled;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PS_NEEDS_WP)
|
|
||||||
o.world_pos = wp.xyz;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DRAW_WIREFRAME) || defined(MATERIAL_TRANSFER) || defined(LAYER_TRANSPARENT)
|
|
||||||
o.position = p;
|
|
||||||
#else
|
|
||||||
float4 view_space = p / p.w;
|
|
||||||
view_space.xy += get_vs_halton_offset(frame_number);
|
|
||||||
o.position = view_space * p.w;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Write results
|
|
||||||
GRAPH_VERTEX_WRITE(o, results, params);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DRAW_WIREFRAME)
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
float4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
{
|
|
||||||
#if (defined(RENDERER_D3D11) || defined(RENDERER_D3D12)) && defined(INSTANCED)
|
|
||||||
return input.instance_wireframe_color;
|
|
||||||
#else
|
|
||||||
return dev_wireframe_color;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
DEFAULT_ROOT_SIGNATURE_ATTRIBUTE
|
|
||||||
float4 ps_main(PS_INPUT input) : SV_TARGET0
|
|
||||||
{
|
|
||||||
#if defined(NEEDS_PIXEL_DEPTH) || (!defined(LOW_RES) && defined(LOW_RES_ENABLED))
|
|
||||||
const float3 world_pos = input.world_pos;
|
|
||||||
const float3 view_dir = camera_world._m30_m31_m32 - world_pos;
|
|
||||||
const float3 camera_dir = camera_world._m10_m11_m12;
|
|
||||||
const float depth = dot(-view_dir, camera_dir);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAS_BASE_COLOR) || defined(HAS_OPACITY) || defined(HAS_ADDITIVE)
|
|
||||||
GraphPixelParams params;
|
|
||||||
GraphPixelResults graph;
|
|
||||||
|
|
||||||
GRAPH_PIXEL_WRITE_PARAMS(params, input);
|
|
||||||
|
|
||||||
#if defined(NEEDS_PIXEL_DEPTH)
|
|
||||||
GRAPH_PIXEL_PARAM(params, pixel_depth) = depth;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(NEEDS_SCREEN_POS)
|
|
||||||
float2 screen_pos = (input.position.xy / back_buffer_size);
|
|
||||||
GRAPH_PIXEL_PARAM(params, screen_pos) = screen_pos;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GRAPH_EVALUATE_PIXEL(graph, params);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float3 color = float3(0.5, 0.5, 0.5);
|
|
||||||
#if defined(HAS_BASE_COLOR)
|
|
||||||
color = graph.base_color;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float op = 1.f;
|
|
||||||
#if defined(HAS_OPACITY)
|
|
||||||
op = graph.opacity;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(LOW_RES) && defined(LOW_RES_ENABLED)
|
|
||||||
float2 screen_uv = input.position.xy / back_buffer_size;
|
|
||||||
|
|
||||||
// Fade out high resolution particle if the low resolution particles is infront of the high resolution particle
|
|
||||||
float2 particle_depth_values = TEX2D(hdr_linear_depth_div4, screen_uv).rg;
|
|
||||||
float depth_mean = particle_depth_values.x;
|
|
||||||
float depth_variance = particle_depth_values.y - depth_mean*depth_mean;
|
|
||||||
float background_depth = depth;
|
|
||||||
|
|
||||||
float diff = max(background_depth - depth_mean, 0.0);
|
|
||||||
float C = 1.38629436112; // 2 * ln(2)
|
|
||||||
float T = exp2(-diff*diff / (C * max(depth_variance, 0.001)));
|
|
||||||
float alpha_modifier = TEX2D(hdr_transparent_div4, screen_uv).a * (1.0 - T);
|
|
||||||
op *= 1.0 - alpha_modifier;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LAYER_SKYDOME
|
|
||||||
return float4(color, 1.0);
|
|
||||||
#else
|
|
||||||
#if defined(HAS_ADDITIVE)
|
|
||||||
return float4(color * op, op * (1.0 - saturate(graph.additive)));
|
|
||||||
#else
|
|
||||||
return float4(color * op, op);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue