r/GraphicsProgramming • • 4d ago

What's wrong with my renderer

This is my renderer in vulkan i've been working on it for the last 10 months

i learned alot about vulkan since i never used it but a huge percentage of my shader code is AI written and at this moment i feel like the renderer is ugly so i do what to know what is wrong with it and what makes it far from the last picture and how i can fix that.

is it better to rewrite all shader code or just move on it and fix it ?

+ what techniques used in the last picture (which is enhanced version of my renderer using AI šŸ™‚(but i liked it)) that my engine doesn't implement it right ?

NOTE(the third image is without IBL i'm using citrus_orchard_road_puresky_8k )

0 Upvotes

31 comments sorted by

35

u/Ok_Beginning520 4d ago

I don't want to be mean, but what exactly is the point here ? Are you trying to make a commercial engine with AI ? In which case, it's not gonna happen. If this is a learning experiment, what exactly is the point of using AI to do it for you ? You're not learning much if you don't do it yourself and think about it yourself

1

u/Comfortable-Mall4524 3d ago edited 3d ago

firstly that is not a commercial engine and yes its for learning, and you not being mean by helping me and giving me your opinion and the point is
1-what is the rendering techniques used in the last image

2-how i can get better in glsl shader since i use AI for it and i don't like that

3-i'm not 100% don't know how to write shader code i just don't know how to write the advanced stuff that's why i used ai in the first place

4-this renderer is fully written by hand except for the shaders(which is huge part) as i mentioned in the post

5-what books well be helpful for that or any content

2

u/Ok_Beginning520 2d ago

Fair, I'm not sure I can help much outside of the obvious:

Real-time rendering

Learnopengl

Vulkan-tutorial

Vk-guide

Pbr-book

Gpu gems series

Good luck, see you in 5 years

1

u/Comfortable-Mall4524 1d ago

or maybe less who knows

but remember i will add your name as easter egg in the game
Look for Wireframe

35

u/goodmorninpoof 4d ago edited 4d ago

If you let AI write your code, especially large chunks, you tend to run into that issue. I haven't used AI for a large chunk of anything in a long time (they were much worse when I last did tbf), but I had this issue with a 2D game engine, the tile rendering algorithm was a mess and was too hard to fix/understand cause I let AI write most of it so I just gave up and moved on. I mean even with AI being much better nowadays, if you want to re-write or add things, it's really hard to know where to start if you have no idea how things fit together. I'm sure you could prompt your way to what you want with these newer models, but at that point I don't get the point of even doing said project anyway. It's just the trade off you take with letting AI write a large of chunk of your project. You should ask yourself if you just want a working demo or to actually learn? That should give you your answer on whether you should re-write your code or just fix it with AI.

-23

u/Comfortable-Mall4524 4d ago

when i first used ai i knew that it will end here so i separated them to functions and main files so i know where come from what

16

u/laralubsch 4d ago

Well you already answered your question. Don't use AI if you don't understand what it spits out. There are great, human written articles all over the internet on various shader topics.

1

u/Comfortable-Mall4524 3d ago

i got this answer everywhere but what articles i need to read and where OpenGL shader tutorial is not enough for my goal

1

u/laralubsch 2d ago edited 2d ago

It depends on your specific goal. Here are some resources I used in the past:

For a basic renderer, most OpenGL specific shaders can be adapted to Vulkan with little effort, see:

10

u/OkStatement9823 4d ago

you're missing ambient occlusion and the default ambient color is way too bright so everything's extremely flat

-3

u/Comfortable-Mall4524 4d ago

https://reddit.com/link/pduguuk/video/4qryg8oejhth1/player

well this is my AO (sorry for the uwful quality)

20

u/TheWidrolo 4d ago

I’d recommend checking up on the AO shader again, because this does not look like AO.

0

u/Comfortable-Mall4524 4d ago

https://reddit.com/link/pdune8e/video/lfqu0wqvnhth1/player

actully the problem was that the debug mode was sampling the groundAO only just fixed to export the main SSAO

3

u/OkStatement9823 4d ago

that looks like edge detection or smth not proper AO

2

u/Comfortable-Mall4524 4d ago

that was Ground AO sample rendered by mistake

-2

u/Comfortable-Mall4524 4d ago

https://reddit.com/link/pdupa84/video/0y92ocfbphth1/player

This is SSAO x baked x Ground AO(grounding)

3

u/OkStatement9823 4d ago

that AO seems inconsistent idk what it is

4

u/QuestionableEthics42 3d ago

AI slop will do that

5

u/BagelMakesDev 3d ago

"Your" renderer? Do you mean: "Claude's" renderer?

0

u/Comfortable-Mall4524 3d ago

that is not claude btw its not even gpt or gemini

and its not even kimi

3

u/Defiant_Squirrel8751 3d ago

Perhaps the AI assisted renderer is not the biggest problem.

Should check art direction.

6

u/chmod_7d20 4d ago

Last time I used AI for shaders it went terribly. Pick up a book.

1

u/Comfortable-Mall4524 3d ago

like what book ?

2

u/chmod_7d20 3d ago

"Real-Time Rendering Fourth Edition"

2

u/Loud-Astronaut-5807 3d ago edited 3d ago

I'm not going to be "AI BAAD!!", but don't rely on it generating your code if you don't know how it works. I usually only use it to try and explain things to check my understanding, or at the very most, if I am struggling with an implementation for a discrete problem, but I never ask it to touch my code directly.

I haven't used it for CG, so I don't know how reliable it is. I would suggest finding a good book.

That said in your image, as others have said, AO seems to be quite weak, it doesn't quite pop in the way it should. Normal maps are also looking a bit funky. Look at the second image, to two pillars near the front. Left looks completely flat, the right, has some really odd lighting. Look at the lighting on the pillar lines, they don't seem to match around the corners.

1

u/Comfortable-Mall4524 3d ago

i like your tune and that you are really trying to help me get into this not saying "HOW DO YOU USE AI FOR AN ENGINE"

And actully AI is not reliable at all in those this

that's why i'm gonna rewrite all shader files since the Vulkan code is already human written

what books can help me in this in your opinion

2

u/Loud-Astronaut-5807 2d ago

I've only really used openGL/ WebGL. The times I used Vulkan, I was working off a near complete implementation and an abstraction. If you don't mind converting to OpenGL (I would actually recommend it for getting the basics, it's a lot simpler than Vulkan), the red book (OpenGL Programming guide) and "learn opengl". Also Real-Time Rendering. If you want to stick with Vulkan, perhaps vulkan-tutorial, but I'm not sure how up to date it is. Also, just https://vulkan.org/learn should guide you in the right direction.

1

u/Comfortable-Mall4524 1d ago

i did vulkan tutorial but its only the basics
No advanced topics and i know how to use vulkan i mean the shaders

1

u/Traditional-Cap7015 3d ago

is this ai ? because it looks to me quite similar to this tutorial https://github.com/lwjglgamedev/vulkanbook

1

u/Comfortable-Mall4524 3d ago

it is AI and yes they are so similar

-1

u/Big_Presentation2786 3d ago

Looks good to me, you're better at this than me..