Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Faking perspective in SFML without vertex shaders  (Read 1791 times)

0 Members and 1 Guest are viewing this topic.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Faking perspective in SFML without vertex shaders
« on: October 02, 2011, 06:29:42 pm »
Aight hello! Has been waiting for the new graphics API for some time but decided I wanted to continue working but I eventually hit the deadspot I've been fearing. I want to fake the perspective without actually doing 3D. I first thought I should modify SFML to support taking in 3D coordinates and do real 3D with opengl but I thought a little and faking it is actually quite interesting and might give some nice retro-feeling. (It's not a 100% off the table, I'm doing it in Ruby so might need the extra performance I would get from real 3D rendering)

Anyway so far I've been faking it by moving the different levels to achieve a depth feeling which is very easily achievable by moving sprites around a little. But I hit the deadspot when I come to walls.

North perspective:



North west perspective:



The problem comes as you see when we reach a corner perspective where two directions meet. Faking it in one direction is easy but two at the same time means that I need to distort the rendering somehow and I have no idea as of how to do it with the current state of SFML2 or if it is even possible?

My question: Will I have to wait for the new graphics API to resolve this and do it with vertex shaders or is there some way to achieve this on the CPU for the time being so I can continue developing the walls?

Aight and remember I'm doing this with rbSFML so just saying "Well modify SFML source yourself" is not as trivial as it sounds.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Faking perspective in SFML without vertex shaders
« Reply #1 on: October 02, 2011, 06:34:28 pm »
Realized that for others the perspective might be hard to see so I tried to make it more visible by adding red lines to show the edges:

Developer and Maker of rbSFML and Programmer at Paradox Development Studio