A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Separate names with a comma.
Discussion in 'Projects In Progress' started by GameDevForce10, Aug 21, 2023.
Just started my new project in Unity. Basic shading work to start with. It begins...
I'm using Unity Built In Rendering Pipeline for this project. The goal of writing these shaders from scratch is to refamiliarize myself with shader programming, as custom shaders will be needed for this project in down the line.
In the previous video I created a scene with a rotating cube and a basic shader/material which displays the object space normals as RGB channels. The basic shader now converts the object space normals to world space and implements basic flat shading using the scene's directional light.
Diffuse (Colour) texture maps have been implemented in the basic shader. I've implemented this by utilising the unity Main Texture to allow easy texture scaling and tiling in the editor for later use.
I've scaled up the ground plane to an area of 100x100 meters, and replaced the grass with a desert texture. Scaling the ground plane led to the texture being stretched significantly. To overcome this issue I've set the texture tiling to 10 times along the X and Z axis. Because the texture used is seamless, this gives the illusion of a much higher resolution. The background colour of the scene has been set to a light blue for the sky.
I've also implemented basic keyboard/mouse movement for the 'player'.
I've added a Base Color property to the basic shader to allow for tinting objects. This allowed me to easily adjust the ground texture in Unity to create a brighter brown. I've also used this property to colour the water plane, which is currently just using a white texture.
I've swapped the ground plain with a model created in Blender. The model is just a box with a hole cut out where the water plain will be exposed. In the following video you can see the oxygen mechanic. If the player's 'head' is in a 'Water' trigger, their oxygen will drain, leading to death and a reset. If the player is out of water, their oxygen regenerates. Oxygen level is indicated by the blue bar in the top left of the screen.
The camera has now been attached to the player Game Object to give a primitive third person type view. In the next video you can see the 'hydration' mechanic. The player will get dehydrated over time, as indicated by the bar in the top right of the screen. Currently the only way to hydrate is to submerge in the water and press E to drink. As well as this I've created a separate shader for the water, which allows transparency. I've also added a texture to the water.
This next video shows the energy system. Energy is depleted over time as seen in the reddish middle top bar on the screen. I've implemented sprinting with the shift key, although there is a price to this, as it will lead to energy being depleted faster. This energy system doubles as a health system, where if the player runs out energy he starves and dies. To replenish energy the player can eat. On the map you can see red cubes, these are 'berries' the player can eat by colliding with.
I've implemented a death screen indicating how the player perished. You can see in the video that the player ran out of energy and starved on the first attempt. In the second attempt the player gets to the berry bush and eats before starvation. I've updated the berry and player models so that they're not so blocky, and added some rock models as obstacles, as well as a berry bush where the player can get more calories than from single berries.