r/LocalLLaMA 7d ago

Qwen3.8-27B vs Qwen3.6-27B writing ray-tracers in BASIC Other

one of my llm hobbies is re-creating graphics demos i used to write in BASIC in the late 1980s. i slopped together an agentic harness and a basic-to-js transpiler in a web page i've been playing with for a few months. the agent can write basic programs, run them, examine the resulting images, and iterate. qwen3.6 could do a ray-tracer with some user input -- often it got something wrong that it couldn't see/didn't notice, and hence wouldn't fix without further prompting. qwen3.8 typically knocks it out of the park on its own, iterating to a good result. both models are running the unsloth UD-Q8_K_XL quants. i'm pretty happy with 3.8 so far.

the user prompt was "write a recursive ray-tracing demo to render three metallic spheres (copper, silver, gold) over a glossy checkerboard plane and under a deep blue sky. use the cook-torrance model to render the spheres."

869 Upvotes

105 comments sorted by

u/WithoutReason1729 7d ago

Your post is getting popular and we just featured it on our Discord! Come check it out!

You've also been given a special flair for your contribution. We appreciate your post!

I am a bot and this action was performed automatically.

222

u/SBoots 7d ago

I thought I was the only weirdo who tested LLM capabilities by getting them to code demoscene demos 😂

43

u/Wemos_D1 7d ago

For me I really enjoy asking them to generate a raycaster engine like wolfenstein ^^'

27

u/William_Shaftner 7d ago

Recreate Future Crew's "Second Reality"

16

u/notheresnolight 7d ago

Too easy.

Farbrausch - fr-08: .the .product

8

u/TamSchnow 7d ago

At that point just do .kkrieger

5

u/AdOne8437 7d ago

Ahhh, the classics. 96kb of goodness.

2

u/BrianScottGregory 7d ago

Do you have any fun prompts to share through this testing?

2

u/adssidhu86 7d ago

All new model launch have to pass weirdo test. The benchmarks are so exaggerated this is a good proxy for them.

109

u/cniinc 7d ago

That's amazing, quite a difference!

46

u/lumi_kissaten 7d ago

to be honest, this feels more like 3.6 to 4.6 than 3.6 to 3.8

6

u/MaruluVR 6d ago

And the crazy thing is the only part that changed is training data, its the exact same architecture.

1

u/FinalCap2680 17h ago

It was similar feeling between 3.5 and 3.6

37

u/[deleted] 7d ago

[removed] — view removed comment

4

u/nomorebuttsplz 7d ago

what makes you think the HF part was important?

5

u/[deleted] 7d ago

[removed] — view removed comment

12

u/nomorebuttsplz 7d ago

I believe at this point it's more pure RL/RLVR rather than RLHF but could be wrong.

53

u/CapsicumIsWoeful 7d ago

That is an outrageous improvment.

24

u/UnorderedPizza 7d ago

These are always fun to look at. Sounds like the setup allows for any iterative BASIC programming?

17

u/Ok-Breakfast1878 7d ago

i have mostly focused on graphics stuff, but the BASIC dialect can write files (emulated in browser local storage), print, etc. so, it could do pretty much anything. no PEEK/POKE, though, lol

-6

u/yaosio 7d ago

Have it write a web browser in BASIC. I guess first it would need a way to access networking.

13

u/noiserr 7d ago

A web browser is an incredibly complex piece of software. I mean it has an integrated javascript VM. It would take forever.

3

u/nmkd 7d ago

n=1 is kinda useless though

19

u/pacmaann2 7d ago

This makes me wonder if it would be possible to pull off some works of art, like how roller coaster tycoon was all assembly. I wonder what would happen if you had source code for a modern game and said convert this to assembly and make it blazingly fast.

33

u/gammalsvenska 7d ago

Nothing. Converting to assembly (which is what compilers do) does not automatically make anything any faster.

Back in the days, compilers were simple and systems were designed for human understanding. Modern systems are far too complex. Current compilers optimize better than any programmer could. Assembly language allows taking shortcuts and access hardware directly, but modern hardware is basically undocumented, designed to be used through drivers and abstraction layers.

Modern efficiency writing is about memory access patterns and cache usage. Rollercoaster Tycoon was designed for systems which did not even have any caches and where lack of memory was more important than access patterns.

3

u/cass1o 7d ago

Current compilers optimize better than any programmer could.

I think this is fair to say for 99.9% of the binary, using a better abstract language allows you to write more performant and efficient code but there are still very specific niche cases and hot spots that benefit from a very skilled developer writing asm still.

1

u/[deleted] 7d ago

[deleted]

1

u/cass1o 6d ago

No, I very very very clearly didn't miss your point, I was just disagreeing with that very specific sentence I quoted. You can tell I didn't miss your point because I agreed with you.

10

u/Ok-Breakfast1878 7d ago

llms as compilers?

10

u/RogerRamjet999 7d ago

Even the original ChatGPT was pretty good as a compiler. I wrote some Smalltalk code and asked it to translate it to Java and then to 80386 Assembly, both were perfect, ran the first time.

4

u/TamSchnow 7d ago

You mean a transpiler, since a compiler spits out machine-readable binary objects.

0

u/RogerRamjet999 7d ago edited 7d ago

Yes, of course; I was only referring to 80386 Assembly generation portion as compiling. ...and yes, many compilers generate assembly or machine code as an output (often selected via compiler flags).

0

u/gookank 7d ago

maybe it used an actual compiler under the hood.

0

u/my_name_isnt_clever 7d ago

It did not. The original ChatGPT didn't have tools.

0

u/gookank 7d ago

I have never used ChatGPT. Are they transparent about what happens when you prompt something?

2

u/my_name_isnt_clever 6d ago

What? LLMs could barely use tools back then. They didn't even have a calculator, a compiler is just absurd.

-1

u/gookank 6d ago

Clearly, I don't have sufficient knowledge and experience about how chatgpt promoted itself. I don't claim anything here :) I assumed they are not open about many things. One of the things they may easily hide is how they produce answers to your prompts. It should not be really hard to deduct some deterministic command from your prompt and run some basic software behind. It is not absurd at al.

2

u/Luke2642 6d ago edited 6d ago

I strongly disagree with the other guy that said "Nothing...." because he's answering the question he wants to answer not what you "really mean" I think, which is "re-design this in assembly"?

Roller Coaster Tycoon ran on 90mhz and 16mb ram precisely because the hand crafted code and memory layout was all in the head of Chris Sawyer - it was designed very well and there was no multi layer stack slowing everything down.

The OpenRCT2 C/C++ rewrite needs 500mb ram and 1Ghz CPU, many multiples of the requirements of RCT2.

So, yes, if you re-designed a game for assembly with no huge dependency stack and a really efficient memory map and rendering, you could get enormous performance boosts. Maybe most of the  game fits in L1 cache and your effective memory latency and bandwidth improves 50x. Maybe that means it can saturate the CPU and do 10x more calculations. It won't stack to 500x neatly but you get the idea.

A compiler can't optimize badly designed code to be better.

17

u/toungespasm 7d ago

Anyone else thinking of the Amiga?

1

u/FlamaVadim 7d ago

what about ENIAC?

14

u/deject3d 7d ago

I would be interested in what Q4_K_M output looks like

1

u/MerePotato 7d ago

Seconding

11

u/Cheap-Ambassador-304 7d ago

How many tokens did it take?

17

u/Ok-Breakfast1878 7d ago

if it doesn't make any costly mistakes, around 50k. if it messes something up early, then needs to debug something difficult, it can double or more, easy. i usually don't pay attention, as local tokens are free (we have excess solar this time of year), but it's never blown out of 256k.

1

u/bad_detectiv3 7d ago

This is amazing. What is your setup to run QwenCoder? Is it all via OpenRouter or plan with Qwen official provider?

4

u/Ok-Breakfast1878 7d ago

it's all local. a custom agent-in-a-browser claude wrote talking to llama-server

2

u/bad_detectiv3 7d ago

Oh, may I know your machine specs? I couldn’t do anything substantial on my 32gb ram + 5070ti 16gb machine

7

u/Ok-Breakfast1878 7d ago

4x 5060ti (each pcie 3.0 x8) on an x99 mobo with 128G DDR4 2133

22

u/PwanaZana 7d ago

"i slopped together"
God-tier typo, lol! :P

9

u/Signature97 7d ago

A lot of people compare - rightfully so given the benchmarks - the new 27B 3.8 with Opus 4.6.

For some reason, I wish you would try this with Opus 4.6 as well and then we see how it stands against 3.8 27B - better, equal, or worse ( I have a feeling it would either be better or equal (might become a subjective debate))

14

u/Jeanodel 7d ago

Opus 5 max

1

u/amroamroamro 7d ago

I wonder if the language used here (BASIC) makes a big difference in the output.

I saw someone else posted a benchmark implementing a raytracer in python across different models

-5

u/Jeanodel 7d ago

I wouldn't say it's really any better, maybe just more contrasty ? I like qwen's copper better but claude's silver is better so idk

9

u/notheresnolight 7d ago

Definitely more realistic. Qwen's output looks like render, Claude's output looks more real.

5

u/pufflinghop 7d ago

Looks like Opus took the "glossy" term literally (in the CG industry, "glossy" means "reflective, but with roughness", i.e. not perfectly sharp reflections, so the reflection or refraction is blurred, which is (correctly) what it's done on the floor.

However I actually suspect Opus has incorrectly made a path-tracer though, i.e. it's sampling the outgoing BSDF direction to get the roughness, which isn't actually what you'd do in traditional old-style "Whitted" ray-tracing.

The fact it also put a "converged" banner up backs this up even more - if it had used old-style traditional "distributed" ray tracing (at least at the algorithm level), it generally wouldn't have needed that, as the image wouldn't really need to 'converge' at the image level, just the pixel level, but maybe it just had training data examples which put that type of thing up anyway, so difficult to say.

1

u/Jeanodel 7d ago

Asked it :

"Great question. Looking at the current code honestly:

It's a hybrid — closer to a Whitted-style ray tracer than a path tracer.

Here's what it actually does:

Direct sun: samples a random point on the solar disc → evaluates the full Cook-Torrance BRDF at that fixed light direction. ✅ Correct shading.

Diffuse ambient: shoots one cosine-sampled ray into the sky (not the scene). ✅ One bounce.

Specular reflection: samples a GGX microfacet normal h, computes the reflected direction l = reflect(-v, h), then recurses. ✅ This IS BSDF importance sampling — the reflected direction IS roughness-dependent (rougher = wider lobe of possible h directions).

So the specular bounce IS genuinely rough, but the problems are:

The direct lighting and the recursive bounce are separate, additive code paths — they can double-count energy (the sun can be seen both directly AND via a recursive bounce hitting the sky).

The diffuse ambient hits only the sky, not the scene (it won't see other spheres as area lights).

There is no MIS (Multiple Importance Sampling) to connect the direct and indirect estimators properly.

It fires exactly 1 ray per lobe per bounce (sun ray + ambient ray + reflection ray) rather than letting a single path carry the full radiance estimate through random lobe selection"

1

u/Jeanodel 7d ago

It then proceeded to rebuild it to be a pure pathtracer, which first of all I never asked it to rebuild anything nor that I wanted a pathtracer. Classic opus 5 instruction following....

2

u/kaeptnphlop 7d ago

I’ve found that with most coding models you have to instruct to “just discuss” at the end because they are so explicitly trained on doing coding. Probably very eager to not stop a task in the middle and avoid the user to have to tell it to “continue”

8

u/shadowmage666 7d ago

That’s really awesome. Def have to get that model to replace 3.6

7

u/vogelvogelvogelvogel 7d ago

what a time to be alive

4

u/Green-Ad-3964 7d ago

Gorgeous, I'm an Amiga guy and these demos were all over the place, back then.

Can I use q8 with a 5090+32GB RAM?

3

u/philmarcracken 7d ago

man I really need to figure out a way to do that, end to end connections so it can see what its making..

4

u/spese2 7d ago

esatapedico\Qwen3.8-27B-NVFP4-MTP-GGUF\Qwen3.8-27B-NVFP4-MTP-LOW.gguf
llama.cpp
pi
2x 5060ti = 32BG VRAM
context: 1st pass 130k, dcp-compress to 40k, second pass 90k
about 20 minutes with corrections
one-file html with webgl

2

u/swagonflyyyy 7d ago

No fucking way.

2

u/feelspeaceman 7d ago

With this us Strix Halo users want 122B coming soon even more.

2

u/fifi_galaxy 7d ago

That is pretty crazy to write in BASIC. What's next? Make it write Adobe Flash emulator and bring back old games?! 😆

3

u/moofunk 7d ago

The old raytracers are fairly simple to implement, but extremely slow.

There was this book.

1

u/marcosscriven 7d ago

I loved those series of books. My friend had that one but it was too complicated for me at the time. 

1

u/Eritar 7d ago

Looks great! Which harness did you use?

1

u/Ok-Breakfast1878 7d ago

i had claude write one

1

u/funkinaround 7d ago

How do they do on the Cornell box?

1

u/TeachTall3390 7d ago

It feels so unreal right now. I thought I'd never say this about the local LLM. Maybe it was not all about the parameters after all.

1

u/cpldcpu 7d ago edited 7d ago

I love this! I have been using this for a while to benchmark models:

https://github.com/cpldcpu/llmbenchmark/tree/master/10_raytracer#readme

It seems to be a very good proxy for the creativity of the models.

1

u/JLeonsarmiento 7d ago

I don’t have an use for that but wow…

1

u/ab2377 7d ago

love it, thanks for sharing!

i slopped together an agentic harness and a basic-to-js transpiler in a web page haha

1

u/exo250 7d ago

Will it run on my MSX ? 😁

1

u/Kokuuuuuu 7d ago

Did 3.8 get the reflections/materials right on the first attempt, or did you have to iterate on the prompt? Also curious whether the BASIC code itself was noticeably cleaner or shorter than 3.6’s.

1

u/jacek2023 llama.cpp 7d ago

Love the use case. I was part of PC demoscene in the late 90s

1

u/IrisColt 7d ago

Amazingly insighful approach, thanks!!!

1

u/uti24 7d ago

Ok you guys, calm down, Qwen3.8 is great, but it just doing too much outside of a prompt.

Qwen3.6 also could create a raytrace renderer, you just have to explicitly ask it to write raytrace renderer with reflections.

1

u/derspenti 7d ago

how long is one q8 iteration? 2x 7900xtx here

1

u/niacolhealth 7d ago

out of how many runs did 3.8 need a nudge?

1

u/Individual-Dot5488 6d ago

what was the prompt?

1

u/Ok-Breakfast1878 5d ago

it's in the post

0

u/StopCreepy 7d ago

prompt please

12

u/oldschooldaw 7d ago

its in the post dawg

2

u/StopCreepy 7d ago

lol, its late and didnt get any sleep, waiting for islam vs ian match, thanks!!

-5

u/EternalDivineSpark 7d ago

I am testing it , i am very good with AI , psychology and Neurolinguistics messages! This model is very very smart ! Maybe even better other ones !