Author Topic: 3D rendering with 2D Objects  (Read 5358 times)

0 Members and 2 Guests are viewing this topic.

Offline Spliffer

  • ZX 81
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
3D rendering with 2D Objects
« on: February 20, 2016 »
Dear Sirs,

first of all a big :cheers: for this great Forum.
A long time ago in a galaxy far, far away I watched some Demos of DBF and The Tin Dragons.
In these Demos (B3D) the groups used only the 2D commands of B3D to render 3D Objects such as cubes (Glenz-Vectors), vector-scrolls etc.!

I coded my 3D Stuff with the 3D objects of DX, OpenGl, B3D etc, till now. I searched the net for some simle and useful tutorials and/ or code snippets which describe how I have to use projecton-, transformation-, rotation matrices and/ or quaternions to render 3D stuff (first primitives like Cubes, spheres). But sadly I couldn't find any good stuff :skint:.
Every language B3D ,BB ,FB, VB6, VB DotNet, C# etc. perhaps with the help of GDI+ but no DX, Opengl or any 3D library!

Are you able to help me out? ;)


Thanx a lot,
Spliffer

Offline Spliffer

  • ZX 81
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Re: 3D rendering with 2D Objects
« Reply #1 on: February 22, 2016 »
Bad or silly question?

Best regards,
spliffer

Offline flightcrank

  • C= 64
  • **
  • Posts: 37
  • Karma: 24
    • View Profile
Re: 3D rendering with 2D Objects
« Reply #2 on: February 23, 2016 »
well you can leave out perspective projection all and just plot the X and Y of a 3d point for orthogonal projection.
or you can just divide the X and Y by the Z component for perspective projection. its that easy. It will give a 90 degree field of view.

This video by BennyTheBox explains it fairly well. https://www.youtube.com/watch?v=D3IhkRulkFE

as for transformation matrices i reccomend your try it out in 2D first, try kahn acadamy videos on the subject.
Challenge Trophies Won:

Offline spitfire

  • Amiga 1200
  • ****
  • Posts: 275
  • Karma: 9
    • View Profile
Re: 3D rendering with 2D Objects
« Reply #3 on: February 23, 2016 »
It's a good question but hard to answer simply in an easy to understand way.

Like Flightcrank siad you could move 2d coordinates around in 3d space (with a rotation matrix) if you give them a temporary z value like 1 and then use just the the x,y coordinates to draw using your normal 2d squares and circles.

Or you can just layer stuff ontop of each other and move them around (more slowly for the rear stuff) to give an illusion of depth.

A good way to give the illusion of 3d is to move things around with a sin function and also scale its size by that function because the function becomes small at the ends.


Offline Spliffer

  • ZX 81
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Re: 3D rendering with 2D Objects
« Reply #4 on: February 24, 2016 »
Hmmm, thx for the information, I will prepare a tutorial, perhaps in B3D.
I will post the progess then!

Best regards,
Spliffer

Offline spitfire

  • Amiga 1200
  • ****
  • Posts: 275
  • Karma: 9
    • View Profile
Re: 3D rendering with 2D Objects
« Reply #5 on: February 29, 2016 »
Another way I thought of is the classic wormhole effect. You have a height map and slide a texture over it (actually you just animate the texture itself). If the height map is symmetric  and the texture a repeating pattern, it will look like the object is rotating in 3d.

Its interesting to ask then, at what point is it no longer 'fake' 3d? After all, 3d math just makes the illusion of real world 3d on our screen anyway. Unless you truly believe the universe is run on math, then there might be a case that it is just an aspect of the real thing put on screen.

Taking a completely different approach and doing things in such an anti-establishment kind of way is one of the things that has always appealed to me about demoscene.