Blog-Eintrag

A button that uses the State Pattern, we have already made, to switch between the surface and bunker view. 

What was needed as an addition was a little UI system that interacts with the 3D UI elements.
The 3D-model is selfmade (except the drawing) and has a little animations when hovering over it and one for being pressed (this was quite tricky to make it work bc of the way lerp works in this case).

Whilst switching the views the system saves the last position it was on the surface and bunker respectively and indicates the current view with a one sided light.


3D UIs are IMO quite cool / immersive slightly smiling face 


After several misses I trained a working Inverse Pendelum self-balanced robot which can move across the terrain.

1.1. Problems I encountered

  • some self intersecting colliders blocked the arm movement => used a custom script to ignore Collision between those parts (Physics.IgnoreCollision)
  • setting the penalty for falling too low generated a faster movement like intended, but greatly worsen the the use of armbalancing
  • Motor strength too low for hills

1.2. Setup

My setup was very modular, using interfaces for respawning the target and agent, which will make training other agents a lot easier. 

It trained 10 hours on a high-end desktop PC, still improving by a smaller rate. 

The exact setup is not complicated but involves many detailes and thousands of lines of code.
The main parts are:

  • all positions, rotations, velocities are relative to the white cube seen in the picture which is rotated towards the target on the x,z plane and aligned with the global y-axis; the motivation behind this is to make the movement relative to the gravity and the relative rotation to the target; which is more stable taking all possible poses into account
  • the reward is 1*(alligning the forward direction and orientationCube forward) + 10*(Dotproduct(speedVector, goadirection))
  • inputs:
    •  velocity, angularVelocity, position, rotation for each joints
    • current joint force
    • global position of main body part and target (part beyond the head)
    • raycasts for terrain height; and raycasts from body for better terrain estimation 
  • outputs:
    • joint position (interpolated between max and min for each moveable axis)
    • motor torque


1.3. Result

I am very satisfied with the results; they complement our main technical achievement of having visually appealing visualizations. In contrast to hard-coded animations with Inverse Kinematics or even Procedural Animations, our system reacts to external forces very naturally. The built-in springs and physical movements significantly enhance the experience of observing a real robot.

1.4. Next Steps


the next part will be to incoperate it in an RTS system to enable the player to give movement commands to them and to fnd a suitable recovery method if the  trip (use some magic force to stand up or try to train it with ML)

Custom Toon Shader

I created a Post-Processing Toon Shader using Unity's Shader Graph. It employs basic cell shading with a subtle setup and edge detection using Robert Cross Outlines based on Depth, Normal, and Color Difference (HSV).

Implementing this would be straightforward in plain HLSL, but it was my first time using Shader Graph. Figuring out how to utilize the color buffer alone took me several hours, in addition to learning how to obtain screen width and read texture, etc

The result adds some additional stylization to the scenery while remaining subtle, achieved by interpolating (lerping) between the input and the Toon Shader.




I have expanded the first draft of the terrain; the enlargement of the site has contributed a lot to the visual fidelity;

To boost performance I used camera occlusion baking

Added Unity's Volumetric Clouds

Problems encountered:

  •  git doesnt support terrains (delcared as .asset); first fix was to manually copy it; 
  • still too many trees => bad performance

1. Crop Farm first draft of the model