From 3e5199f0b6bbfd9c9574339dce2dd9b801798807 Mon Sep 17 00:00:00 2001 From: djewsbury Date: Fri, 25 Mar 2016 18:58:22 +0900 Subject: [PATCH] Added procedural wood example technique for use with Material Tool - load ProcWood.tech into the MaterialTool to see the nodes - and, apply it to a mesh by right clicking in the preview window --- .../Game/xleres/Objects/Example/ProcWood.tech | 435 +++++++++ .../Example/ProcWood/WoodGnarlGrainStain.sh | 644 +++++++++++++ .../Example/ProcWood/WoodModulator001.sh | 236 +++++ .../Example/ProcWood/WoodModulator002.sh | 236 +++++ .../Objects/Example/ProcWood/WoodPlanks.sh | 873 ++++++++++++++++++ .../Objects/Example/ProcWood/WoodRings002.sh | 541 +++++++++++ .../Objects/Example/ProcWood/Wood_04_G.sh | 465 ++++++++++ 7 files changed, 3430 insertions(+) create mode 100644 Working/Game/xleres/Objects/Example/ProcWood.tech create mode 100644 Working/Game/xleres/Objects/Example/ProcWood/WoodGnarlGrainStain.sh create mode 100644 Working/Game/xleres/Objects/Example/ProcWood/WoodModulator001.sh create mode 100644 Working/Game/xleres/Objects/Example/ProcWood/WoodModulator002.sh create mode 100644 Working/Game/xleres/Objects/Example/ProcWood/WoodPlanks.sh create mode 100644 Working/Game/xleres/Objects/Example/ProcWood/WoodRings002.sh create mode 100644 Working/Game/xleres/Objects/Example/ProcWood/Wood_04_G.sh diff --git a/Working/Game/xleres/Objects/Example/ProcWood.tech b/Working/Game/xleres/Objects/Example/ProcWood.tech new file mode 100644 index 0000000000..215a1ce723 --- /dev/null +++ b/Working/Game/xleres/Objects/Example/ProcWood.tech @@ -0,0 +1,435 @@ +// CompoundDocument:1 +#include "game/xleres/System/Prefix.h" + +#include "game/xleres/Objects/Example/ProcWood/Wood_04_G.sh" +#include "game/xleres/Surface.h" +#include "game/xleres/Nodes/Output.sh" +#include "game/xleres/Nodes/MaterialParam.sh" + + +void ProcWood(VSOutput geo, out GBufferValues result) +{ + float3 Output_35_result; + Output_35_result = GetWorldPosition( geo ); + + float3 Output_31_color; + Wood_04_G( Output_35_result, Output_31_color ); + + CommonMaterialParam Output_33_result; + Output_33_result = CommonMaterialParam_Make( .3, .05, 0 ); + + float3 Output_34_result; + Output_34_result = GetNormal( geo ); + + GBufferValues Output_32_result; + Output_32_result = Output_PerPixel( Output_31_color, Output_34_result, Output_33_result, 1.0f, 1.0f, 1.0f, 1.0f, 0 ); + + result = Output_32_result; + +} +/* <>--( + + + + + 32 + blendingAlpha + 1.0f + + + 32 + normalMapAccuracy + 1.0f + + + 32 + cookedAmbientOcclusion + 1.0f + + + 32 + cookedLightOcclusion + 1.0f + + + 32 + transmission + 0 + + + 33 + roughness + .3 + + + 33 + specular + .05 + + + 33 + metal + 0 + + + + + + 32 + diffuseAlbedo + 31 + color + float3 + float3 + + + + 31 + coords + 35 + result + float3 + float3 + + + + 32 + material + 33 + result + CommonMaterialParam + CommonMaterialParam + + + + 32 + worldSpaceNormal + 34 + result + float3 + float3 + + + + + + game/xleres/Objects/Example/ProcWood\Wood_04_G.sh:Wood_04_G + 31 + Procedure + 0 + + + game/xleres/Surface.h:GetWorldPosition + 35 + Procedure + 1 + + + game/xleres/Nodes\Output.sh:Output_PerPixel + 32 + Procedure + 2 + + + game/xleres/Nodes\MaterialParam.sh:CommonMaterialParam_Make + 33 + Procedure + 3 + + + game/xleres/Surface.h:GetNormal + 34 + Procedure + 4 + + + + + + Sphere + + 0 + + + Sphere + + 1 + + + Sphere + result.diffuseAlbedo + 2 + + + Sphere + + 3 + + + Sphere + + 4 + + + + + + 281 + 252 + + Normal + + + + -91 + 340 + + Collapsed + + + + 1036 + 388 + + Normal + + + + 471 + 661 + + Collapsed + + + + 213 + 634 + + Collapsed + + + +)-- */ +/* <>--( + + + true + + + OUTPUT_WORLD_POSITION + 1 + + + + +)-- */ + + + +#include "TextureAlgorithm.h" // for SystemInputs +#include "Lighting/Forward.h" + +#if !((OUTPUT_TEXCOORD==1) && (MAT_ALPHA_TEST==1)) + [earlydepthstencil] +#endif +float4 forward_main(VSOutput geo, SystemInputs sys) : SV_Target0 +{ + // If we're doing to do the alpha threshold test, we + // should try to do as early in the shader as we can! + // Unfortunately, there's no real easy way to do that with + // a node graph here...Unless we create some special #define + // somehow... + + // DoAlphaTest(geo, GetAlphaThreshold()); + + GBufferValues sample; + ProcWood(geo, sample); + + float3 directionToEye = 0.0.xxx; + #if (OUTPUT_WORLD_VIEW_VECTOR==1) + directionToEye = normalize(geo.worldViewVector); + #endif + + float4 result = float4( + ResolveLitColor( + sample, directionToEye, GetWorldPosition(geo), + LightScreenDest_Create(int2(geo.position.xy), GetSampleIndex(sys))), 1.f); + + #if OUTPUT_FOG_COLOR == 1 + result.rgb = lerp(geo.fogColor.rgb, result.rgb, geo.fogColor.a); + #endif + + result.a = sample.blendingAlpha; + + #if (OUTPUT_COLOUR>=1) && (MAT_VCOLOR_IS_ANIM_PARAM==0) + result.rgb *= geo.colour.rgb; + #endif + + #if MAT_SKIP_LIGHTING_SCALE==0 + result.rgb *= LightingScale; // (note -- should we scale by this here? when using this shader with a basic lighting pipeline [eg, for material preview], the scale is unwanted) + #endif + return result; +} + + + +#if !((OUTPUT_TEXCOORD==1) && (MAT_ALPHA_TEST==1)) + [earlydepthstencil] +#endif +GBufferEncoded deferred_main(VSOutput geo) +{ + // If we're doing to do the alpha threshold test, we + // should try to do as early in the shader as we can! + // Unfortunately, there's no real easy way to do that with + // a node graph here...Unless we create some special #define + // somehow... + // DoAlphaTest(geo, GetAlphaThreshold()); + GBufferValues result; + ProcWood(geo, result); + return Encode(result); +} + + + +#include "game/xleres/Forward/Transparency/util.h" + +float4 io_main(VSOutput geo, SystemInputs sys) : SV_Target0 +{ + float destinationDepth = DuplicateOfDepthBuffer[uint2(geo.position.xy)]; + float ndcComparison = geo.position.z; // / geo.position.w; + if (ndcComparison > destinationDepth) + discard; + + GBufferValues sample; + ProcWood(geo, sample); + + // note -- At alpha threshold, we just consider + // it opaque. It's a useful optimisation + // that goes hand in hand with the pre-depth pass. + const float minAlpha = 1.f / 255.f; + const float maxAlpha = 0.95f; // 254.f / 255.f; // AlphaThreshold; + if (sample.blendingAlpha < minAlpha) { + discard; + } + + float4 result = LightSample(sample, geo, sys); + + if (result.a >= maxAlpha) { + return float4(LightingScale * result.rgb, 1.f); // result.a); + } else { + #if !MAT_PREMULTIPLIED_ALPHA + result.rgb *= result.a; + #endif + + OutputFragmentNode(uint2(geo.position.xy), result, ndcComparison); + discard; + return 0.0.xxxx; + } +} + + + +[earlydepthstencil] +float4 stochastic_main(VSOutput geo, + #if (STOCHASTIC_TRANS_PRIMITIVEID==1) + uint primitiveID : SV_PrimitiveID, + #endif + SystemInputs sys) : SV_Target +{ + float occlusion; + uint type = CalculateStochasticPixelType(geo.position, occlusion); + [branch] if (type > 0) { + if (type == 2) return float4(0.0.xxx, 1); // discard; + + // Only need to calculate the "alpha" value for this step... + GBufferValues sample; + ProcWood(geo, sample); + return float4(0.0.xxx, sample.blendingAlpha); + } + + GBufferValues sample; + ProcWood(geo, sample); + + float4 litValue = LightSample(sample, geo, sys); + return float4((LightingScale * (1.f - occlusion) * litValue.a) * litValue.rgb, litValue.a); +} + + + +#include "Forward/Transparency/depthonlyutil.h" + +#if (STOCHASTIC_TRANS) + + void depthonly_main( + VSOutput geo, uint primitiveID : SV_PrimitiveID, + out uint oCoverage : SV_Coverage + #if (STOCHASTIC_TRANS_PRIMITIVEID==1) + , out uint oPrimId : SV_Target0 + #if (STOCHASTIC_TRANS_OPACITY==1) + , out float oOpacity : SV_Target1 + #endif + #elif (STOCHASTIC_TRANS_OPACITY==1) + , out float oOpacity : SV_Target0 + #endif + + ) + { + GBufferValues sample; + ProcWood(geo, sample); + float alpha = sample.blendingAlpha; + + oCoverage = StochasticTransMask(uint2(geo.position.xy), alpha, primitiveID); + #if (STOCHASTIC_TRANS_PRIMITIVEID==1) + oPrimId = primitiveID; + #endif + #if (STOCHASTIC_TRANS_OPACITY==1) + oOpacity = alpha; + #endif + } + +#else + + #if !((OUTPUT_TEXCOORD==1) && ((MAT_ALPHA_TEST==1)||(MAT_ALPHA_TEST_PREDEPTH==1))) + [earlydepthstencil] + #endif + void depthonly_main(VSOutput geo) + { + #if !((OUTPUT_TEXCOORD==1) && ((MAT_ALPHA_TEST==1)||(MAT_ALPHA_TEST_PREDEPTH==1))) + // execute sampling only for discard() events + GBufferValues sample; + ProcWood(geo, sample); + #endif + } + +#endif + + +/* <>--( +~Inherit; game/xleres/techniques/illum.tech +~Forward + ~Parameters + ~Material + OUTPUT_WORLD_POSITION=1 + PixelShader=<.>:forward_main +~Deferred + ~Parameters + ~Material + OUTPUT_WORLD_POSITION=1 + PixelShader=<.>:deferred_main +~OrderIndependentTransparency + ~Parameters + ~Material + OUTPUT_WORLD_POSITION=1 + PixelShader=<.>:oi_main +~StochasticTransparency + ~Parameters + ~Material + OUTPUT_WORLD_POSITION=1 + PixelShader=<.>:stochastic_main +~DepthOnly + ~Parameters + ~Material + OUTPUT_WORLD_POSITION=1 + PixelShader=<.>:depthonly_main +)--*/ + diff --git a/Working/Game/xleres/Objects/Example/ProcWood/WoodGnarlGrainStain.sh b/Working/Game/xleres/Objects/Example/ProcWood/WoodGnarlGrainStain.sh new file mode 100644 index 0000000000..ef169cf922 --- /dev/null +++ b/Working/Game/xleres/Objects/Example/ProcWood/WoodGnarlGrainStain.sh @@ -0,0 +1,644 @@ +// CompoundDocument:1 +#include "game/xleres/System/Prefix.h" + +#include "game/xleres/Nodes/Texture.sh" +#include "game/xleres/Nodes/Basic.sh" + + +void WoodGnarlGrainStain(float gnarlDensity, float3 coords, float gnarlStrength, float grainStrength, float stain, float grainDensity, out float grain : SV_Target0, out float3 gnarledCoords : SV_Target1) +{ + float Output_57_fac; + float3 Output_57_result; + Output_57_result = NoiseTexture3( coords, gnarlDensity, 4, 5, Output_57_fac ); + + float3 Output_56_result; + Output_56_result = Subtract3( Output_57_result, float3(0.5, 0.5, 0.5) ); + + float3 Output_46_result; + Output_46_result = Multiply3Scalar( Output_56_result, gnarlStrength ); + + float3 Output_53_result; + Output_53_result = Add3( coords, Output_46_result ); + + float3 Output_55_result; + Output_55_result = Multiply3( Output_53_result, float3(.1, 2, 2) ); + + float Output_54_fac; + float3 Output_54_result; + Output_54_result = NoiseTexture3( Output_55_result, grainDensity, 2.0f, 0.0f, Output_54_fac ); + + float Output_47_result; + Output_47_result = Multiply1( Output_54_fac, grainStrength ); + + float Output_48_result; + Output_48_result = Multiply1( grainStrength, .5 ); + + float Output_49_result; + Output_49_result = Subtract1( Output_48_result, .5 ); + + float Output_51_result; + Output_51_result = Multiply1( stain, .5 ); + + float Output_58_result; + Output_58_result = Subtract1( Output_51_result, .5 ); + + float Output_59_result; + Output_59_result = Multiply1( Output_57_fac, stain ); + + float Output_50_result; + Output_50_result = Subtract1( Output_59_result, Output_58_result ); + + float Output_61_result; + Output_61_result = Subtract1( Output_47_result, Output_49_result ); + + float Output_60_result; + Output_60_result = Add1( Output_61_result, Output_50_result ); + + float Output_52_result; + Output_52_result = Multiply1( Output_60_result, .5 ); + + grain = Output_52_result; + gnarledCoords = Output_55_result; + +} +/* <>--( + + + + + 57 + scale + <gnarlDensity> + + + 57 + detail + 4 + + + 57 + distortion + 5 + + + 57 + position + <coords> + + + 46 + rhs + <gnarlStrength> + + + 47 + rhs + <grainStrength> + + + 48 + lhs + <grainStrength> + + + 48 + rhs + .5 + + + 49 + rhs + .5 + + + 51 + rhs + .5 + + + 51 + lhs + <stain> + + + 52 + rhs + .5 + + + 53 + lhs + <coords> + + + 54 + detail + 2.0f + + + 54 + scale + <grainDensity> + + + 54 + distortion + 0.0f + + + 55 + rhs + float3(.1, 2, 2) + + + 56 + rhs + float3(0.5, 0.5, 0.5) + + + 58 + rhs + .5 + + + 59 + rhs + <stain> + + + + + + 59 + lhs + 57 + fac + float + float + + + + 56 + lhs + 57 + result + float3 + float3 + + + + 60 + lhs + 61 + result + float + float + + + + 53 + rhs + 46 + result + float3 + float3 + + + + 61 + lhs + 47 + result + float + float + + + + 49 + lhs + 48 + result + float + float + + + + 61 + rhs + 49 + result + float + float + + + + 60 + rhs + 50 + result + float + float + + + + 58 + lhs + 51 + result + float + float + + + + 55 + lhs + 53 + result + float3 + float3 + + + + 47 + lhs + 54 + fac + float + float + + + + 54 + position + 55 + result + float3 + float3 + + + + 46 + lhs + 56 + result + float3 + float3 + + + + 50 + rhs + 58 + result + float + float + + + + 50 + lhs + 59 + result + float + float + + + + 52 + lhs + 60 + result + float + float + + + + + + game/xleres/Nodes\Texture.sh:NoiseTexture3 + 57 + Procedure + 0 + + + game/xleres/Nodes/Basic.sh:Subtract1 + 61 + Procedure + 2 + + + game/xleres/Nodes/Basic.sh:Multiply3Scalar + 46 + Procedure + 3 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 47 + Procedure + 4 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 48 + Procedure + 5 + + + game/xleres/Nodes/Basic.sh:Subtract1 + 49 + Procedure + 6 + + + game/xleres/Nodes/Basic.sh:Subtract1 + 50 + Procedure + 7 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 51 + Procedure + 8 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 52 + Procedure + 9 + + + game/xleres/Nodes/Basic.sh:Add3 + 53 + Procedure + 10 + + + game/xleres/Nodes\Texture.sh:NoiseTexture3 + 54 + Procedure + 11 + + + game/xleres/Nodes/Basic.sh:Multiply3 + 55 + Procedure + 12 + + + game/xleres/Nodes/Basic.sh:Subtract3 + 56 + Procedure + 13 + + + game/xleres/Nodes/Basic.sh:Subtract1 + 58 + Procedure + 14 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 59 + Procedure + 15 + + + game/xleres/Nodes/Basic.sh:Add1 + 60 + Procedure + 16 + + + + + 52 + result + grain + + float + 1 + + + 55 + result + gnarledCoords + + float3 + 1 + + + + + Plane2D + + 0 + + + Sphere + + 2 + + + Sphere + + 3 + + + Sphere + + 4 + + + Sphere + + 5 + + + Sphere + + 6 + + + Plane2D + + 7 + + + Sphere + + 8 + + + Sphere + + 9 + + + Plane2D + + 10 + + + Plane2D + + 11 + + + Sphere + + 12 + + + Sphere + + 13 + + + Sphere + + 14 + + + Sphere + + 15 + + + Sphere + + 16 + + + + + + -31 + 161 + + Normal + + + + 3290 + 243 + + Normal + + + + 2313 + 387 + + Collapsed + + + + 689 + 40 + + Collapsed + + + + 2051 + 285 + + Collapsed + + + + 1744 + 425 + + Collapsed + + + + 2038 + 412 + + Collapsed + + + + 682.8907 + 517.2711 + + Collapsed + + + + -86 + 623 + + Collapsed + + + + 2840 + 446 + + Collapsed + + + + 1060 + 87 + + Collapsed + + + + 1728 + 229 + + Collapsed + + + + 1461 + 145 + + Collapsed + + + + 411 + 131 + + Collapsed + + + + 318 + 603 + + Collapsed + + + + 321 + 441 + + Collapsed + + + + 2596 + 481 + + Collapsed + + + +)-- */ +/* <>--( + + + false + + + +)-- */ diff --git a/Working/Game/xleres/Objects/Example/ProcWood/WoodModulator001.sh b/Working/Game/xleres/Objects/Example/ProcWood/WoodModulator001.sh new file mode 100644 index 0000000000..ff4623c2b7 --- /dev/null +++ b/Working/Game/xleres/Objects/Example/ProcWood/WoodModulator001.sh @@ -0,0 +1,236 @@ +// CompoundDocument:1 +#include "game/xleres/System/Prefix.h" + +#include "game/xleres/Nodes/Basic.sh" + + +void WoodModulator001(float value, float period, out float frac : SV_Target0, out float int : SV_Target1) +{ + float Output_67_result; + Output_67_result = Divide1( value, period ); + + float Output_66_result; + Output_66_result = Round1( value ); + + float Output_63_result; + Output_63_result = Subtract1( Output_67_result, Output_66_result ); + + float Output_64_result; + Output_64_result = Multiply1( Output_66_result, period ); + + float Output_65_result; + Output_65_result = Multiply1( Output_63_result, period ); + + frac = Output_65_result; + int = Output_64_result; + +} +/* <>--( + + + + + 67 + lhs + <value> + + + 67 + rhs + <period> + + + 66 + multipleOf + .5 + + + 64 + rhs + <period> + + + 65 + rhs + <period> + + + + + + 66 + lhs + 67 + result + float + float + + + + 63 + lhs + 67 + result + float + float + + + + 64 + lhs + 66 + result + float + float + + + + 63 + rhs + 66 + result + float + float + + + + 65 + lhs + 63 + result + float + float + + + + + + game/xleres/Nodes/Basic.sh:Divide1 + 67 + Procedure + 1 + + + game/xleres/Nodes/Basic.sh:Round1 + 66 + Procedure + 2 + + + game/xleres/Nodes/Basic.sh:Subtract1 + 63 + Procedure + 3 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 64 + Procedure + 4 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 65 + Procedure + 5 + + + + + 65 + result + frac + + float + 0 + + + 64 + result + int + + float + 0 + + + + + Sphere + + 1 + + + Sphere + + 2 + + + Sphere + + 3 + + + Sphere + + 4 + + + Sphere + + 5 + + + + + + 2234 + 421 + + Normal + + + + 1331 + 371 + + Collapsed + + + + 1540 + 433 + + Collapsed + + + + 1704 + 345 + + Collapsed + + + + 1921 + 475 + + Collapsed + + + + 1916 + 391 + + Collapsed + + + +)-- */ +/* <>--( + + + false + + + +)-- */ diff --git a/Working/Game/xleres/Objects/Example/ProcWood/WoodModulator002.sh b/Working/Game/xleres/Objects/Example/ProcWood/WoodModulator002.sh new file mode 100644 index 0000000000..ec220d0587 --- /dev/null +++ b/Working/Game/xleres/Objects/Example/ProcWood/WoodModulator002.sh @@ -0,0 +1,236 @@ +// CompoundDocument:1 +#include "game/xleres/System/Prefix.h" + +#include "game/xleres/Nodes/Basic.sh" + + +void WoodModulator002(float value, float period, out float int : SV_Target0, out float frac : SV_Target1) +{ + float Output_69_result; + Output_69_result = Divide1( value, period ); + + float Output_70_result; + Output_70_result = Round1( Output_69_result ); + + float Output_71_result; + Output_71_result = Multiply1( Output_70_result, period ); + + float Output_73_result; + Output_73_result = Subtract1( Output_69_result, Output_70_result ); + + float Output_72_result; + Output_72_result = Multiply1( Output_73_result, period ); + + int = Output_71_result; + frac = Output_72_result; + +} +/* <>--( + + + + + 69 + lhs + <value> + + + 69 + rhs + <period> + + + 71 + rhs + <period> + + + 72 + rhs + <period> + + + + + + 73 + lhs + 69 + result + float + float + + + + 70 + value + 69 + result + float + float + + + + 72 + lhs + 73 + result + float + float + + + + 73 + rhs + 70 + result + float + float + + + + 71 + lhs + 70 + result + float + float + + + + + + game/xleres/Nodes/Basic.sh:Divide1 + 69 + Procedure + 0 + + + game/xleres/Nodes/Basic.sh:Subtract1 + 73 + Procedure + 2 + + + game/xleres/Nodes/Basic.sh:Round1 + 70 + Procedure + 3 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 71 + Procedure + 4 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 72 + Procedure + 5 + + + + + 71 + result + int + + float + 1 + + + 72 + result + frac + + float + 1 + + + + + Sphere + + 0 + + + Sphere + + 2 + + + Sphere + + 3 + + + Sphere + + 4 + + + Sphere + + 5 + + + + + + 157 + 257 + + Collapsed + + + + 1009 + 317 + + Normal + + + + 548 + 268 + + Collapsed + + + + 365 + 348 + + Collapsed + + + + 677 + 377 + + Collapsed + + + + 717 + 279 + + Collapsed + + + +)-- */ +/* <>--( + + + false + + + + period + 2.5 + + + +)-- */ diff --git a/Working/Game/xleres/Objects/Example/ProcWood/WoodPlanks.sh b/Working/Game/xleres/Objects/Example/ProcWood/WoodPlanks.sh new file mode 100644 index 0000000000..432935f719 --- /dev/null +++ b/Working/Game/xleres/Objects/Example/ProcWood/WoodPlanks.sh @@ -0,0 +1,873 @@ +// CompoundDocument:1 +#include "game/xleres/System/Prefix.h" + +#include "game/xleres/ProcMat/Wood/WoodModulator002.sh" +#include "game/xleres/Nodes/Basic.sh" +#include "game/xleres/Nodes/Texture.sh" + + +void WoodPlanks(float width, float length, float height, float3 offcenter, float shift1, float shift3, float shift2, float3 coords, out float3 plankCoords : SV_Target0) +{ + float Output_95_r; + float Output_95_g; + float Output_95_b; + Separate3( coords, Output_95_r, Output_95_g, Output_95_b ); + + float Output_79_int; + float Output_79_frac; + WoodModulator002( Output_95_b, height, Output_79_int, Output_79_frac ); + + float Output_94_result; + Output_94_result = Divide1( shift2, height ); + + float Output_90_result; + Output_90_result = Multiply1( length, Output_94_result ); + + float Output_87_result; + Output_87_result = Multiply1( Output_90_result, Output_79_int ); + + float Output_93_result; + Output_93_result = Divide1( shift3, height ); + + float Output_91_result; + Output_91_result = Multiply1( width, Output_93_result ); + + float Output_81_result; + Output_81_result = Multiply1( Output_91_result, Output_79_int ); + + float Output_88_result; + Output_88_result = Add1( Output_95_g, Output_81_result ); + + float Output_78_int; + float Output_78_frac; + WoodModulator002( Output_88_result, width, Output_78_int, Output_78_frac ); + + float Output_92_result; + Output_92_result = Divide1( shift1, width ); + + float Output_89_result; + Output_89_result = Multiply1( Output_92_result, length ); + + float Output_80_result; + Output_80_result = Multiply1( Output_89_result, Output_78_int ); + + float Output_96_result; + Output_96_result = Add1( Output_95_r, Output_80_result ); + + float Output_86_result; + Output_86_result = Add1( Output_96_result, Output_87_result ); + + float Output_76_int; + float Output_76_frac; + WoodModulator002( Output_86_result, length, Output_76_int, Output_76_frac ); + + float3 Output_85_result; + Combine3( Output_76_int, Output_78_int, Output_79_int, Output_85_result ); + + float Output_75_fac; + float3 Output_75_result; + Output_75_result = NoiseTexture3( Output_85_result, 3.142, 2, 0, Output_75_fac ); + + float3 Output_82_result; + Combine3( Output_76_frac, Output_78_frac, Output_79_frac, Output_82_result ); + + float3 Output_84_result; + Output_84_result = Subtract3( Output_75_result, float3(.5, .5, .5) ); + + float3 Output_83_result; + Output_83_result = Multiply3( Output_84_result, offcenter ); + + float3 Output_77_result; + Output_77_result = Add3( Output_82_result, Output_83_result ); + + plankCoords = Output_77_result; + +} +/* <>--( + + + + + 78 + period + <width> + + + 75 + scale + 3.142 + + + 75 + detail + 2 + + + 75 + distortion + 0 + + + 76 + period + <length> + + + 79 + period + <height> + + + 83 + rhs + <offcenter> + + + 84 + rhs + float3(.5, .5, .5) + + + 89 + rhs + <length> + + + 90 + lhs + <length> + + + 91 + lhs + <width> + + + 92 + lhs + <shift1> + + + 92 + rhs + <width> + + + 93 + lhs + <shift3> + + + 93 + rhs + <height> + + + 94 + lhs + <shift2> + + + 94 + rhs + <height> + + + 95 + input + <coords> + + + + + + 80 + rhs + 78 + int + float + float + + + + 85 + g + 78 + int + float + float + + + + 82 + g + 78 + frac + float + float + + + + 86 + lhs + 96 + result + float + float + + + + 84 + lhs + 75 + result + float3 + float3 + + + + 85 + r + 76 + int + float + float + + + + 82 + r + 76 + frac + float + float + + + + 81 + rhs + 79 + int + float + float + + + + 87 + rhs + 79 + int + float + float + + + + 85 + b + 79 + int + float + float + + + + 82 + b + 79 + frac + float + float + + + + 96 + rhs + 80 + result + float + float + + + + 88 + rhs + 81 + result + float + float + + + + 77 + lhs + 82 + result + float3 + float3 + + + + 77 + rhs + 83 + result + float3 + float3 + + + + 83 + lhs + 84 + result + float3 + float3 + + + + 75 + position + 85 + result + float3 + float3 + + + + 76 + value + 86 + result + float + float + + + + 86 + rhs + 87 + result + float + float + + + + 78 + value + 88 + result + float + float + + + + 80 + lhs + 89 + result + float + float + + + + 87 + lhs + 90 + result + float + float + + + + 81 + lhs + 91 + result + float + float + + + + 89 + lhs + 92 + result + float + float + + + + 91 + rhs + 93 + result + float + float + + + + 90 + rhs + 94 + result + float + float + + + + 79 + value + 95 + b + float + float + + + + 88 + lhs + 95 + g + float + float + + + + 96 + lhs + 95 + r + float + float + + + + + + game/xleres/ProcMat\Wood\WoodModulator002.sh:WoodModulator002 + 78 + Procedure + 0 + + + game/xleres/Nodes/Basic.sh:Add1 + 96 + Procedure + 2 + + + game/xleres/Nodes\Texture.sh:NoiseTexture3 + 75 + Procedure + 3 + + + game/xleres/ProcMat\Wood\WoodModulator002.sh:WoodModulator002 + 76 + Procedure + 4 + + + game/xleres/Nodes/Basic.sh:Add3 + 77 + Procedure + 5 + + + game/xleres/ProcMat\Wood\WoodModulator002.sh:WoodModulator002 + 79 + Procedure + 6 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 80 + Procedure + 7 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 81 + Procedure + 8 + + + game/xleres/Nodes/Basic.sh:Combine3 + 82 + Procedure + 9 + + + game/xleres/Nodes/Basic.sh:Multiply3 + 83 + Procedure + 10 + + + game/xleres/Nodes/Basic.sh:Subtract3 + 84 + Procedure + 11 + + + game/xleres/Nodes/Basic.sh:Combine3 + 85 + Procedure + 12 + + + game/xleres/Nodes/Basic.sh:Add1 + 86 + Procedure + 13 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 87 + Procedure + 14 + + + game/xleres/Nodes/Basic.sh:Add1 + 88 + Procedure + 15 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 89 + Procedure + 16 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 90 + Procedure + 17 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 91 + Procedure + 18 + + + game/xleres/Nodes/Basic.sh:Divide1 + 92 + Procedure + 19 + + + game/xleres/Nodes/Basic.sh:Divide1 + 93 + Procedure + 20 + + + game/xleres/Nodes/Basic.sh:Divide1 + 94 + Procedure + 21 + + + game/xleres/Nodes/Basic.sh:Separate3 + 95 + Procedure + 22 + + + + + 77 + result + plankCoords + + float3 + 1 + + + + + Plane2D + + 0 + + + Sphere + + 2 + + + Plane2D + + 3 + + + Plane2D + result2 + 4 + + + Plane2D + + 5 + + + Plane2D + + 6 + + + Sphere + + 7 + + + Sphere + + 8 + + + Sphere + + 9 + + + Sphere + + 10 + + + Sphere + + 11 + + + Plane2D + + 12 + + + Sphere + + 13 + + + Sphere + + 14 + + + Sphere + + 15 + + + Sphere + + 16 + + + Sphere + + 17 + + + Sphere + + 18 + + + Sphere + + 19 + + + Sphere + + 20 + + + Sphere + + 21 + + + Sphere + + 22 + + + + + + 446 + 184 + + Normal + + + + 3747 + 51 + + Normal + + + + 1112 + -93 + + Collapsed + + + + 2266 + 277 + + Collapsed + + + + 1697 + 54 + + Normal + + + + 3140 + 75 + + Normal + + + + -626 + 658 + + Normal + + + + 903 + 21 + + Collapsed + + + + -66 + 356 + + Collapsed + + + + 2462 + -43 + + Collapsed + + + + 2761 + 213 + + Collapsed + + + + 2531 + 321 + + Collapsed + + + + 2092 + 146 + + Collapsed + + + + 1357 + -14 + + Collapsed + + + + 135 + 450 + + Collapsed + + + + 138 + 284 + + Collapsed + + + + -373 + 271 + + Collapsed + + + + -374 + 328 + + Collapsed + + + + -397 + 394 + + Collapsed + + + + -639 + 266 + + Collapsed + + + + -630 + 389 + + Collapsed + + + + -637 + 326 + + Collapsed + + + + -1185 + -260 + + Normal + + + +)-- */ +/* <>--( + + + false + + + +)-- */ diff --git a/Working/Game/xleres/Objects/Example/ProcWood/WoodRings002.sh b/Working/Game/xleres/Objects/Example/ProcWood/WoodRings002.sh new file mode 100644 index 0000000000..bfd1607298 --- /dev/null +++ b/Working/Game/xleres/Objects/Example/ProcWood/WoodRings002.sh @@ -0,0 +1,541 @@ +// CompoundDocument:1 +#include "game/xleres/System/Prefix.h" + +#include "game/xleres/Nodes/Basic.sh" + + +void WoodRings002(float3 coords, float density, float strength, float shape, out float rings : SV_Target0) +{ + float Output_98_r; + float Output_98_g; + float Output_98_b; + Separate3( coords, Output_98_r, Output_98_g, Output_98_b ); + + float Output_110_result; + Output_110_result = Multiply1( Output_98_b, Output_98_b ); + + float Output_111_result; + Output_111_result = Multiply1( Output_98_g, Output_98_g ); + + float Output_109_result; + Output_109_result = Add1( Output_111_result, Output_110_result ); + + float Output_108_result; + Output_108_result = Power1( Output_109_result, .5 ); + + float Output_102_result; + Output_102_result = Multiply1( Output_108_result, density ); + + float Output_99_result; + Output_99_result = Round1( Output_102_result ); + + float Output_101_result; + Output_101_result = Subtract1( Output_102_result, Output_99_result ); + + float Output_100_result; + Output_100_result = Add1( Output_101_result, .5 ); + + float Output_107_result; + Output_107_result = Power1( Output_100_result, shape ); + + float Output_106_result; + Output_106_result = Multiply1( Output_107_result, 6.283 ); + + float Output_105_result; + Output_105_result = Cosine1( Output_106_result ); + + float Output_104_result; + Output_104_result = Multiply1( Output_105_result, strength ); + + float Output_103_result; + Output_103_result = Add1( Output_104_result, .5 ); + + rings = Output_103_result; + +} +/* <>--( + + + + + 98 + input + <coords> + + + 100 + rhs + .5 + + + 102 + rhs + <density> + + + 103 + rhs + .5 + + + 104 + rhs + <strength> + + + 106 + rhs + 6.283 + + + 107 + exponent + <shape> + + + 108 + exponent + .5 + + + + + + 109 + lhs + 111 + result + float + float + + + + 111 + lhs + 98 + g + float + float + + + + 111 + rhs + 98 + g + float + float + + + + 110 + lhs + 98 + b + float + float + + + + 110 + rhs + 98 + b + float + float + + + + 101 + rhs + 99 + result + float + float + + + + 107 + base + 100 + result + float + float + + + + 100 + lhs + 101 + result + float + float + + + + 101 + lhs + 102 + result + float + float + + + + 99 + value + 102 + result + float + float + + + + 103 + lhs + 104 + result + float + float + + + + 104 + lhs + 105 + result + float + float + + + + 105 + x + 106 + result + float + float + + + + 106 + lhs + 107 + result + float + float + + + + 102 + lhs + 108 + result + float + float + + + + 108 + base + 109 + result + float + float + + + + 109 + rhs + 110 + result + float + float + + + + + + game/xleres/Nodes/Basic.sh:Multiply1 + 111 + Procedure + 1 + + + game/xleres/Nodes/Basic.sh:Separate3 + 98 + Procedure + 2 + + + game/xleres/Nodes/Basic.sh:Round1 + 99 + Procedure + 3 + + + game/xleres/Nodes/Basic.sh:Add1 + 100 + Procedure + 4 + + + game/xleres/Nodes/Basic.sh:Subtract1 + 101 + Procedure + 5 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 102 + Procedure + 6 + + + game/xleres/Nodes/Basic.sh:Add1 + 103 + Procedure + 7 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 104 + Procedure + 8 + + + game/xleres/Nodes/Basic.sh:Cosine1 + 105 + Procedure + 9 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 106 + Procedure + 10 + + + game/xleres/Nodes/Basic.sh:Power1 + 107 + Procedure + 11 + + + game/xleres/Nodes/Basic.sh:Power1 + 108 + Procedure + 12 + + + game/xleres/Nodes/Basic.sh:Add1 + 109 + Procedure + 13 + + + game/xleres/Nodes/Basic.sh:Multiply1 + 110 + Procedure + 14 + + + + + 103 + result + rings + + float + 0 + + + + + Chart + + 1 + + + Plane2D + + 2 + + + Plane2D + + 3 + + + Plane2D + + 4 + + + Plane2D + + 5 + + + Plane2D + + 6 + + + Sphere + + 7 + + + Plane2D + + 8 + + + Chart + + 9 + + + Sphere + + 10 + + + Sphere + + 11 + + + Plane2D + + 12 + + + Chart + + 13 + + + Sphere + + 14 + + + + + + 1203 + 743 + + Normal + + + + 550 + 221 + + Collapsed + + + + 364 + 263 + + Collapsed + + + + 509 + 547 + + Collapsed + + + + 814 + 474 + + Collapsed + + + + 655 + 475 + + Collapsed + + + + 373 + 474 + + Collapsed + + + + 981 + 754 + + Collapsed + + + + 809 + 755 + + Collapsed + + + + 629 + 750 + + Collapsed + + + + 492 + 746 + + Collapsed + + + + 352 + 745 + + Collapsed + + + + 859 + 264 + + Collapsed + + + + 712 + 265 + + Collapsed + + + + 548 + 302 + + Collapsed + + + +)-- */ +/* <>--( + + + false + + + +)-- */ diff --git a/Working/Game/xleres/Objects/Example/ProcWood/Wood_04_G.sh b/Working/Game/xleres/Objects/Example/ProcWood/Wood_04_G.sh new file mode 100644 index 0000000000..cd3c644e7f --- /dev/null +++ b/Working/Game/xleres/Objects/Example/ProcWood/Wood_04_G.sh @@ -0,0 +1,465 @@ +// CompoundDocument:1 +#include "game/xleres/System/Prefix.h" + +#include "game/xleres/Nodes/Basic.sh" +#include "game/xleres/ProcMat/Wood/WoodRings002.sh" +#include "game/xleres/ProcMat/Wood/WoodPlanks.sh" +#include "game/xleres/Nodes/Color.sh" +#include "game/xleres/ProcMat/Wood/WoodGnarlGrainStain.sh" + + +void Wood_04_G(float3 coords, out float3 color : SV_Target0) +{ + float3 Output_39_result; + Output_39_result = RGB( 1, .606, .284 ); + + float3 Output_40_result; + Output_40_result = RGB( .307, .122, .042 ); + + float3 Output_37_plankCoords; + WoodPlanks( 2, .5, .15, 5, .4, .333, .1, coords, Output_37_plankCoords ); + + float Output_43_grain; + float3 Output_43_gnarledCoords; + WoodGnarlGrainStain( .2, 4, 4, Output_37_plankCoords, 100, .5, Output_43_grain, Output_43_gnarledCoords ); + + float3 Output_38_result; + Output_38_result = Mix3( Output_40_result, Output_39_result, Output_43_grain ); + + float3 Output_41_result; + Output_41_result = RGB( .073, .011, 0 ); + + float3 Output_42_result; + Output_42_result = Mix3( Output_41_result, Output_40_result, Output_43_grain ); + + float Output_44_rings; + WoodRings002( Output_43_gnarledCoords, 50, .5, 2.5, Output_44_rings ); + + float3 Output_36_result; + Output_36_result = Mix3( Output_42_result, Output_38_result, Output_44_rings ); + + color = Output_36_result; + +} +/* <>--( + + + + + 44 + strength + .5 + + + 44 + density + 50 + + + 44 + shape + 2.5 + + + 37 + offcenter + 5 + + + 37 + width + .5 + + + 37 + height + .15 + + + 37 + shift1 + .4 + + + 37 + shift2 + .1 + + + 37 + shift3 + .333 + + + 37 + length + 2 + + + 39 + r + 1 + + + 39 + g + .606 + + + 39 + b + .284 + + + 40 + r + .307 + + + 40 + g + .122 + + + 40 + b + .042 + + + 41 + r + .073 + + + 41 + g + .011 + + + 41 + b + 0 + + + 43 + gnarlStrength + .2 + + + 43 + stain + 4 + + + 43 + gnarlDensity + .5 + + + 43 + grainStrength + 4 + + + 43 + grainDensity + 100 + + + + + + 36 + factor + 44 + rings + float + float + + + + 43 + coords + 37 + plankCoords + float3 + float3 + + + + 36 + rhs + 38 + result + float3 + float3 + + + + 38 + rhs + 39 + result + float3 + float3 + + + + 42 + rhs + 40 + result + float3 + float3 + + + + 38 + lhs + 40 + result + float3 + float3 + + + + 42 + lhs + 41 + result + float3 + float3 + + + + 36 + lhs + 42 + result + float3 + float3 + + + + 42 + factor + 43 + grain + float + float + + + + 44 + coords + 43 + gnarledCoords + float3 + float3 + + + + 38 + factor + 43 + grain + float + float + + + + + + game/xleres/Nodes/Basic.sh:Mix3 + 36 + Procedure + 0 + + + game/xleres/ProcMat\Wood\WoodRings002.sh:WoodRings002 + 44 + Procedure + 2 + + + game/xleres/ProcMat\Wood\WoodPlanks.sh:WoodPlanks + 37 + Procedure + 3 + + + game/xleres/Nodes/Basic.sh:Mix3 + 38 + Procedure + 4 + + + game/xleres/Nodes\Color.sh:RGB + 39 + Procedure + 5 + + + game/xleres/Nodes\Color.sh:RGB + 40 + Procedure + 6 + + + game/xleres/Nodes\Color.sh:RGB + 41 + Procedure + 7 + + + game/xleres/Nodes/Basic.sh:Mix3 + 42 + Procedure + 8 + + + game/xleres/ProcMat\Wood\WoodGnarlGrainStain.sh:WoodGnarlGrainStain + 43 + Procedure + 9 + + + + + 36 + result + color + + float3 + 1 + + + + + Sphere + + 0 + + + Plane2D + + 2 + + + Plane2D + + 3 + + + Sphere + + 4 + + + Sphere + + 5 + + + Plane2D + + 6 + + + Plane2D + + 7 + + + Sphere + + 8 + + + Plane2D + result + 9 + + + + + + 1975 + 551 + + Normal + + + + 2613 + 682 + + Normal + + + + 1447 + -61 + + Normal + + + + 310 + 364 + + Normal + + + + 1515 + 783 + + Collapsed + + + + 923 + 815 + + Collapsed + + + + 928 + 753 + + Collapsed + + + + 936 + 699 + + Collapsed + + + + 1511 + 682 + + Collapsed + + + + 905 + 161 + + Normal + + + +)-- */ +/* <>--( + + + false + + + +)-- */