ChatGPT and ICR2
I was playing around with ChatGPT and decided to feed it Pavel's instructions for making a .3D file. Here's what it said:

ChatGPT: "This is a set of instructions for creating a 3D file, consisting of points, polygons, and a BSP tree. The file must begin with the string "3D VERSION 3.0;" and all strings must be ended with ";". All comments can be placed after "%". A "nil" pointer is represented by "NIL;". In the BSP tree, polygons must be arranged in reverse order from the driving direction. The forms for creating polygons include "POLY" and "FACE". "MATERIAL" is used to assign a texture to a polygon. "DYNAMIC" is used to create a dynamic object."

Me: "Create an example of a 3D file based on the above instructions."


% front side of a house
point0001: [<0, 0, 0>];
point0002: [<0, 0, 10>];
point0003: [<5, 0, 10>];
point0004: [<5, 0, 0>];
point0005: [<0, 5, 0>];
point0006: [<0, 5, 10>];
point0007: [<5, 5, 10>];
point0008: [<5, 5, 0>];

front: POLY [T] <42> {point0001, point0002, point0003, point0004};
back: POLY [T] <41> {point0005, point0006, point0007, point0008};
right: POLY [T] <43> {point0004, point0003, point0007, point0008};
left: POLY [T] <44> {point0001, point0005, point0006, point0002};
top: POLY [T] <45> {point0005, point0006, point0007, point0008, point0004, point0003, point0002, point0001};

front01: MATERIAL MIP="wall01", GROUP=3, front;
back01: MATERIAL MIP="wall01", GROUP=3, back;
right01: MATERIAL MIP="wall02", GROUP=3, right;
left01: MATERIAL MIP="wall02", GROUP=3, left;
top01: MATERIAL MIP="roof01", GROUP=3, top;

front_bsp: BSPF (point0001, point0002, point0003), NIL, back_bsp, right_bsp;
back_bsp: BSPF (point0005, point0006, point0007), NIL, left_bsp, front_bsp;
right_bsp: BSPF (point0004, point0003, point0007), front_bsp, top_bsp, NIL;
left_bsp: BSPF (point0001, point0005, point0006), back_bsp, NIL, top_bsp;
top_bsp: FACE2 (point0001, point0002, point0003), right_bsp, left_bsp;

ChatGPT: "This creates a simple house object with five polygons for the front, back, right, left, and top sides, and assigns texture materials to each polygon. The BSP tree is constructed by linking the polygons in the correct order to create a 3D object that can be rendered by a game engine."

Me: "Can you explain how a BSP tree works? I'm struggling to understand it."

ChatGPT: "A BSP (Binary Space Partitioning) tree is a hierarchical data structure used in computer graphics to efficiently render complex 3D scenes. The basic idea of a BSP tree is to recursively split a scene into two parts based on the position of objects in the scene. Each split is defined by a plane, which is chosen to divide the scene in such a way that the resulting parts contain roughly equal numbers of objects.

At the top of the tree is the root node, which represents the entire scene. The root node is split into two child nodes based on a chosen plane. Each of these child nodes can then be split further, and the process continues until every object in the scene is contained in a leaf node of the tree.

When rendering a scene using a BSP tree, the tree is traversed in a depth-first order, and objects are drawn in the order in which they are encountered. This ensures that objects that are closer to the viewer are drawn last, and therefore appear on top of objects that are farther away.

One of the key benefits of using a BSP tree is that it can greatly reduce the number of objects that need to be rendered, which can lead to significant performance improvements. Additionally, BSP trees can be used to perform efficient collision detection in games and other interactive applications."

Second example. I just gave it the following code, which is Pavel's example for making a grandstand:


% side left
point0001: [< -360000, 250000, 190000>, T=<116, 143>];
point0002: [< -360000, 250000,      0>, T=<116, 208>];
point0003: [< -360000,      0,      0>, T=<33, 208>];
point0004: [< -360000,      0,  70000>, T=<33, 187>];
% grand seats
point0005: [< -360000, 250000, 190000>, T=<3, 0>];
point0006: [< -360000,      0,  70000>, T=<3, 63>];
point0007: [<  360000,      0,  70000>, T=<175, 63>];
point0008: [<  360000, 250000, 190000>, T=<175, 0>];
% front grand
point0009: [< -360000,      0,  70000>, T=<0, 215>];
point0010: [< -360000,      0,      0>, T=<0, 248>];
point0011: [<  360000,      0,      0>, T=<255, 248>];
point0012: [<  360000,      0,  70000>, T=<255, 215>];
% side right
point0013: [<  360000, 250000, 190000>, T=<116, 143>];
point0014: [<  360000, 250000,      0>, T=<116, 208>];
point0015: [<  360000,      0,      0>, T=<33, 208>];
point0016: [<  360000,      0,  70000>, T=<33, 187>];

sidel: POLY [T] <41> {point0001, point0002, point0003, point0004};
grand: POLY [T] <45> {point0005, point0006, point0007, point0008};
front: POLY [T] <37> {point0009, point0010, point0011, point0012};
sider: POLY [T] <40> {point0016, point0015, point0014, point0013};

nil: NIL;
sidel01: MATERIAL MIP="page04", GROUP=3, sidel;
_Sl: BSPF (point0001, point0002, point0003), nil, sidel01, nil;
grand01: MATERIAL MIP="grand1", GROUP=3, grand;
_G: BSPF (point0005, point0006, point0007), nil, grand01, _Sl;
front01: MATERIAL MIP="page04", GROUP=3, front;
_F: BSPF (point0009, point0010, point0011), nil, front01, _G;
sider01: MATERIAL MIP="page04", GROUP=3, sider;
hi: BSPF (point0016, point0015, point0014), nil, sider01, _F;
COOL: SWITCH DISTANCE (point0016) > {(2500000 ? hi), (750000 ? hi), (0 ? hi)};

And with no further explanation from me (and this is a separate conversation from the one above, so it doesn't have Pavel's instructions for it), ChatGPT said:

This appears to be a code snippet written in a programming language used for 3D modeling. It defines a set of points and polygons, and creates a BSP tree to represent the geometry of a 3D object. The object appears to be a seating area or stadium, with different sections and viewpoints. The last line of code creates a switch to control the level of detail based on the viewer's distance from the object.
Ok.... In a way it is impressive. In a way you are feeding Skynet.....
IIRS Driver Champion (2005-2007, 2010-2014)
IIRS Team Champion (2004-2014)
I was looking for a way to edit the detroit .3D file to fix the speckles in the tunnel by changing the base asphalt color, and I wanted to make a script that could do it automatically even if I later have to rebuild the .3D file.

So I spent about half hour talking to ChatGPT and was able to come up with a script that searches for a particular string between two other specified strings, and replaces it with another string. For example:

Look for: MIP = "ASPHALT"
Between: sec54_s0_HI: FACE and % Finish the segment
And replace it with: MIP = "ASPHALTD"

It actually works! So now I have a kind of multi-purpose tool that I can use to make edits to a .3D file and the speckles in my Detroit tunnel are gone!

import sys

# Check if the correct number of command line arguments were provided
if len(sys.argv) != 3:
    print("Usage: python linereplace <input_file> <search_file>")

# Get the input filename and search filename from command line arguments
input_filename = sys.argv[1]
search_filename = sys.argv[2]

# Open the input file in read mode
with open(input_filename, 'r') as input_file:
    # Read the contents into a string and split by line breaks
    input_string =
    strings = input_string.split('\n')

# Open the file to search in read mode
with open(search_filename, 'r') as file:
    # Read the file contents into a string
    text =

# Loop through each string in the input file and perform string replacement
new_text = text
for s in strings:
    # Split the string into A, B, C, and D
    string_a, string_b, string_c, string_d = [t.strip() for t in s.split('|')]

    # Find the index of the first occurrence of string A
    index_a = new_text.find(string_a)

    # Check if string A was found in the file
    if index_a == -1:
        print(f"Error: {string_a} not found in {search_filename}")

    # Find the index of the first occurrence of string D after string A
    index_d = new_text.find(string_d, index_a)

    # Check if string D was found in the file
    if index_d == -1:
        print(f"Error: {string_d} not found in {search_filename} after {string_a}")

    # Find the index of the first occurrence of string B between string A and string D
    index_b = new_text.find(string_b, index_a, index_d)

    # Check if string B was found in the file between string A and string D
    if index_b == -1:
        print(f"Error: {string_b} not found in {search_filename} between {string_a} and {string_d}")

    # Replace the first occurrence of string B with string C
    new_text = new_text[:index_b] + string_c + new_text[index_b+len(string_b):index_d] + new_text[index_d:]

# Open the search file in write mode and write the new text
with open(search_filename, 'w') as file:

Sample code for the input file:

sec54_s0_HI: FACE|MIP = "ASPHALT"|MIP = "ASPHALTD"|% Finish the segment
sec54_s1_HI: FACE|MIP = "ASPHALT"|MIP = "ASPHALTD"|% Finish the segment
sec54_s2_HI: FACE|MIP = "ASPHALT"|MIP = "ASPHALTD"|% Finish the segment
sec54_s3_HI: FACE|MIP = "ASPHALT"|MIP = "ASPHALTD"|% Finish the segment
sec54_s4_HI: FACE|MIP = "ASPHALT"|MIP = "ASPHALTD"|% Finish the segment
sec54_s5_HI: FACE|MIP = "ASPHALT"|MIP = "ASPHALTD"|% Finish the segment
sec54_s6_HI: FACE|MIP = "ASPHALT"|MIP = "ASPHALTD"|% Finish the segment
sec54_s7_HI: FACE|MIP = "ASPHALT"|MIP = "ASPHALTD"|% Finish the segment
wow I never thought I would see something like this...

now I wonder if this thing can analyze LPs and help figure a way to make the cars pass easier.
Today they released GPT-4 and I taught ChatGPT the .3D language using just one example and some basic words of advice (like clarifying the directions of x, y, z).

Then I asked it to create a house.

(Can't post attachments today but see the picture in the link below)

Update: here's me asking it to build a football stadium

Forum Jump:

Users browsing this thread: 1 Guest(s)