Verse Library verse

01 Fragment

Configures a material to render both sides with interpolated colors based on camera view.

verse-library/create-twosided-materials-in-unreal-editor-for-fortnite/01-fragment.verse

// This is a comment. It helps you remember what the code does.
// We are building a node graph in UEFN.

// 1. Create the main material
MainMaterial := CreateMaterial()

// 2. Enable two-sided rendering
MainMaterial.TwoSided := true

// 3. Define colors for front and back
FrontColor := Vector3(0.0, 1.0, 0.0) // Bright Green
BackColor := Vector3(0.0, 0.5, 0.0) // Dark Green

// 4. Get the side we are looking at
SideSign := GetTwoSidedSign()

// 5. Mix the colors based on the side
MixedColor := Interpolate(FrontColor, BackColor, SideSign)

// 6. Make the color pop
FinalColor := Saturate(MixedColor)

// 7. Apply to the material
MainMaterial.BaseColor := FinalColor

Comments

    Sign in to vote, comment, or suggest an edit. Sign in