Walkway and Temple Generater Tool

Procedural Walkway and Temple Generator Project

    Jiaqi Cui
12/2020-01/2021

Motivation

 This project was inspired by an indie game called "Townscaper." In that game, players can build their own small towns by clicking the mouse. Interestingly, by clicking on the front, back, left, and right sides of the building or the top side, the building will "grow" in the corresponding direction, and the whole model is adjusted as well. This is not so much a game, as it is a kind of interaction method of procedural modeling tools.


My original goal was to create an Asian-style village scene with my procedural assets, including buildings, roads, bridges, temples, and other natural environment assets such as trees, bamboos, and rocks. And then use randomized parameters to change the layout of the assets to generate different levels. Another option was to offer the same interactive logic as the Twonscaper, let the level designer or player generate levels by themselves. The walkway and temple were one part of my "ambitions."

Breakdown

1.Walkway
  • Design
The lake often has a walkway and temple in Asian-style scenes. From my user interaction design part, the position of the start and endpoint is critical. Once the user sets the start point of the shore and the temple's endpoint, the walkway will automatically be generated. To avoid that the walkway created every time looks the same, I added a random path function to the walkway.


Reference Images

  • Generate Lines
This procedural walkway starts from points and lines. According to the design, generate a path between the start point and the endpoint. 


When designing the random movement method, to perform real-time model generation, I used simple random: given a random number from 0 to 1, if it is less than 0.5, extend the random distance to the right, if it is greater than 0.5, move forward Random distance.

According to requirements, this random method can also be replaced with an algorithm of the shortest distance between two points, or the Perlin algorithm can be used to obtain a more natural effect.


  • Calculate directions and Replace Modules
When replacing these modules, the biggest problem I encountered was how to place the right modules in the right place. 


In other words, I need to determine the direction of the current walkway to place different modules. Whether to go straight and turn left, go straight and turn right, or turn left and then right, or point or end.


The method I use is to use the normal direction to determine the direction to decide which module to use. First, the normal direction is generated by traversing from the first point to the last point, and the normal direction of each point always points to the next point, by obtaining the normal direction of the current point, the normal direction of the previous point, and the next point's normal direction. Use if-else statements to judge different situations and use different modules.



  • Refine modules
After confirming the different module types, the next step was to replace and refine the corresponding modules. I used the Asian-style pattern here; if we want to create different levels of levels, we could change and adjust the module details.

According to the observation, details like patterns can express style very well. By drawing different patterns, I could better understand how to generate them recursively by coding.




  • Another usage
I found that we need to determine the starting point and the direction of the focus to avoid that the direction of the walkway is parallel to the shore. By changing the starting point direction and the focus and copying multiple walkways, we can generate a circular walkway or a continuous long walkway.


2. Procedural Temple

For the pavilion, in addition to the conventional length, width, height, and other parameters, the number of corners of the pavilion is also very important. Common pavilions are the four-corner pavilion, hexagonal pavilion, and octagonal pavilion. At the same time, the style of the roof of the pavilion will also affect the style of the pavilion.


result and control parameters
  • References
  • Analysis
As mentioned earlier, the number of corners of the pavilion is also very important, so I started with a cylinder and placed different modules by getting the position of the cylinder vertex. The "Copy to point" node plays a critical role in my workflow. For a better analysis, I divided the pavilion into upper, middle, and lower parts.

  • Bottom Part
For the modeling of the bottom, the core problem is to control the parameters of the cylinder according to the input radius, the number of corners, and the height of the bottom.


  • Middle Part
For the middle part, the most difficult part is how to calculate the length, position, and rotation of the pavilion wall when changing the corner of the pavilion, and how to always keep the position of the door facing the front.


The method I use is to first take the midpoint of the original polygon line segment as the center position of the wall, and then use the trigonometric function to calculate the distance between the vertex and the vertex as the length. In this way, the wall of the pavilion can be generated in a suitable position.



  • Top Part

When making a roof, the difficulty lies in how to make different styles for the roof. I used Soft Transform to make roofs of different styles on the basis of the previously generated polygonal line segments. These roofs use cubic, quadric, and linear methods respectively. In addition, when there are multi-story buildings, there is no middle part of the eaves in the middle. I used the boolean node to solve this problem.

In fact, when making the roof, how to make tiles has been bothering me. I have thought about it for a long time and have not found a suitable solution. Maybe in the future study and work, I can find inspiration to solve this problem.



   roof in the middle part

  • HDA Assets

Temple HDA

Walkway HDA
  • Future Works

Render Result

Later, after I communicated with other people, I found that my walkway still needs improvement in many areas: for example, how to solve the workflow 
  • if two walkways cross
  • if the walkway encounters obstacles when it is generated, how to avoid obstacles,
  • if the terrain is too complicated, how to use a manual input curve to generate a walkway
  • how to generate a walkway in real-time in the game by clicking different directions.
  • Real-time rendering and post-processing in UnrealEngine4
I believe that there must be predecessors in the game industry who have better solutions to these problems. Through communication and learning, I can also create more exciting works. I'm looking forward to having such an opportunity to communicate and improve my skill.

Thanks for watching! 


评论

此博客中的热门博文

Moon Island --- Final Project of Rendering and Shading class

Assignment04 Rebuild Mark Twain's House