Author Topic: [BMAX] 3D Cube overlapping faces  (Read 2050 times)

0 Members and 1 Guest are viewing this topic.

Offline marclurr

  • C= 64
  • **
  • Posts: 45
  • Karma: 2
    • View Profile
[BMAX] 3D Cube overlapping faces
« on: August 11, 2015 »
Hello!

It's been a long time since posted here. Yesterday I was reminiscing of a time when I used to play with Yabasic and BlitzBasic and decided I had to give it a try again.

My problem ,I imagine is very simple, and has been solved long ago but I'm struggling to find any good explanations of the solution.

I have a cube rendered in 2D. My issue is when drawing the faces, some polygons from adjacent faces overlap. It's clear to me that I need some way of determining whether a polygon should be rendered or not. This is where I'm stuck - is there some standard way of doing this?


Thanks
marclurr

Offline marclurr

  • C= 64
  • **
  • Posts: 45
  • Karma: 2
    • View Profile
Re: [BMAX] 3D Cube overlapping faces
« Reply #1 on: August 12, 2015 »
Ok I managed to get this working. I found a similar problem discussed here, where the cross-product was suggested.

http://www.dbfinteractive.com/forum/index.php?topic=401.msg5140#msg5140

It wasn't immediately obvious how to apply it to my code but after some digging through some old YaBasic demos on MrD's emulator website I managed to figure it out.

This place is an excellent resource!

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: [BMAX] 3D Cube overlapping faces
« Reply #2 on: August 12, 2015 »
Can you do 3D Hexagon wireframe(quite tricky one)? I dont think I could be able to do that but I think Shockwave(yes, it is one of my fav demo where it had 3D Tunnel with 3D Hexagon moving round with cool music! The links of is this one http://www.pouet.net/prod.php?which=29984 ) done it before!

Offline marclurr

  • C= 64
  • **
  • Posts: 45
  • Karma: 2
    • View Profile
Re: [BMAX] 3D Cube overlapping faces
« Reply #3 on: August 12, 2015 »
Possibly. I think doing a wireframe wouldn't be that much more difficult than a cube - just a few more vertices and lines to connect the correct ones. Rendering one with 'solid faces' might be a bit more complicated. I think the complication would lie in defining your polygons in the right order (as the cross-product requires a consistent order to work correctly), but a bit of trial an error would probably sort that.

Maybe I should test my theories..? ;)

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1207
  • Karma: 230
    • View Profile
    • Homepage
Re: [BMAX] 3D Cube overlapping faces
« Reply #4 on: August 13, 2015 »
Good thing you got it working! Here's to a little celebratory demo for your return to ya/blitzbasic.  :cheers:

Your name reminds me of the guy from the simpsons, “Hello! I'm Troy McClure! You might know me from films such as ...”  ;)
www.kirl.nl
Challenge Trophies Won: