This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Derive slope from surface normal (0 = flat, 1 = vertical cliff) | |
| // Clamp to guard against floating-point overshoot on nearly-vertical faces | |
| float slope = saturate(1.0 - dot(normalize(worldNormal), float3(0, 1, 0))); | |
| // Normalize height into 0..1 across the terrain's actual used range | |
| // Use the real min/max of your sculpted terrain, not the asset's full range | |
| float height = saturate((worldPos.y - terrainMinY) / (terrainMaxY - terrainMinY)); | |
| // Sample each gradient using the derived 0..1 values | |
| float3 slopeColor = sampleGradient(slopeGradient, slope); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NoiseNode : public ImageNodeBase | |
| { | |
| protected: | |
| Slot m_outputSlot; | |
| float2 m_offset{ 0,0 }; | |
| float2 m_scale{ 500,500 }; | |
| int m_layerCount{ 1 }; | |
| float m_lacunarity{ 2 }; | |
| float m_persistence{ 1.0f / 3.0f }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool GUI::Float2Field(const char* label, float2* value) | |
| { | |
| PrefixLabelC(label); | |
| ImGuiWindow* window = ImGui::GetCurrentWindow(); | |
| if (window->SkipItems) | |
| return false; | |
| int c = 2; //component count | |
| float w = ImGui::CalcItemWidth(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool GUI::FloatField(const char* label, float* value) | |
| { | |
| return ImGui::InputFloat(PrefixLabelC(label), value); | |
| } |