Meet Coder: Your Blender AI co-pilot to search and generate blender programs + 3D models

Coder is your AI copilot for blender python programming using natural language queries. Sign up for free: https://www.coder.csm.ai/

Coder generates programs from scratch but also internally does live search over stackoverflow, blender stackexchange, github and other web resources so you don’t have to! You can input natural language to retrieve 3D models from the web!

Read more here: https://csm.ai/introducing-coder-text-to-code-for-3d-world-generation-gaming-and-programming/

You can use it to solve complex bpy tasks like “write a function to extrude faces of an n-gon” by entering queries in natural language. In this case:

Prompts = “Function to extrude selected faces.” + “Rewrite this into a function where extrusion is over n-gons”.

5 Likes

i dont get the confirmation email . im logging in through google with a non gmail adress

Same for me - can you give an indication how long the wait will be?

image

should work now if you try!

1 Like

should work now - let me know.

1 Like

It works, thanks! I logged into your site using Google - when using the add-on I need to enter a password, but obviously I didn’t set one. How should I proceed?

The add-on login/password is only needed so you can download your uploaded assets from https://3d.csm.ai/ (directly into blender without manually downloading). Otherwise you can simply use coder and then copy/paste code in bpy after editing etc. If you signed in using an explicit username + password then it should work out of the box. Let me look into direct Google login.

Idk if it’s going to be dominate or not, but looking forward to it.

yep it woked , thanx for the cool tool , this in one tab and gpt in another really make it easy to write stuff.

thank you for the feedback! We are also working on a VSCode plugin to make it easy to code in-line. If you have any feature requests or additional feedback then please let us know!

1 Like

it would be nice if we culd also correct it like chatgpt , like say:

'No, i wanted it to store the positions in an array first before smoothing … please correct the code. ’

right now its a one sentence → generation.

another nitpick is that it always trys to find an existing answer first. means you have to click a few times before it writes something for you.

im looking forward to the vscode addon. maybe you can make a good guide how to run that directly from vs code into blender to go along with your addon.

'right now its a one sentence → generation."

You can actually turn the context toggle button on and ask a follow up question like what you are suggesting. We need to better surface this. Please try and let me know. This is super helpful feedback!

“means you have to click a few times before it writes something for you.” → is the lot of clicking in prompting or model selection and then prompting?

VS code addon → will do!

Thank you so much for your valuable feedback!

Big update: Coder is now integrated with ChatGPT-API.

https://twitter.com/CSM_ai/status/1631041641208328192?s=20

1 Like

what version of blender is it trained on? I’ve noticed that ChatGPT is awful at anything involving the GPU module since it was still under active development when training stopped

Hi @testure!

Coder has data from newer blender versions too so it should be better if you prompt it well – this is what it will depend on. Would be really curious to get your take on how well it works and where it fails – we can then do our best to improve it with your feedback. Please let me know.

opk i used it today again … so on firefox i can only enable the context toggle after i asked once.

i asked it : how to set new coordinates for a point in a grease pencil stroke ?
and it returned a spiral creation script. only after asking and getting a wrong answer i could turn on the context toggle .thats what i mean with clicking and waiting .

Another nitpick is that between every line of code theres an empty line , thats hard to read and handle.

From my tests, it tends to whiff on the prompts completely. For example, asking for a dead simple vertex shader example with the following prompt:

In Blender, using Python and the gpu module to draw custom GL to the viewport, how would you make a rectangle with rounded corners?

The CSM result is a script that tries to create a beveled plane using bmesh, which- incidentally fails to run due to various exceptions:

import bmesh
import bpy
from mathutils import Matrix

dim = (2, 1)
cnr = 0.2

bm = bmesh.new()

bmesh.ops.create_grid(
    bm,
    size=0.5, 
    matrix=Matrix.Diagonal((dim[0], dim[1], 1, 1)) @ 
    Matrix.Translation((0.5, 0.5, 0)),
    )

bmesh.ops.bevel(
        bm,
        geom=bm.verts,
        #loop_slide=True,
        affect='VERTICES',
        profile=0.5, # round
        offset=cnr,
        segments=5,
        )
      
bmesh.ops.triangulate(
        bm,
        faces=bm.faces,
        )

# scale by 100
bm.transform(
    Matrix.Diagonal([100] * 4)
    ) 

# translate by 100, 100
bm.transform(
    Matrix.Translation((100, 100, 0)) 
    )   

print("vertices = (")
for v in bm.verts:
    print(f"\t{v.co.xy[:]},")

print(")")
print("faces = (")

for f in bm.faces:
    print(f"\t{[v.index for v in f.verts]},")

bm.to_mesh(bpy.context.object.data)
print(")")

# Set outline width
bpy.data.objects['Mesh'].data.bevel_depth = 0.1   

# Hide edge lines
bpy.data.objects['Mesh'].data.show_edge_crease = False

Asking the same thing in ChatGPT gives you a script that also fails to run due to numerous exceptions, but it does at least give a result that is in the ballpark:

import bpy
import gpu
import bgl
from gpu_extras.batch import batch_for_shader
from mathutils import Vector

# Define the shader program
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRI_STRIP', {"pos": [(0, 0), (0, 0), (0, 0), (0, 0)], "radius": 0.1})

# Define the size and position of the rectangle
x, y = 100, 100
width, height = 200, 100
radius = 20

# Calculate the corner vertices
corners = [(x+radius, y+radius), (x+width-radius, y+radius), (x+width-radius, y+height-radius), (x+radius, y+height-radius)]

# Define the vertices of the rectangle
vertices = []
for corner in corners:
    vertices.append(corner)
    vertices.append((corner[0]+radius, corner[1]))
    for i in range(1, 7):
        angle = i * (3.14159/4)
        vertex = Vector((corner[0]+radius+radius*math.cos(angle), corner[1]+radius+radius*math.sin(angle)))
        vertices.append(vertex)

# Set the vertices and radius data for the batch
batch.vertices["pos"] = vertices
batch.vertices["radius"] = [radius] * len(vertices)

# Draw the rectangle to the viewport
bgl.glEnable(bgl.GL_BLEND)
shader.bind()
shader.uniform_float("color", (1.0, 1.0, 1.0, 1.0))
batch.draw(shader)
shader.unbind()

I wouldn’t even call that a nitpick- the double spacing is ROUGH.

2 Likes

Thank you for the feedback!

The context toggle is after 1 response. We just simplified and pushed major updates to make it more intuitive. Please try and let me know.

empty line – thank you for pointing out. A newline bug got introduced but it should be fixed now.

Please retry and let us know how we can improve things!

Thank you so much for the feedback! Really appreciate it.

We just pushed a major update which should make the UI simpler and the answers more accurate.

Not sure if the code is compile ready but I tried your prompt and got this response after the new updates (different than both the answers you posted)

Please use Blender model type (things are much simplified now as before there were many model types and it caused confusion). Also the code spacing was really annoying and it happened due to a bug – fixed now. Long prompts are being truncated or overflowing – this should be updated by tomorrow or so.

Please let us know your feedback and how we can improve it!

For compile ready code, we will soon push a feature for python where we would be running the code in a VM and iteratively debugging with the AI. This won’t work 100% of the time but it will be a big step towards code that is verified. Do you think this would also be valuable for bpy code? Let us know if we should prioritize this.