Primitive Alterations and Hyperbolic Space
Updated: Apr 19, 2021
Development Updates this week
Collision detection for 4D objects
This week I have attempted several methods to generate collision detection for 4D objects. The general idea is to send the player’s transform position to the raymarch shader and use the distance function in the raymarch shader to detect distance. Currently, I am still trying to figure out how to communicate this data through C# scripts and shader. In my next step, I will attempt to figure out how to use a ray marcher to check the distance to a given transform, and if the distance is smaller than zero, the transform moves in a different direction.
While encountering blockers in collision detection simulation, I used the rest of my time researching other possible higher dimensional/raymarching topics.
Primitive Alterations
Elongating is a useful way to construct new shapes. It basically splits a primitive in two (four or eight), moves the pieces apart and connects them.

float opElongate( in sdf3d primitive, in vec3 p, in vec3 h )
{
vec3 q = p - clamp( p, -h, h );
return primitive( q );
}
float opElongate( in sdf3d primitive, in vec3 p, in vec3 h )
{
vec3 q = abs(p)-h;
return primitive( max(q,0.0) ) + min(max(q.x,max(q.y,q.z)),0.0);
}Primitive Combinations
Union, Subtraction, Intersection
These are the most basic combinations of pairs of primitives you can do. They correspond to the basic boolean operations.
float opUnion( float d1, float d2 ) { min(d1,d2); }
float opSubtraction( float d1, float d2 ) { return max(-d1,d2); }
float opIntersection( float d1, float d2 ) { return max(d1,d2); }Fractals
Fractals are simple infinitely repeated patterns that are self similar across different scales.

The Mandelbulb
This 3D Mandelbulb can be achieved by squaring the 2D Mandelbrot equation: zn+1=z2n+c
But first, let us briefly return to the 2D Mandelbrot equation: zn+1= zn2+c
Building Hyperbolic Space in Unity

1. Technique: Tile Mapping
Change different square per vertex to use different levels
Represent tile coordinates as string of steps away from the origin
Recursively expand from origin, if a tile already exists, skip and move on
2. Represent location, rotation, coordinates system
In Unity 3D, this has been handled using a transformation matrix with all the information for position/rotation/movement
Repeating the same concept for hyperbolic space, this time we use gyrovector to do matrix computation.
Objectives for next week
1. I will continue working on collision detection for 4D objects. I will create a class to store all information for a 4D objects and using a C# script to collect and compute data before sending data to a shader. In this way, the script that manages the transform of the player can better communicate with the distance function for ray marching.
2. I will implement more functions for primitive alterations to see what interesting new shapes can be generated through this method.
3. I will start implementing a 2D Fractal algorithm in Unity to see a possible visualization of fractals.
Learning Resources
1. Ray Marching/Distance functions: https://iquilezles.org/www/articles/distfunctions/distfunctions.htm
3. Hyperbolic space: https://www.youtube.com/watch?v=pXWRYpdYc7Q&t=260s
Reference
2. Image used: http://blog.hvidtfeldts.net/index.php/2011/09/distance-estimated-3d-fractals-v-the-mandelbulb-different-de-approximations/
3. Gif used: https://imgur.com/V96Zy7b




https://keonhacai.cam/ mình thấy mấy hôm nay nhiều người nhắc nên cũng tò mò bấm vào coi thử giao diện thế nào. Mình không có ngồi soi nội dung hay chọn từng mục gì đâu, chủ yếu lướt qua xem họ sắp xếp trang ra sao cho dễ nhìn. Ấn tượng đầu là bố cục khá gọn, các phần được chia thành từng khối rõ ràng nên kéo xuống không bị “ngợp”. Menu cũng đặt chỗ dễ thấy, bấm chuyển qua lại giữa các mục khá nhanh, không phải mò mẫm nhiều. Mấy bảng thông tin hiển thị theo dạng cột nhìn sạch sẽ, chữ không quá rối nên đọc lướt vẫn nắm được ý. Nói chung mình thích kiểu trình…
Bài viết của bạn viết gọn gàng, đi thẳng vào ý chính nên mình đọc một mạch là hiểu, cảm ơn bạn đã đăng. Mình cũng hay xem thống kê XSMB hằng ngày, nhưng trước đây cứ phải mở nhiều chỗ để đối chiếu nên khá tốn thời gian. Sau đó mình tự tổng hợp lại để tiện theo dõi, kiểu lưu mọi thứ về một nơi trên soicau247.com cho dễ xem lại khi cần. Mình không phải lúc nào cũng rảnh, nên có chỗ ghi lại theo ngày như vậy đỡ phải nhớ lung tung. Ai cũng có thói quen cập nhật số liệu mỗi ngày thì có thể xem thêm ở đây: https://soicau247.com/gioi-thieu.html.
Bài viết ngắn gọn, đi thẳng vào kỷ niệm tập luyện nên đọc rất cuốn, cảm ơn bạn đã chia sẻ. Dạo này mình cũng hay để ý cách mấy nền tảng giải trí online sắp xếp giao diện nên vào xem chủ yếu để quan sát bố cục, menu và cách họ chia mục. Mình gom vài mẫu UI mình thích lại để tiện xem lại, ai cần tham khảo thì ghé https://uiverse.io/profile/trn_7102