Monday, 2 September 2024

Minecraft Level Assignment

   


    This week our assignment was to replicate a Minecraft aesthetic while learning about using opacity and translucency. 

 

Texture File of the grass and flowers



 

Texture File of grass block

    Masked is for opacity and translucency is for translucency. You can change these blend nodes even on instances of materials. 

    Note that for the grass materials, when you change the material's shading model to "Two sided Foliage", the colors seem to get washed out. You need to plug in the base color to the subsurface color input to get the colors back. Also don't forget to check "Two Sided" on as well.

Node tree for the master block material

    The node tree for the Master block material included a section that used the time node multiplied by a wave height node to offset the (z) world position of the block, making the block move up and down in a smooth motion. It includes a Wave On Off node along with a parameter to choose to turn it off or on. This was supposed to be used for a water block.

All of this goes to the World Position Offset input for the material

    I wanted to try and apply this to the grass and flower planes, but to make it look more like wind. I looked at materials from the Meadow - Environment Pack on the Unreal Marketplace since I had used it in another project, and the materials for the realistic grass looked as if wind was blowing through it. 

These nodes would also go to the World Position Offset input for the material

    This material utilized the Simple Grass Wind node and promoted most of it's inputs to parameters. The 'additional world position object' input comes from the texture object node (base color). From there it is multiplied by a Camera Depth Fade node, so that grass farther away from the camera does not move as much as grass closer to the camera. I didn't like the effect this created, as the planes moved up and down too much and would appear to be floating at some instances. I had tried to include a Split Component Node to only get the X and Y components to mitigate the floating feeling, but it wasn't working. I went looking for another tutorial to follow and found this one that worked for me by WACOMalt. 



    These nodes work by using a normal map (i used a grass normal map in the starter content folder), sliding it across world space coordinates and then interpolating that position with the position of the original vertices normals using a LERP node. This allows for the bottom vertices to stay 'stuck' to the bottom of the ground. The final node is plugged back into the World Position Offset of the material. 

    The normal map that we use, is scaled to a very large degree (that constant 3 node with the 18000x18000x18000 is what's causing to scale), and then we are panning that normal map back and forth over all the grass, and using those coordinates to blend with the original vertex normal coordinates. It's a global texture moving across the plane, and therefore distorts each plane uniquely but smoothly. The Panner node only uses the X and Y world position coordinates because we only want the gras to go side to side, not up and down (it also only takes a vector2 not a vector3).

    Also important to note that the normal map is a texture object not a texture sample, because a texture object exists without any mapping until it is projected, which is what we do with the World Aligned Texture Node.  

    The mask node after the World Aligned Texture node is to mask out the 'b' component (z) and replaced with the constant 0 because we don't want to distort the grass up and down. 

    The next multiply node in the video he only multiplied it to 16 to make a strong wind effect. I had promoted it to a parameter to change it if needed but left the default to 5.

    Tip: you can create a LERP node by holding down L and clicking.

    The LERP node here is blending with the distortion you've created and the original position, blending them based on a gradient based upon UV coordinates (a vertical gradient, 0 at the bottom 1 at the top, because we want the bottom to have no distortion and the top to have full distortion).

    Right click on the LERP node and choose "start preview mode" to see how the distortion is working. 

No comments:

Post a Comment

Shader Tool Week 5 - Shadow Mapping

      Shadow Mapping in 4 steps Projection Texture Mapping Occlusion Depth Mapping  Projection With Occlusion Shadow Mapping Projection Text...