-
Directx9 problem - drawing in wow's 3D world
* PROBLEM FIXED *
* PROBLEM FIXED *
So instead of just esp, i wanted to draw 3D objects in the world. And i can still do that, i can code a function that will display some geometry, but the problem is that i dont want this geometry to be on top of everything. I don't want this geometry to be vissible through walls etc. Here is a video of my problem.
Two problems.
1. Object is vissible through walls. Im not just drawing lines and fill them with color, this triangle is drawn in 3D space. In that case the Z buffer should have been taken into account since it is enabled. But as you can see it is displayed on top of my character even tho the character is in front of the triangle, and also the triangle is buried in the ground, but still covers the terrain.
2. Object is vissible only when i open the chat text field to type. Maybe that is related to some shader being enabled/disabled every half a second.
This is my drawing endscene code so far...
C++
PHP Code:
// My vertex class that i use to store the 3 vertices of the triangle
struct Vertex
{
float x, y, z; // Position in 3D space
DWORD color; // Vertex color
};
// My rendering code
// 1 - Here are the triangle vertices
Vertex vertices[] = {
{ 0.0f, 2.5f, 0.0f, D3DCOLOR_ARGB(255, 255, 0, 0) }, // Top
{ 2.5f, -2.5f, 0.0f, D3DCOLOR_ARGB(255, 0, 255, 0) }, // Bottom Right
{ -2.5f, -2.5f, 0.0f, D3DCOLOR_ARGB(255, 0, 0, 255) } // Bottom Left
};
// 2 - Creating a vertex buffer
LPDIRECT3DVERTEXBUFFER9 pVB = NULL;
pDevice->CreateVertexBuffer(3 * sizeof(Vertex), 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &pVB, NULL);
// 3 - Putting the vertices in the vertex buffer
VOID* pVertices;
pVB->Lock(0, sizeof(vertices), (void**)&pVertices, 0);
memcpy(pVertices, vertices, sizeof(vertices));
pVB->Unlock();
// 4 - Clearing any shaders before i draw the triangle so i can use the default pipeline rendering
(Maybe here is where my problem comes from?)
pDevice->SetPixelShader(nullptr);
pDevice->SetVertexShader(nullptr);
// 5 - Set the render states
pDevice->SetFVF(D3DFVF_CUSTOMVERTEX);
pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
// 6 - Setting my stream source
pDevice->SetStreamSource(0, pVB, 0, sizeof(Vertex));
// 7 - And finally drawing my triangle....
pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
So i simply described my drawing process in 7 simple steps, If you have knowledge and managed to achieve what i'm trying to do, please at least tell me at which step i fuck up. I created 3D engine once and as far as my understanding goes if the Z buffer is enabled then the game should take care of which object should be vissible or not in the 3D world. Unless it has something to do with the shaders? And yes i tried to manually enable the Zbuffer and so on.. nothing worked so far.
EDIT: I never dealth with shaders in my life, and when i created my 3D engine in the past, i used the default pipeline. If you gonna advice me to try wow's own shaders well.. i have no idea how to retrieve them, i have no clue how to work with them, and i have no idea if this is actually what causes the issue.
Last edited by dlablo; 01-28-2025 at 05:39 PM.
-
Post Thanks / Like - 1 Thanks
ttonline315 (1 members gave Thanks to dlablo for this useful post)
-
Member
have you tried giving your codebase to an Ai IDE such as cursor and ask it questions?
-
Originally Posted by
Delta3
have you tried giving your codebase to an Ai IDE such as cursor and ask it questions?
Gosh this is giving me TEARS. I never thought such tool actually existed... i endlessly hate AI. Many years ago when i started learning how to code, there were just stackoverflow and bunch of other forums that i was part of. I was gathering knowledge over the years, and for a piece of code i can't memorize, i just store it in projects for later use. And in the end when you finally achieve the desired functionality, you SATISFIED, and kinda happy ...
But now? Asking some AI for instant knowledge kills the fun of research, AI doing the job for you kills the satisfaction. It also kills forums like this, because instead people coming to ask questions here and communicate with us, they just talk to some brainless bot. - People become more anti-social.
Around 12 years ago i was doing amateur 3D modeling, and it was such a fun process to learn. One week ago i found a randomly found youtube video of a tool that generates 3D models for you. AI totally ruins the experience, no satisfaction, no fun.
Another way to describe this is... why would you feel good if you have lamborghini? It's a piece of metal with 4 wheels, just expensive and hard to get. You can still get a piece of metal with 4 wheels but less expensive one, one that you can afford. What makes you feel good is not actually YOU owning the lamborghini, it's the hard work you put to get it. If everyone had a lamborghini and it was so easy to get - then it has no value, and it wouldn't feel special to have it.
Same thing applies here with AI. Knowledge in coding is something that is gathered over they years of hard work. And if through AI someone can do the same as you, then that skill loses it's value. What im doing right now, i do it for fun only. There will be no special use for this world drawing in WoW, or who knows maybe i will turn it into hack and sell it who knows. But i mostly do it for fun. And if chatbots or AI editors will do the job for me, then for me there is no fun, no point of doing it.
In the future Skids will become hackers thanks to AI, hackers that can't even do basic programming.
Last edited by dlablo; 01-27-2025 at 11:01 AM.
-
Member
i completely agree with you. although its been invaluable to assisting me in learning coding quicker. a man is only as good as his tools and if it reduces the time for me to learn something complex from days to hours ill take it.
can fire up a code base in seconds . and focus more on fine tuning and testing.
nevertheless i follow you on multiple platforms . goodluck to you. and wish i could offer more assistance . cool project. i actually had an idea like this pretty recently. havent got to that part yet. currently reversing the 3.3.5a client and creating a project similar to PQR . starting with the basics.
-
-
Allright i give up. Here is what i've done so far

I stole all pixel / vertex shaders from wow and applied them to the triangle
i stole all materials and textures and applied them to my triangle
i hooked the drawprimitive function to draw my triangle in certain position before the game continues to draw it's stuff (that's in between the begin scene and endscene - perfect time to draw my model)
nothing worked so far, and no motivation to continue.
-
Active Member
Originally Posted by
dlablo
Gosh this is giving me TEARS. I never thought such tool actually existed... i endlessly hate AI. Many years ago when i started learning how to code, there were just stackoverflow and bunch of other forums that i was part of. I was gathering knowledge over the years, and for a piece of code i can't memorize, i just store it in projects for later use. And in the end when you finally achieve the desired functionality, you SATISFIED, and kinda happy ...
But now? Asking some AI for instant knowledge kills the fun of research, AI doing the job for you kills the satisfaction. It also kills forums like this, because instead people coming to ask questions here and communicate with us, they just talk to some brainless bot. - People become more anti-social.
Around 12 years ago i was doing amateur 3D modeling, and it was such a fun process to learn. One week ago i found a randomly found youtube video of a tool that generates 3D models for you. AI totally ruins the experience, no satisfaction, no fun.
Another way to describe this is... why would you feel good if you have lamborghini? It's a piece of metal with 4 wheels, just expensive and hard to get. You can still get a piece of metal with 4 wheels but less expensive one, one that you can afford. What makes you feel good is not actually YOU owning the lamborghini, it's the hard work you put to get it. If everyone had a lamborghini and it was so easy to get - then it has no value, and it wouldn't feel special to have it.
Same thing applies here with AI. Knowledge in coding is something that is gathered over they years of hard work. And if through AI someone can do the same as you, then that skill loses it's value. What im doing right now, i do it for fun only. There will be no special use for this world drawing in WoW, or who knows maybe i will turn it into hack and sell it who knows. But i mostly do it for fun. And if chatbots or AI editors will do the job for me, then for me there is no fun, no point of doing it.
In the future Skids will become hackers thanks to AI, hackers that can't even do basic programming.
Sorry for going off-topic, but I had to mention this.
You use AI to save your most valuable resource—time.
To use AI effectively, you need to know significantly more, so you can instantly determine whether the generated code works or not.
You use an IDE—by your logic, you should be using Notepad and deliberately avoiding debuggers.
Following the same logic, you should cook food over a fire and write letters by hand, sending them via traditional mail—but I highly doubt that's how you live.
NO—AI is a tool that eliminates the time spent on typing and allows you to focus on the most important thing—the logic of your application.
Moreover, AI can give very unpredictable answers that allow you to look at the problem from a different perspective, which is extremely valuable.
That’s my opinion.
-
Post Thanks / Like - 1 Thanks
Delta3 (1 members gave Thanks to Tirthankara for this useful post)
-
If you want to help, then you are welcome to do so. I came in this forum to communicate with people, not to see posts advicing me to use AI. If i wanted to ask AI, then i would have asked the AI. If i have to answer to your post then i would have to post kinda the same post as my above one. With the only exception about you telling me to use AI to save my time. From productivity prespective: I am programmer and i need to do my job fast, and i am programmer for the sake of surviving on this world - then yes, your post would make sense. And now i need to ask you to double read my post, so you can understand that what im doing is not for productivity but for fun. I want to solve puzzle, and you are telling me to get a solved puzzle.. does that makes sense to you?
The reason forums like this one are dying is people asking the AI instead coming here to talk to us. And on top of that the only 2 people who reply here are not people who are trying to give me advice on a solution or giving me solution, they tell me to talk to AI. Such people contribute to the problem. Sadly, even if this becomes banable, it won't save the forum from dying. Besides, I am mr. nobody, nothing i can do to solve the AI problem. Not even a moderator or administrator to change the rules.
-
Problem fixed.
The problems were several actually.
1. WoW uses different states when rendering different things. And usually when the endscene is called, i must reset all states so i can render my model.
I reset the state completely with those lines
PHP Code:
pDevice->SetVertexShader(NULL);
pDevice->SetPixelShader(NULL);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
pDevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDevice->SetRenderState(D3DRS_LIGHTING, TRUE);
pDevice->SetTexture(0, NULL);
// 3 of those i was missing, credit to Dysphorie from this topic
// https://www.ownedcore.com/forums/world-of-warcraft/world-of-warcraft-bots-programs/wow-memory-editing/328682-rendering-slimdx.html
// This fixed my flickering triangle
By default i enabled the Zbuffer with those lines
PHP Code:
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); // Enable Z-buffer
pDevice->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); // Enable Z-write
But i missed this very important line
PHP Code:
pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
This line defines at which depth the model should be drawn. For example you might want to draw the model in FRONT of your character while the model is actually BEHIND your character. My triangle was on top of everything because i only missed that single line. This D3DRS_ZFUNC has multiple options. And D3DCMP_LESSEQUAL is the way to go.
So i was finally able to see my triangle, with no flashes, and my character can actually go through it !!! But something was still wrong .. i had the problem this guy had
https://www.ownedcore.com/forums/wor...g-madness.html (WoD Depth Buffer/3D clipping madness)
And then i found about the viewport, I need to set the viewport to the following settings. Tho the guy in the post did not specify the minZ of the viewport, i was adjusting it in real time until i found the correct value. And volla! It's 0.74f.
PHP Code:
D3DVIEWPORT9 viewport;
pDevice->GetViewport(&viewport);
viewport.X = 0;
viewport.Y = 0;
viewport.Height = "YOUR WOW CLIENT AREA HEIGHT";
viewport.Width ="YOUR WOW CLIENT AREA WIDTH";
viewport.MinZ = 0.74f; // Near clip depth
viewport.MaxZ = 0.94f; // Far clip depth
pDevice->SetViewport(&viewport);
And yeah that's about it. If anyone in future has such problem just read my post 8=) As you can see gentleman we can do it without AI.
Last edited by dlablo; 01-28-2025 at 05:49 PM.
-
Post Thanks / Like - 1 Thanks
Delta3 (1 members gave Thanks to dlablo for this useful post)
-
Active Member
I have read your post three times, and all I see is a contradiction in your own reasoning. If you truly enjoy solving puzzles, then why are you asking for help here?
It seems like you have a selective approach: asking for help from AI is 'shameful' and 'kills programming,' but asking people for help is perfectly fine?
Apologies if this comes across as harsh, but perhaps it's worth taking a moment to reflect—do you genuinely enjoy solving puzzles on your own, or does it simply bother you that a program might be smarter than you?
You came here to ask for advice – and someone advised you to ask AI. The advice was given by a person. If that bothers you so much, maybe specify what kind of advice you actually want to hear 
Either way, I wish you the best. Take care.
Last edited by Tirthankara; 01-28-2025 at 11:34 PM.
-
"If you truly enjoy solving puzzles, then why are you asking for help here?"
- Seeking / asking people who have completed the puzzle before you - for me is part of the journey.
"asking for help from AI is 'shameful' and 'kills programming,' "
- It kills the fun of programming, It kills the fun of education and also the satisfaction you get when you complete something hard. And it's not shameful, i just don't feel like a good programmer / hacker if i use AI. How can i claim that i made certain program if i used AI to help me code it? In that case i am just the one who put the blocks of code together and call it a day. And tho sometimes it still requires me to understand the code, that's not always the case.
"does it simply bother you that a program might be smarter than you?"
- The program is not smarter than me, as there are many things that i can do and this program can't. The same way there are many things that i can't do and the program can. There are many reasons i hate AI, programming is just one of them. To put it simple - machines are meant to replace humans. Thousand years ago, we worked month for month, gathering vegetables on the field BY HAND blah blah. Nowdays the process is automated, it's done by machines, but we still live month for month? It's just that there are fewer job positions. We are talkingabout machines, AI is machine too. Soon, more things will be automated not just collecting vegetables of the field. Graphic designers will lose their jobs because soon AI will replace them. Teachers might also lose their jobs, AI will replace them. So do you see my point? You might think that in the future AI will do the job for the humans, and humans will relax near the beach. But the realitiy is that only the rich will get richer, and the poor will die. Because more automation - less jobs - less people. People who have the abililty to grant someone job will prefer the machine instead of the human. I chose to go to this forum here and ask the people for help, not the machine.
I am not smart at all, i am nothing if it's not the people who tought me everything i know today. I talk about all people who made youtube tutorials, wrote on forums like this one, wrote blogs. Those people were educated by books back in the days, when there were no youtube tutorials. They created the first youtube tutorials. They had the whole knowledge, but we needed just a small tutorial about how to do something simple like making esp hack without having to know the entire programming language. And those people provided it. AI is just like cheat code in real life.. you skip all the hard work and you go directly rip the reward. Where is the fun and satisfaction in that?
-
Active Member
Everyone has their own perspective – I’m not going to argue with you anymore (I believe that AI is the best thing I've seen in years – nothing else saves time as effectively.). Unfortunately, you missed the main point – you asked for advice, and someone took the time to read your post and respond.
They SPENT THEIR TIME to give you an answer based on what they know and understand. It doesn’t matter whether it was perfect – they PAID ATTENTION to you!
And instead of gratitude, they got a whole paragraph of complaining – "Why are you suggesting AI? This is useless. If I wanted to ask AI, I would have done so myself…"
Put yourself in their shoes – would they want to help you again? Would anyone want to, knowing they might get hit with the same frustration if their answer doesn’t satisfy you?
It’s just common sense…
Last edited by Tirthankara; 01-30-2025 at 01:03 AM.
-
Post Thanks / Like - 1 Thanks
pickleback (1 members gave Thanks to Tirthankara for this useful post)