GPT Chat can teach you how to use Babylon.js

Y’all need to see this:

This is absolutely wild.

5 Likes

woa. that’s better than google.

2 Likes

Haha, awesome!

cc @PirateJC

4 Likes

Wow. That is also impressive. So between being able to ask very specific questions with GPTChat and prototyping various scenes and objects with Codex, I can move really quickly! Love this!

Ooh i was playing with codex today. It was a really good alternative to googling for babylonjs code snippets (and general javascript help). Their sandbox didn’t work for generating babyon scenes like in that video b/c it doesn’t load the libraries. Wonder if he created a custom setup there with libs preloaded and then using the codex api.

I wanted to try it out b/c when i asked “Create a snowstorm” … it generated some really interesting particle stuff. Was wondering how far i could take it…

I also did feel like a sucker for spending so much time doing things by hand. Like when you’re a kid and you realize that there’s a calculator for that.

1 Like

I feel that; I will never use long division, ever. But just think how much more use you got out of the calculator by already having the basics down yourself!

I used ChatGPT to generate some animation code combining GSAP + babylon.js… it created novel working examples that I was able to tweak. Pretty mind blowing!

1 Like

It’s really nice to have in your back pocket. When I’m feeling lazy I just ask it how to do stuff I don’t wanna look up such as “how to include GLTFFileLoader in your project” since I wasn’t sure what the npm package was called.

Not to hijack this thread, but if you could an AI feature to the Babylon platform, what would it be and why?

1 Like

Integrate Codex into Playground.
I was about to write a chrome plugin to do that actually… would make experimentation SO much faster.

2 Likes
  1. Looking up random packages such as:
    "how to include GLTFFileLoader in your project”
    “how to include fur material in your babylon.js project”

  2. Generating conceptual explanations such as the difference between an objects center / bounding box center, its position, and its pivot point.

  3. A general sense for what the side effects are when you recenter a model using code like this:

export const recenterMesh = (mesh: Mesh | AbstractMesh, center?: Vector3, offset?: Vector3) => {
  center = center || mesh.getBoundingInfo().boundingBox.center
  const offsetX = offset ? offset.x : 0
  const offsetY = offset ? offset.y : 0
  const offsetZ = offset ? offset.z : 0

  const pos =  mesh.getVerticesData("position") || []

  for (let i = 0; i < pos.length / 3; ++i) {
    const x = pos[i * 3 + 0]
    const y = pos[i * 3 + 1]
    const z = pos[i * 3 + 2]

    pos[i * 3 + 0] = x - center.x + offsetX
    pos[i * 3 + 1] = y - center.y + offsetY
    pos[i * 3 + 2] = z - center.z + offsetZ
  }

  mesh.setVerticesData("position", pos)
  
  return center
}

And then ofc the things you already get from Codex are also definitely useful for fast prototyping. Imo I definitely see the case for two separate AI that help you with different things; it would be like Clippy and his pal Sticky Note.

In general babylon.js is a powerful and large framework. There’s just so many things to keep track of and remember, having a tool to quickly help you jump around from one domain such as animations to another, say thin instances in a quick and easy way would be awesome.

I have been playing with this plenty myself. It’s had some amazing insights. The only rough part is its knowledge is from 2021 and often the babylon code/approaches are way out of date now. Can’t wait until a version of this exists that has up to date information from the internet too… kinda scary also though once it can :slight_smile:

1 Like

Try Codex OpenAI API
Not sure if it’s more up to date. Probably.

While I love AI and think it is cool there have been so many scenarios on Stack Overflow where completely incorrect response to a SO question by ChatGPT has been copy and pasted as an answer that they had to ban usage of GPT generated answers on the site. Hopefully Babylon answers are better?

1 Like

As I’m trying out more questions I am learning that GPT Chat is definitely not perfect; it made up a few non-existent method calls in response to some of my babylon.js questions

1 Like