Logo by dainbramage - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. April 25, 2024, 07:32:09 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: 3D to 2D Orthographic projection  (Read 4628 times)
Description: with negative values of Z
0 Members and 1 Guest are viewing this topic.
ker2x
Fractal Molossus
**
Posts: 795


WWW
« on: July 28, 2011, 04:15:09 PM »

hello !

I'm reading : http://en.wikipedia.org/wiki/3D_projection
and produced this code :
Code:
u = x * 10.0 / z
v = y * 10.0 / z

However, it seems to be totally flawed with negative values of Z (and obviously when Z = 0).

Any idea/implementation to do an orthographic projection that works please ? smiley
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
marius
Fractal Lover
**
Posts: 206


« Reply #1 on: July 28, 2011, 11:48:49 PM »

hello !

I'm reading : http://en.wikipedia.org/wiki/3D_projection
and produced this code :
Code:
u = x * 10.0 / z
v = y * 10.0 / z

However, it seems to be totally flawed with negative values of Z (and obviously when Z = 0).

Any idea/implementation to do an orthographic projection that works please ? smiley

Not sure I follow. Clearly, Z <= 0 means those bits are behind the viewer, hence not visible? Look up view frustum. Generally ones defines a near and a far pane and only cares about bits inside the frustum. Larger than 180 degree fields of view get weird, of course.

Why would you want ortho anyways? Perspective is quite a bit more visually appealing.
Logged
A Noniem
Alien
***
Posts: 38


« Reply #2 on: July 29, 2011, 11:39:42 AM »

If z < 0, z is behind the camera, so there is no need to draw it (you don't have eyes in your head do you?)
if z = 0, z is inside the camera, so things get a bit tricky there as well.
I'm not sure if you're familiar with the term view frustrum, but you might wanna read http://en.wikipedia.org/wiki/Viewing_frustum

Normally a view frustrum is used in perspective projections, but you can use a near and far plane just as well in an orthographic projections. This means that check whether z in a certain range. near plane <= z <= far plane. Ofcourse the near plane has to be greater than 0 and the far plane is normally not infinite.

And in response to marius, projective projections are indeed nicer, it does however take a lot more knowledge and a lot of matrix stuff in order to do so, so I wouldn't recommend using it if he doesn't even have an orthographic projection.
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #3 on: July 29, 2011, 12:54:15 PM »

thank you both of you.
i was to used to draw at 0.0 and put a camera/eye somewhere at +Z (the GL/GLut way).
I modified my code to draw somewhere on +Z and now it works as expected smiley

Perspective is more complex and more cpu intensive, and really don't need that.  angry
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
A Noniem
Alien
***
Posts: 38


« Reply #4 on: July 29, 2011, 01:26:42 PM »

Last year I had a course graphics at the university where I pretty much learned everything I know about graphics. The nice thing is that all the lectures are on youtube and Vimeo (and they are in English) If you want to know more about this (for example perspective projections/lightning/shadows/etc) those video's are definitely worth taking a look at.

http://www.youtube.com/playlist?list=PL3259824CD60C3C27

Every lecture is 2x 45min.
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #5 on: July 29, 2011, 01:30:30 PM »

wow ! Thank you very much !  embarrass
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Astral Projection Apophysis 3d Hack Gallery Tahyon 0 1022 Last post October 21, 2012, 02:59:27 PM
by Tahyon
Orthogonal projection + slicing Fragmentarium Patryk Kizny 6 1981 Last post June 15, 2015, 10:48:07 AM
by Patryk Kizny
Projection in Apophysis Help & Support cyseal 0 198 Last post September 17, 2015, 02:23:30 PM
by cyseal
equirectangular projection problems with mandelbulber 2 Mandelbulber sentimentalDonkey 1 2941 Last post July 23, 2016, 10:21:05 PM
by Buddhi
Mandelbulb3D 360 Projection: Brighton Queens Park Images Showcase (Rate My Fractal) 1Bryan1 0 830 Last post December 06, 2016, 07:28:59 AM
by 1Bryan1

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.387 seconds with 24 queries. (Pretty URLs adds 0.018s, 2q)