Assignment Goals

The primary goals of this assignment are:

  1. Extend the core Unreal Engine code.
  2. Create a new UE4 material node.
  3. Get experience with the strategy of finding and replicating an example, then changing it to suit your needs.

For this assignment, you'll be creating an new MaterialExpression node for the UE4 material editor. Material editor nodes are part of the core Engine module, and adding a new one requires editing the code in that module.

You will create a native material editor node implementing the random tiling UV transformation described in a chapter of GPU Gems 2, and in slides from the Graphics Hardware Conference.

Details

For this project, you will test using the following two source textures

2-color tiling 3-color tiling
tile1.png (2 edge colors) tile2.png (3 edge colors)

Creating results that will look something like this:

2-color test material 3-color test material

Create a project

  1. Create a a Blank Blueprint project with no starter content called assn6.
    • As usual, put the project at the top level of your git repository

Create a new material node

  1. Find a reasonably uniquely named material node. Replicate its code with a new name.
    • Since the Engine module is widely used, recompiles for minor edits will take a while as it relinks all of the dependent shared libraries (5 minutes for a single cpp change on my laptop). You can usually recompile the Engine module in the running editor without having to quit and restart, which will at least reduce waiting for the engine startup time.
  2. Modify your node to implement the texture tiling method.
    • You should have one UV input pin, and integer parameters in the detail panel for the number of edge "colors" in X and Y.
    • Use one of the hash functions at the top of Random.ush to convert integer cell number to a random edge color (rather than using a texture as described in the article).
    • Output the tiled UV to plug into a TextureSample node.
    • When debugging shader changes, set the r.ShaderDebugMode console variable to 1

Test your node

  1. Create a test material using tile1.png with 2 for both x and y edge "colors".
  2. Create a second test material using tile2.png, with 3 for x and y edge "colors".

Grad Students

Incorporate the texturing into your node as well, so your node does both the tiling transformation to the UV coordinates and the texture lookup.

Extra Credit

Extra credit this time is only available to undergraduates. You are only eligible for extra credit if you submit by the original deadline. For up to 20 points of extra credit, do the additional grad student portion of the assignment.

Submission

For full credit, you must commit multiple times during your development.

Add an assn6.txt. Tell us what works and what doesn't, and anything else you think we should know for grading.

Include a screen shot of the material editor for each of your two test materials, with the new material node selected so we can see what is set in the detail panel. You can capture a screen shot of the full material editor window with the "EditorScreenShot" console command (By default, EditorScreenShot captures the main editor window to the Saved/Screenshots directory. Dock the material editor window with the main UE4 window, or use "EditorScreenShot Name=window-name" to capture an image of the material editor). Scale the coordinate input to your node so we can see the randomized tiling in the material editor preview window in those screen shots.

Make sure your assn6.txt file tells us if you attempted the extra credit.

Push to your repository, and tag your final commit with an assn6 tag.