[DiscordArchive] This is for project 3D point on 2D screen space ?
[DiscordArchive] This is for project 3D point on 2D screen space ?
Archived author: Intemporel • Posted: 2022-11-13T20:14:31.172000+00:00
Original source
This is for project 3D point on 2D screen space ?
Archived author: Kaev • Posted: 2022-11-13T20:14:52.228000+00:00
Original source
clicking on "local windows debugger" to build + debug after build
Archived author: Pursche • Posted: 2022-11-13T20:15:19.310000+00:00
Original source
<@288393324744671232> Yes, like I suggested earlier today :p
Archived author: Pursche • Posted: 2022-11-13T20:15:45.409000+00:00
Original source
<@138006906915651585> Correct, the worldspace position of the model, as a vec3
Archived author: Kaev • Posted: 2022-11-13T20:15:48.266000+00:00
Original source
glm::mat4 VPmatrix = projection * view;
glm::vec4 screenPos = glm::vec4(instance->pos, 1.0f) * VPmatrix;
got that
Archived author: Pursche • Posted: 2022-11-13T20:16:15.525000+00:00
Original source
Give that a try, lets see what it gives us.
Archived author: Kaev • Posted: 2022-11-13T20:18:55.290000+00:00
Original source
```
52807 - (World.cpp:3010): [Error] x: 30356.2 z: 31807 y: 9.53674e-07
52807 - (World.cpp:3011): [Error] screen pos x: 31672.1 z: 32217.2 y: -13281.2
```
Archived author: Kaev • Posted: 2022-11-13T20:20:18.102000+00:00
Original source
I hope nobody will ever ask me what i've done there afterwards
Archived author: Pursche • Posted: 2022-11-13T20:21:33.062000+00:00
Original source
Not quite what we're after. Lets divide it by the perspective, screenPos.xyz /= screenPos.w; (this can't be done like this in C++, but it's the result we're after.
Archived author: Pursche • Posted: 2022-11-13T20:22:11.039000+00:00
Original source
Individually divide the xyz components by w, and then print it again.