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

Author Topic: Vanishing Circle Problem  (Read 9937 times)

0 Members and 1 Guest are viewing this topic.

scross

  • Newbie
  • *
  • Posts: 14
    • View Profile
Vanishing Circle Problem
« Reply #15 on: April 30, 2010, 08:49:24 pm »
Quote from: "Laurent"
What you don't seem to realize is that SFML doesn't do anything, views and transformations are (almost) entirely done on the GPU through OpenGL.

You can't write a true double precision view.


I don't know what you mean by 'true', but yes, you'd have to implement it on the CPU rather than the GPU. Are you expecting such a transition to be costly performance wise? (It's probably important to note that speed isn't hugely important in my case)

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Vanishing Circle Problem
« Reply #16 on: April 30, 2010, 08:56:04 pm »
I thought about your problem a little, and I found another way, although I am not sure about how much wok would it cost. My idea is to draw exactly what will be on the screen. So do an intersection between the sun and the viewport, than between the earth and the viewport, etc., and draw the result. How about that?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Vanishing Circle Problem
« Reply #17 on: April 30, 2010, 08:57:09 pm »
Quote
I don't know what you mean by 'true', but yes, you'd have to implement it on the CPU rather than the GPU. Are you expecting such a transition to be costly performance wise? (It's probably important to note that speed isn't hugely important in my case)

I mean that there's nothing we can do because everything is handled on the GPU. And you can't really implement it on the CPU, unless you change the whole rendering process of SFML.

However this might be easier in SFML 2. But I'm still not 100% sure that it would solve your problem, it could be trickier than just switching everything we can to double precision.
Laurent Gomila - SFML developer

scross

  • Newbie
  • *
  • Posts: 14
    • View Profile
Vanishing Circle Problem
« Reply #18 on: April 30, 2010, 09:13:52 pm »
Quote from: "nulloid"
I thought about your problem a little, and I found another way, although I am not sure about how much wok would it cost. My idea is to draw exactly what will be on the screen. So do an intersection between the sun and the viewport, than between the earth and the viewport, etc., and draw the result. How about that?


I'm not sure exactly what you're suggesting...it might be what I'm talking about, which is explained in more detail below...

Quote from: "Laurent"
Quote
I don't know what you mean by 'true', but yes, you'd have to implement it on the CPU rather than the GPU. Are you expecting such a transition to be costly performance wise? (It's probably important to note that speed isn't hugely important in my case)

I mean that there's nothing we can do because everything is handled on the GPU. And you can't really implement it on the CPU, unless you change the whole rendering process of SFML.

However this might be easier in SFML 2. But I'm still not 100% sure that it would solve your problem, it could be trickier than just switching everything we can to double precision.


It's not really a matter of changing the rendering process, as layering double precision calculations on top to find out where the graphical objects should be. Once these calculations are done, we simply draw the circles to the correct positions on the screen. In other words all the rotations, zooming and translations are performed at double precision, so that virtually no error is accumulated during these operations.

In the initial code which demonstrated the problem, I was placing the moon circle at its true position and then using sf::View to translate and zoom it, so that it appears in the centre of the screen, and this is where the error accumulated. Once all the objects are in the right place on the screen, high precision isn't at all important (after all, the smallest value in single precision floating point is about 1.0E-38, which will always be far smaller than a pixel).

What is SFML 2 introducing/changing that should make this easier?

Thanks everyone for your quick responses btw :)

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Vanishing Circle Problem
« Reply #19 on: April 30, 2010, 09:20:13 pm »
Quote from: "scross"
I'm not sure exactly what you're suggesting...it might be what I'm talking about, which is explained in more detail below...

No, I thought about something completely different. If you fail with your current plan, I will explain.

Quote from: "scross"
Thanks everyone for your quick responses btw Smile

You are welcome ^^,

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Vanishing Circle Problem
« Reply #20 on: May 01, 2010, 01:27:39 pm »
Quote
What is SFML 2 introducing/changing that should make this easier?

SFML gives less control to OpenGL on the rendering process:
- The objects transformations are done on the CPU
- The view (projection) is applied on the GPU, but can easily be done on the CPU
Laurent Gomila - SFML developer

scross

  • Newbie
  • *
  • Posts: 14
    • View Profile
Vanishing Circle Problem
« Reply #21 on: May 01, 2010, 06:34:27 pm »
Quote from: "Laurent"
Quote
What is SFML 2 introducing/changing that should make this easier?

SFML gives less control to OpenGL on the rendering process:
- The objects transformations are done on the CPU
- The view (projection) is applied on the GPU, but can easily be done on the CPU


Ok, that sounds good :) Out of interest, what reasons did you have initially for wanting to do object transformations on the CPU in SFML 2, rather than on the GPU as you appear to do in previous versions?

Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Vanishing Circle Problem
« Reply #22 on: May 01, 2010, 06:54:57 pm »
Quote
Ok, that sounds good :) Out of interest, what reasons did you have initially for wanting to do object transformations on the CPU in SFML 2, rather than on the GPU as you appear to do in previous versions?

Driver calls were simply a lot more expensive than doing all this stuff on the GPU (after all, transforming a vertex is just a few additions and multiplies).
It also allows more flexibility and optimizations on my side, like batching.
Laurent Gomila - SFML developer

scross

  • Newbie
  • *
  • Posts: 14
    • View Profile
Vanishing Circle Problem
« Reply #23 on: May 01, 2010, 08:18:58 pm »
Quote from: "Laurent"
Driver calls were simply a lot more expensive than doing all this stuff on the GPU (after all, transforming a vertex is just a few additions and multiplies).


Do you mean the CPU?

Quote from: "Laurent"
It also allows more flexibility and optimizations on my side, like batching.


That sounds good.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Vanishing Circle Problem
« Reply #24 on: May 01, 2010, 08:19:53 pm »
Quote
Do you mean the CPU?

Oops, yes :)
Laurent Gomila - SFML developer

 

anything