This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-06-16 00:36:49

AngstromDog
Scratcher
Registered: 2009-06-16
Posts: 6

I got 3d wireframe rendering, but how do i do faces?

So ive managed some legit wireframe rendering using points and relatively simple 3d rotation trig (keeping original points and storing rotated copies in separate lists to avoid the shape changing after enough rotation). It then stores in two lists the point connections that should be drawn and draws them (due to needing no repeats to avoid redraws mid frame it can only do around 40 point connections). Now I have the annoying part of how do i not draw the parts that shouldnt be visible. If I designate faces with the shape then i can test if each point is behind any of the faces and then not draw lines to it but how do I figure this out?

TLDR
given 3 non collinear points in 3d space they define a plaine. How can i figure out which side of that plane a 4th point is on?

Also, I would put a link to my project here but IDK how to do that... i dont do scratch much  tongue

Offline

 

#2 2012-06-16 02:01:12

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: I got 3d wireframe rendering, but how do i do faces?

AngstromDog wrote:

So ive managed some legit wireframe rendering using points and relatively simple 3d rotation trig (keeping original points and storing rotated copies in separate lists to avoid the shape changing after enough rotation). It then stores in two lists the point connections that should be drawn and draws them (due to needing no repeats to avoid redraws mid frame it can only do around 40 point connections). Now I have the annoying part of how do i not draw the parts that shouldnt be visible. If I designate faces with the shape then i can test if each point is behind any of the faces and then not draw lines to it but how do I figure this out?

TLDR
given 3 non collinear points in 3d space they define a plaine. How can i figure out which side of that plane a 4th point is on?

Also, I would put a link to my project here but IDK how to do that... i dont do scratch much  tongue

Well, if you're talking about a cube, you could always do it by looking at the rotation values of it...I believe this is a good example of that.  You can't check simply based on the projected points though...if you save all the coordinates (x, y, and z) then you could do something with the z and y, or z and x using linear equations between two points in the same plane.  If you want, I can try to go into a little more detail.


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#3 2012-06-16 02:23:38

AngstromDog
Scratcher
Registered: 2009-06-16
Posts: 6

Re: I got 3d wireframe rendering, but how do i do faces?

so basically given the faces, I can check if they are visually inside the face and then if they are check if its in front or behind using some kind of vector based calculations

Offline

 

Board footer